Network flow and graph (2)

In the previous section, we talked about the degenerate circle direction search algorithm, which can obtain the global optimal solution. However, during the operation of the algorithm, it is necessary to select a feasible improvement circle direction, which is not easy for a large network flow. We need to find ways to confirm the direction of the feasible circle of improvement every cycle or prove that it does not exist. Let's talk about it now

Portal: Network Flow and Graph (1)

1

Optimal Flow Elimination Algorithm

First, we need to define the residual digraph :

21e3a0a37d3a54707bdb71c43f20cbef.png

As an example, for the network graph below where the numbers on the arcs represent cost, capacity, and flow, the residual directed graph constructed is:

ab8c8606eb04616d3442db939ba55a4d.png

The significance of residual directed graph construction is that the direction of the feasible improvement circle can be confirmed, only need to meet:

59e2a82ae3414a2b56bfea1a05b592e2.png

In this way, we only need to determine whether there is a negative loop in the residual directed graph to determine the direction of the feasible improvement circle. Recall that in the shortest path planning chapter we mentioned that the Floyd-Walshaw algorithm can also be used to check for negative loops in network flows.

Apply the Floyd-Walshaw algorithm to the residual directed graph corresponding to the current feasible flow: a negative cycle may be obtained, which means that the direction of the corresponding cycle in the original graph can be improved; it may also complete a shortest path calculation, namely Prove that the direction of the feasible improvement circle does not exist.

Apply the Floyd-Walshaw algorithm to the above example and execute the code directly to get the result:

Portal: Shortest Path and Dynamic Programming (2)

00adcd7437047943302cbaba59d82711.png

v[4,4]=-14, there is a negative loop, backtracking can get its negative loop: 4-2-1-3-4. This road is the direction of the feasible improvement circle corresponding to the original graph.

So far, we can get the network flow elimination circle algorithm :

dcf71ed7884eda590bec318a53bb2a11.png

Going back to the OOI case, we apply the network flow elimination circle algorithm to see the specific process.

At time t=0, the original graph and residual directed graph are:

fcefe7974647019ddbf4fbaf3fea6e4e.png

Get the negative weight loop 7-3-4-7, c=-12, λ=25. Iterate down,

At time t=1, the original graph and residual directed graph are:

2f555df88ba77b52ce80d6613f248ba2.png

Get the negative weight loop 7-3-1-4-7, c=-11, λ=560. Iterate down,

At time t=2, the original graph and residual directed graph are:

91cea83d5a63fb3503b1319a30b573f2.png

Get the negative weight loop 7-3-2-4-7, c=-9, λ=25. Iterate down,

At time t=3, the original graph and residual directed graph are:

15db539c853131ec26da081d7c478567.png

There is no negative weight loop in the residual directed graph, and the model is optimal!

2

network simple circle method

So far, the minimum-cost network flow models discussed are all linear programming problems, and we know that there is also a simplex method to solve this problem. In this section we use the simplex direction to develop the network simplex method (network simplex).

Consider the circle 2-3-1-4-2 of an OOI project:

23b68ab5eab20091cacd3935568a1898.png

The corresponding columns of the node-arc correlation matrix containing the circle in the figure are:

08eca8643a53b4ee3c909232415fbe80.png

Suppose we assign weight +1 to the column vector corresponding to the forward arc in the circle, and assign -1 to the weight of the backward arc, then:

ba3ced13dd6e9bd07f2a90a37eccbe76.png

means that the columns are linearly related, since any one vector can be represented by a non-zero linear combination of other vectors. We get a knowledge: the node-arc association column representing the arc in the circle will form a linearly dependent set

Since the initial basis requirement of the simplex method is linearly independent, we immediately get a conclusion:

In the minimum cost network flow model, the base arc set cannot contain a cycle; and each linearly dependent arc set contains a cycle

Next, we continue to introduce other concepts. If there is a link between every pair of nodes in a graph, the graph is said to be connected . A graph is a tree if it is connected and contains no cycles . A tree is a spanning tree if it connects every node in the graph .

Some examples are shown below.

fed353ee6ad46446caad4e2ca847e511.png

We also know that the basis must be a maximally linearly independent set. Inserting any other arc into the spanning tree will form a circle, thus forming a linearly dependent set. So we quickly get: the spanning tree corresponds to the largest linearly independent set and basis.

In the node-arc incidence matrix of the minimum cost network flow problem, a set of columns forms a basis if and only if its corresponding arcs can form a spanning tree of the associated directed graph.

Next, it is only necessary to determine the initial basic solution of the simplex and the direction of the simplex cycle. The simple circle direction is very easy to determine, just need to add the circle formed by the flow on the non-base arc with zero flow.

Under the basic solution of the network flow problem, the flow on non-basic arcs is equal to 0 or the capacity u . The flow on the base arc is uniquely determined, and flow balance can be achieved at characteristic non-base values. A flow is basically feasible if the flows on all base arcs are within the bounds.

For example, for the initial base solution of the following OOI:

105068806e61154fc58f884d8dd05a72.png

The numbered part is the current feasible flow, and the red part is the corresponding spanning tree, which means the initial basic feasible flow. For each non-base arc, find the corresponding simplex direction:

e8e2535904afbc48ab68e8d4b11bc294.png

Finally, choose the improved simple circle direction for improvement. So far, we have obtained the network simple search algorithm:

630c23acc32d7845f706780e057f48bf.png

Applying this algorithm, the iterative process of the above OOI case is obtained.

At t=0, the simplex direction is selected (2,4), the simplex circle is 2-4-1-8-2, and the step size is 75, and we get:

06d4674af9dbdf66c5f6cb907d695090.png

Set t=1 to find the simplex direction corresponding to the non-base arc:

8e9ad64c315a5a296371f6521266d173.png

Simplex direction selection (3,4), simplex circle is 3-4-2-3, step size is 25, get:

b841b83502a0354a7cc6602898b8e4ec.png

Set t=2 to find the simplex direction corresponding to the non-base arc:

c532b836c6722ed62b4bbdac7fe6b42a.png

Simplex direction selection (3,4), simplex circle is 3-4-2-3, step size is 25, get:

4465f8e5e560c2e9e4701c1514dc5ab0.png

Set t=3, there is no improved simplex direction at this time, and the iteration stops.

Guess you like

Origin blog.csdn.net/qq_27388259/article/details/129106967