Minimum cost maximum flow problem

Source: Internet
Author: User

minimum cost maximum flow

"MCMF Problem and mathematical model"

When we introduce the maximum flow problem, we give a list of the biggest material delivery flow problem. If the known conditions of this problem also include the cost of transporting units per side, then how to transport them to get the maximum traffic, and the lowest transport costs. This is the so-called minimum cost maximum flow problem.
On the basis of the definition of the maximum flow, if there is another weighted W (e) (representing the cost of the unit flow) in addition to the weighted C (e) (representing the edge capacity), and the maximum flow value for the network is F, then the minimum cost maximum flow problem is clearly described by the following linear programming model:

Min∑w (e) f (e)
E∈e

Meet 0≤f (E) ≤c (e), on all e∈e
f+ (v) =f-(v), for all V∈v
f+ (x) =f (maximum flow constraint)
(or f (y) =f)

"Algorithmic thinking"

To solve the minimum cost maximum flow problem, there are generally two ways. One approach is to first use the maximum flow algorithm to calculate the maximum flow, and then based on the cost of the edge, check whether it is possible to adjust the flow of traffic under the premise of the balance, so that the total cost can be reduced. As long as there is this possibility, make such adjustments. After adjusting, get a new maximum stream.
Then, on the basis of this new stream, continue to check, adjust. This iteration continues until no adjustment is possible, resulting in a minimum cost maximum flow. This idea is characterized by maintaining the feasibility of the problem (always keeping the maximum flow) to the optimal propulsion. The other solution is similar to the idea of the maximum flow algorithm described earlier, typically giving the first 0 streams as the initial stream. The cost of this flow is zero, of course the minimum cost. It then looks for a source-to-sink chain, but requires that the flow-up chain be the least expensive of all the flow-up chains. If the flow chain can be found, the flow is increased on the flow-up chain, and a new flow is obtained. This flow is treated as the initial flow and continues to look for the flow of the flow. This iteration continues until the flow chain is not found, and the stream is the minimum cost maximum flow. The idea of this algorithm is characterized by maintaining the optimality of the solution (each time the new flow is the lowest cost), and gradually approaching the feasible solution (until the maximum flow is a viable solution).
Because the second algorithm and the proposed maximum flow algorithm approach, and the algorithm to find the minimum cost of the flow chain, can be transformed into a search for the source point to the sink point of the shortest path problem, so here the algorithm is introduced.

In this algorithm, in order to find the minimum cost of the flow-up chain, for each current flow, we need to establish a network flow with the increase of the network. For example, Figure 1 network g is a flow with a minimum cost, the edge-side parameter is C (e), F (E), W (e), and Figure 2 is the network flow g′. The vertex of the augmented-flow network is the same as the original network. Establish the edge of the streaming network as follows: If the G mid-side (u,v) flow is not full, that is F (u,v), E (u,v), then G ' in the building Edge (U,V), Empowering W ' (u,v) =w (u,v); If the G-Medium edge (U, v) has flow, i.e. F (u,v) 〉0, the g′ is built-in (V,u), Empowering W′ (V,u) =-w (u,v). After the network is established, the shortest path of the source point to the meeting point can be obtained on this network, so as to determine the increment path, and then increase the flow through this path on the original network. Here, the use of the maximum flow algorithm is still the principle of the flow, only the minimum cost must be selected to increase the flow chain.
There is one problem in the calculation that needs to be solved. This is the g′ network in the negative right side, and therefore can not directly apply the label method to find the shortest path x to Y, using other methods to calculate the shortest path of the network with negative weights to find the shortest path x to Y, will greatly reduce the computational efficiency. In order to still use the marking method to calculate the shortest path, after each establishment of the flow network to obtain the shortest path, the network g of the right W (e) To make a correction, so that the re-built network will not appear negative edge, and ensure that the shortest path is not changed. This method of modification is described below.
When the flow value is zero, the first time to build the network to find the shortest path, because there is no negative weight edge, of course, can be used to calculate the label method. In order to make the subsequent establishment of the flow network without negative weight side, the method is to have the flow edge in G (f (e) >0) Right W (e) corrected to 0. For this reason, each time the shortest path is obtained on the augmented flow network, the following formula calculates the new Benquan W "(U,v) in G:

W "(U,v) =l (U)-l (v) +w (u,v) (*)

L (U), L (v)-Calculates the label value of U and V for the g′ X-to-y shortest path. For the first time, if (u,v) is an edge on the flow path, the shortest path algorithm must have L (v) =l (u) +w ' (u,v) =l (u) +w (u,v), and the (*) type must have

W″ (u,v) = 0.

if (U,V) is not an edge on the flow path, there must be:
L (v) ≤l (u) +w (u,v),
The substituting (*) formula has W (u,v) ≥0.

Visible after the first correction W (e), on either side, there are W (e) ≥0, and the flow of the edge (the edge of the flow chain), there must be w (e) = 0. After each iteration of the calculation, if f (u,v) >0, the flow network needs to establish (V,u) edge, Edge weights W ' (v,u) =-w (u,v) = 0, that is, no longer negative weight edge.
In addition, each iteration calculation with (*) Correction of all W (e), it is not difficult to prove that for each path x to Y, its path length is also increased l (x)-L (y). Therefore, the shortest path from X to Y does not change due to the correction of W (e).

"Calculation Steps"

1. For network G=[v,e,c,w], give the initial stream with zero stream value.
2. The g′=[v′,e′,w′ network that accompanies this flow].
The vertices of the g′ are the same as g:v′=v.
If G in F (u,v) If G is f (u,v) >0, then g′ (v,u), w′ (v,u) =-w (u,v).
3. If the g′ does not have a path from X to Y, then the flow of G is the maximum flow of the minimum cost,
Stop the calculation, otherwise use the label method to find the shortest path x to y p.
4. On the basis of P, increase the flow on the G: on each side of P (u,v), if G exists (U,V), then (u,v) the flow, if G exists (V,u), then (v,u) reduce the flow. When the flow is increased (minus), it should be guaranteed to have C (e) ≥f (e) ≥0 on either side.
5. According to the label value of each vertex when calculating the shortest path L (v), modify the weights W (e) for all sides of G according to the following formula:

L (U)-l (v) +w (e) →w (e).

6. Treat the new stream as the initial stream, and go to 2.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.