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

min cost max flow
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Min Cost Max Flow

S05

slide-2
SLIDE 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. $5 $3 $6 $3 $4 $5 $6 $2 15 25 10 5 5 20 10 15

Task: Find a maximum flow from s to t with minimum cost

slide-3
SLIDE 3

s v u t 10 30 5 20 10 15 s v u t $5 $3 $4 $2 $6 $1

Shortest Path Problem Maximum Flow Problem

Only consider the cost Only consider the capacity and flow

What we have learn…

s v u t 10/10 25/30 0/5 20/20 5/10 15/15

slide-4
SLIDE 4

Minimum 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.

s v u t 10 $5 30 $6 5 $3 20 $4 10 $1 15 $-2 (a)A flow graph with cost s v u t ?/10 $5 ?/30 $6 ?/5 $3 ?/20 $4 ?/10 $1 ?/15 $-2 (b)How to find a min-cost maximum flow?

slide-5
SLIDE 5

Optimal Criteria

  • Question. Given A maximum flow f, is it optimal?
  • Claim. The cost of a maximum flow f is minimum iff there’s no negative

cycle in the residual network of f.

s v u t 10/10 25/30 0/5 20/20 5/10 15/15 $5 $3 $4 $-2 $6 $1 Is it’s cost minimum?

val(f) = 30 cost(f) = 255

slide-6
SLIDE 6

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

slide-7
SLIDE 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 Gf Suppose there is a negative cycle C in Gf. Then construct a flow 𝑔′ = 𝑔 + 𝐷 For 𝑔′: 𝑤𝑏𝑚 𝑔′ = 𝑤𝑏𝑚 𝑔 + 𝑤𝑏𝑚 𝐷 = 𝑤𝑏𝑚 𝑔 + 0 = 𝑤𝑏𝑚 𝑔 𝑑𝑝𝑡𝑢 𝑔′ = 𝑑𝑝𝑡𝑢 𝑔 + 𝑑𝑝𝑡𝑢 𝐷 < 𝑑𝑝𝑡𝑢 𝑔 Contradiction.

slide-8
SLIDE 8

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

slide-9
SLIDE 9
  • Define: A circulation is a flow which is balanced at every

node(including s and t) in the network.

s v u t 10/10 5/30 15/15 10/30 5/10 w 10/15

slide-10
SLIDE 10

lemma: Any circulation f can be decomposed entirely into cycles and 𝑑𝑝𝑡𝑢 𝑔 = 𝑗 𝑑𝑝𝑡𝑢(𝐷𝑗).

s v u t 10/10 5/30 15/15 10/30 5/10 w 10/15 s v u 10/10 10/15 10/30 w 10/15 v u t 5/30 5/15 5/10

slide-11
SLIDE 11

Observation: the difference of two flows f1 and f2 with the same value is a circulation in the residual network Gf2 (where the capacities are C-f2).

s v u t 10/10 20/30 0/5 15/20 5/10 10/15 $5 $3 $4 $-2 $6 $1 s v u t 5/10 17/30 0/5 20/20 8/10 12/15 $5 $3 $4 $-2 $6 $1 s v u t 5/10 3/30 0/5 5/20 3/10 2/15 $5 $3 $-4 $2 $6 $-1 f1 f2 f1-f2

slide-12
SLIDE 12
  • 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.

Proof

Part 2: no negative cycle in Gf min cost max flow f

slide-13
SLIDE 13

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

slide-14
SLIDE 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;

slide-15
SLIDE 15

s v u t 10/10 25/30 0/5 20/20 5/10 15/15 $5 $3 $4 $-2 $6 $1 (a)Maximum Flow f s v u t 10 5 5 20 5 15 $-5 $3 $-4 $-2 $6 $1 $-6 5$-1 25 (b)Residual Network Flow Gf 25 s v u t 5 5 $3 $1 $-6 (c)a negative cycle in Gf(not optimal) s v u t 10 10 20 15 $-5 $-4 $-2 $6 $-6 10 $-1 20 (d)Residual Network Flow Gf 5 $-3 5 s v u t 5 5 $3 $1 $-6 (c)negative cycle(to remove) s v u t 10/10 30/30 5/5 20/20 10/10 15/15 $5 $3 $4 $-2 $6 $1 (c)Maximum flow f’(f+negative cycle)

val(f) = 30 cost(f) = 245

Continue to do this until there is no negative cycle in the residual network………

val(f) = 30 cost(f) = 255

slide-16
SLIDE 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

𝑃(𝑊𝐹)

slide-17
SLIDE 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 ∗ ( 𝑓 𝑑𝑝𝑡𝑢 𝑓 ∗ 𝑑𝑏𝑞𝑏𝑑𝑗𝑢𝑧 𝑓 ))
slide-18
SLIDE 18

Q&A