min cost max flow
play

Min Cost Max Flow S05 capacity: maximum number of trucks that can go - PowerPoint PPT Presentation

Min Cost Max Flow S05 capacity: maximum number of trucks that can go through this road at a time. cost: money should be paid for each truck on this road. $4 10 $5 $5 $3 15 15 5 20 $6 10 $2 25 $3 5 $6 Task : Find a maximum flow from


  1. Min Cost Max Flow S05

  2. capacity: maximum number of trucks that can go through this road at a time. cost: money should be paid for each truck on this road. $4 10 $5 $5 $3 15 15 5 20 $6 10 $2 25 $3 5 $6 Task : Find a maximum flow from s to t with minimum cost

  3. What we have learn … Only consider the cost Only consider the capacity and flow Maximum Flow Problem Shortest Path Problem v v v 10/10 10 25/30 30 $6 $5 s s t t 5 15/15 15 0/5 s t $3 $2 $4 10 5/10 20 20/20 $1 u u u

  4. Minimum Cost Maximum Flow v v 10 $5 ?/30 $6 30 $6 ?/10 $5 ?/5 $3 s t s t ?/15 $-2 5 $3 15 $-2 ?/10 $1 10 $1 ?/20 $4 20 $4 u u (a)A flow graph with cost (b)How to find a min-cost maximum flow? Definition. The cost of a flow f is defined as: Definition. A minimum cost maximum flow of a network G = (V, E) is a maximum flow with the smallest possible cost.

  5. Optimal Criteria Question. Given A maximum flow f, is it optimal? v 10/10 25/30 $5 $6 val(f) = 30 cost(f) = 255 s t 15/15 0/5 $3 $-2 5/10 20/20 $1 $4 u Is it’s cost minimum? Claim. The cost of a maximum flow f is minimum iff there’s no negative cycle in the residual network of f.

  6. v v 5 10 10/10 25 25/30 $6 $-5 $-6 $5 $6 s t 15 5 s t 15/15 0/5 5$-1 $2 $3 $3 $-2 $-4 5 20 $1 5/10 20/20 $1 u $4 u (a)Maximum Flow f (b)Residual Network Flow G f v v 25 5 $-6 $-6 15 5 s s t t $2 $2 5 5 $1 $1 u u (c)a negative cycle C in G f (c)a negative cycle C in G f

  7. Claim. The cost of a maximum flow f is minimum iff there’s no negative cycle in the residual network of f. Proof Part 1: min cost max flow f no negative cycle in G f Suppose there is a negative cycle C in G f . Then construct a flow 𝑔 ′ = 𝑔 + 𝐷 For 𝑔′ : 𝑤𝑏𝑚 𝑔 ′ = 𝑤𝑏𝑚 𝑔 + 𝑤𝑏𝑚 𝐷 = 𝑤𝑏𝑚 𝑔 + 0 = 𝑤𝑏𝑚 𝑔 𝑑𝑝𝑡𝑢 𝑔 ′ = 𝑑𝑝𝑡𝑢 𝑔 + 𝑑𝑝𝑡𝑢 𝐷 < 𝑑𝑝𝑡𝑢 𝑔 Contradiction.

  8. v v 5 10 10/10 25 25/30 $6 $-5 $-6 $5 $6 s t 15 5 s t 15/15 0/5 5$-1 $2 $3 $3 $-2 $-4 5 20 $1 5/10 20/20 $1 u $4 u (a)Maximum Flow f cost(f) = 255 (b)Residual Network Flow G f v v 10/10 20/30 5 $5 $6 $-6 5 s t s t 10/15 0/5 $2 $3 $-2 5 10/10 20/20 $1 $1 u $4 u (c)a negative cycle C in G f cost(f) = 240 (d)f+C with a lower cost

  9. • Define: A circulation is a flow which is balanced at every node(including s and t) in the network. s v 10/10 5/30 15/15 t 10/30 5/10 10/15 w u

  10. lemma: Any circulation f can be decomposed entirely into cycles and 𝑑𝑝𝑡𝑢 𝑔 = 𝑗 𝑑𝑝𝑡𝑢(𝐷 𝑗 ) . s v 10/10 10/15 10/30 s v 5/30 10/10 10/15 w u 15/15 t 10/30 v 5/10 5/30 10/15 w u 5/15 t 5/10 u

  11. Observation: the difference of two flows f 1 and f 2 with the same value is a circulation in the residual network G f2 (where the capacities are C-f 2 ). v v 10/10 20/30 5/10 17/30 $5 $6 $5 $6 s t 10/15 0/5 s t 12/15 0/5 $3 $-2 $3 $-2 5/10 15/20 8/10 $1 20/20 $4 u $1 $4 u f1 f2 v 5/10 3/30 $5 $6 s t 2/15 0/5 $3 $2 3/10 5/20 $-1 $-4 u f1-f2

  12. Proof Part 2: no negative cycle in G f min cost max flow f • Suppose there is a maximum flow f’ with a lower cost than f. • f’ – f is a circulation f’’. Cost(f’’) = cost(f’) – cost (f) < 0. • 𝑑𝑝𝑡𝑢 𝑔′′ = 𝑗 𝑑𝑝𝑡𝑢(𝐷 𝑗 ) => ∃𝐷 𝑗 : 𝑑𝑝𝑡𝑢(𝐷 𝑗 ) < 0 . • So 𝐷 𝑗 is a negative cycle and it is also feasible in the residual net work of f.

  13. v v 10/10 10/10 25/30 20/30 $5 $6 $5 $6 s t 15/15 s t 0/5 10/15 0/5 $3 $-2 $3 $-2 5/10 10/10 20/20 20/20 $1 $1 $4 u $4 u (a)Maximum Flow f (b)a maximum flow f’ with a lower cost v v 0/10 5 10 5/30 25 $6 $-5 $5 $-6 $-6 s t s t 5/15 15 5 0/5 5$-1 $2 $3 $3 $2 $-4 5/10 5 20 0/20 $1 $1 u $4 u (b)Residual Network Flow G(f) (c)f’ -f

  14. Cycle canceling algorithm: begin establish a feasible maximum flow f in the network; while G(f) contains a negative cycle : use some algorithm to identify a negative cycle W; 𝛽 is the minimum residual capacity along the cycle; augment 𝛽 units of flow in the cycle W and update G(f); end;

  15. v v 5 10 10/10 25/30 25 $6 $-5 $-6 $5 $6 s t 15 5 s t 15/15 0/5 5 $-1 $-2 $3 val(f) = 30 $3 $-2 $-4 cost(f) = 255 5 20 $1 5/10 20/20 $1 u $4 u (a)Maximum Flow f (b)Residual Network Flow G f v v v v 10/10 10 30/30 10 20 25 5 $6 $-5 $5 $6 $-6 $-6 $-6 5 s s s t t t 15/15 s t 5/5 5 5 15 $-1 $-3 $3 $3 $-2 $3 $-2 10 val(f) = 30 $-4 5 5 cost(f) = 245 10/10 20 20/20 $1 $1 $1 $4 u u u u (c)negative cycle(to remove) (c)Maximum flow f’( f+negative cycle) (c)a negative cycle in G f (not optimal) (d)Residual Network Flow G f Continue to do this until there is no negative cycle in the residual network………

  16. Time complexity • The total time = time (maximum flow) + time(find a negative cycle) * iteration times • Use Edmonds – Karp algorithm to find a maximum flow and time is 𝑃(𝑊𝐹 2 ) • Use Bellman-Ford algorithm to find a negative cycle and the time is 𝑃(𝑊𝐹)

  17. • In the integer capacity and weight case, every negative cycle decreases the cost by 1. • So the iteration times <= 𝑓 |𝑑𝑝𝑡𝑢 𝑓 ∗ 𝑑𝑏𝑞𝑏𝑑𝑗𝑢𝑧(𝑓)| . • So the total time complexity is O(VE ∗ ( 𝑓 𝑑𝑝𝑡𝑢 𝑓 ∗ 𝑑𝑏𝑞𝑏𝑑𝑗𝑢𝑧 𝑓 ))

  18. Q&A

Recommend


More recommend