Upload
roch
View
62
Download
0
Tags:
Embed Size (px)
DESCRIPTION
ENGM 792 Network Flow Programming. Minimum Cost Flow Solutions. Minimum Cost Flow Solutions. Primal Algorithm Find an initial network flow that satisfies primal feasibility Determine is network is optimal. If so, stop. If not, go to 3. Modify network flow, return to step 2. - PowerPoint PPT Presentation
Citation preview
ENGM 792Network Flow Programming
Minimum Cost Flow Solutions
Minimum Cost Flow Solutions
• Primal Algorithm1. Find an initial network flow that satisfies primal
feasibility2. Determine is network is optimal. If so, stop. If
not, go to 3. 3. Modify network flow, return to step 2.
Minimum Cost Flow Solutions
• Initial feasible solution1. Maximal flow2. Use of artificial arcs
Initial Feasible (Max Flow)
1
2
3
4
5
6
[4]
[3]
[3]
[-6]
[-3]
[-2]1
23
4
56
78
9
(1,5)
(3,3)(2,6)
(2,1)
(4,3)
(2,2)
(4,3)
(2,5)
(1,4)
7(2,1) (2,-3)
Initial Feasible (Max Flow)
1
2
3
4
5
6
[4]
[3]
[3]
[-6]
[-3]
[-2]1
(1,1)
7
[0]
[bfi](flow, capacity)
Start at top and assign Max flow to each arc
Assign 1 unit flow arc 1Need to satisfy 3 more Units of supply
Need one more unit at Node 4
[3] [1]
Initial Feasible (Max Flow)
1
2
3
4
5
6
[3]
[3]
[3]
[-6]
[-3]
1
2(2,2)
(1,1)
7
[0]
[bfi](flow, capacity)
Start at top and assign Max flow to each arc
Assign 1 unit to arc 1, 2 units to arc 2Need to satisfy 1 more Unit of supply
[1] [-1]
[-1]
Initial Feasible (Max Flow)
1
2
3
4
5
6
[1]
[3]
[3]
[-6]
1
23
(1,4)
(2,2)
(1,1)
7
[0]
[bfi](flow, capacity)
[0] Start at top and assign Max flow to each arc
Assign 1 unit to arc 1, 2 units to arc 21 unit to arc 3
Arc 3 could take 3 more Units of flow, but supply Is exhausted
[-1]
[-1]
[-5]
Initial Feasible (Max Flow)
1
2
3
4
5
6
[3]
[0]
[-4]
[0]
[0]
(1,4)
(2,2)
(1,1)
7
[0]
[bfi](fk,ck)
(1,2)
(1,3)
(1,2)
[4]
[3]
[3]
[-6]
[-3]
[-2]
[0]
Initial Feasible (Max Flow)
1
2
3
4
5
6
[2]
[0]
[-3]
[0]
[0]
(1,4)
(2,2)
(1,1)
7
[0]
[bfi](fk,ck)
(1,2)
(1,3)
(1,2)
[4]
[3]
[3]
[-6]
[-3]
[-2]
[0]
(1,1)
Arc 3 to 6 now at capacity, But we still need to meet2 units of supply at node 3
Max flow says look at arc 3 to 4 and arc 3 to 5
Initial Feasible (Max Flow)
1
2
3
4
5
6
(2,4)
(2,2)
7
[0]
[bfi](fk,ck)
(2,3)
(1,2)
(1,1)
(2,4)[0]
[0]
[-1]
[0]
[0]
[4]
[3]
[3]
[-6]
[-3]
[-2]
[0]Arc 3 to 6 now at capacity, But we still need to meet2 units of supply at node 3
Max flow says look at arc 3 to 4 and arc 3 to 5
Arc 3 to 4 allows us to meetSupply at node 3. We remove Arc 1 to 4 since it forces us to Exceed demand at 4
Initial Feasible (Max Flow)
1
2
3
4
5
6
[0]
[0]
[0]
[0]
[0]
[0]
(3,4)
(1,2)
7
[-1]
[bfi](flow, capacity)
(2,3)
(1,2)
(1,1)
(1,2) (0,2)
(1,2)
(2,4)
Final max flowSolution
Initial feasible solution
Is it basic ?
Initial Feasible (Max Flow)
1
2
3
4
5
6
[4]
[3]
[3]
[-6]
[-3]
[-2]1
23
4
56
78
9
(1,5)
(3,3)(2,6)
(2,1)
(4,3)
(2,2)
(4,3)
(2,5)
(1,4)
7(2,1) (2,-3)
Initial Feasible (Max Flow)
1
2
3
4
5
6
[0]
[0]
[0]
[0]
[0]
[0]
(3,4)
(1,2)
7
[-1]
[bfi](flow, capacity)
(2,3)
(1,2)
(1,1)
(1,2) (0,2)
(1,2)
(2,4)
Final max flowSolution
Initial feasible solution
Is it basic ?
We essentially have 3 supply nodes, 1 dummy supply, and 3 demand nodes or n+m-1=6 .
A basic feasible will have 6 arcs with flow. We have 8
Initial Feasible (Artificial Arc)
1
2
3
4
5
6
[4]
[3]
[3]
[-6]
[-3]
[-2]
7 (3,3,R)
(2,2,R)
(6,6,R)
(4,4,R)(3,3,R)
(3,3,R)
(Flow, capacity, cost)
We must add the possibilityOf a slack flow since demandExceeds supply
Initial Feasible (Artificial Arc)
1
2
3
4
5
6
[4]
[3]
[3]
[-6]
[-3]
[-2]
7 (3,3,R)
(2,2,R)
(6,6,R)
(4,4,R)(3,3,R)
(3,3,R)
Flow, capacity, cost)
(0,2,1)
(0,2,-3)Note that we have 7 Nodes; n+m-1 = 6We have 6 arcs with flow
Initial basic feasible soln.
We now add in remaining Arcs with zero flow.
Initial Feasible (Artificial Arc)
1
2
3
4
5
6
[4]
[3]
[3]
[-6]
[-3]
[-2]1
23
4
56
78
9
(0,5)
(0,3)(0,6)
(0,1)
(0,3)
(0,2)
(0,3)
(0,5)
(0,4)
7 (3,3,R)
(2,2,R)
(6,6,R)
(4,4,R)(3,3,R)
(3,3,R)
Flow, capacity, cost)
(0,2,1)
(0,2,-3)
Moving to a Solution
• For each basic arc
• For each non-basic arc
jki h
kkjki
kjki
cfifh
fifh
,
,
0
Moving to a Solution
• For each basic arc
• For each non-basic arc
jki h
jkik hd
ikjk hd
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(3,3,3)(2,4,3)
(1,2,6)(0,2,1)(2,2,5)
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(3,3,3)(2,4,3)
(1,2,6)(0,2,1)(2,2,5)
Six basic arcs
For each basic arc,
We start with 7 = 0
jki h
[0]
11 10
1
96
74
3
852
[j]
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(3,3,3)(2,4,3)
(1,2,6)(0,2,1)(2,2,5)
Six basic arcs
For each basic arc,
We start with 7 = 0
3 = 0 + 1 = 1
jki h
[0]
11 10
1
96
74
3
852
[1]
[j]
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(3,3,3)(2,4,3)
(1,2,6)(0,2,1)(2,2,5)
jki h
[0]
11 10
1
96
74
3
852
[1]
Six basic arcs
For each basic arc,
We start with 7 = 0
3 = 0 + 1 = 1
4 = 1 + 3 = 4
[4]
[j]
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(3,3,3)(2,4,3)
(1,2,6)(0,2,1)(2,2,5)
jki h
[0]
11 10
1
96
74
3
852
[1]
Six basic arcs
For each basic arc,
We start with 7 = 0
3 = 0 + 1 = 1
4 = 1 + 3 = 4
[4]
[7]
[2]
[5]
[2]
{1}
[j]
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(3,3,3)(2,4,3)
(1,2,6)(0,2,1)(2,2,5)
[0]
11 10
1
96
74
3
852
[1]
For each non basic arc,
We start with
d10 = 4+-3-0 = 1
[4]
[7]
[2]
[5]
[2]
jkik hd
[j]
{1}{dk}
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(3,3,3)(2,4,3)
(1,2,6)(0,2,1)(2,2,5)
[0]
11 10
1
96
74
3
852
[1]
For each non basic arc,
We start with
d10 = 4+-3-0 = 1
d1 = 2+4-4 = 2
[4]
[7]
[2]
[5]
[2]
jkik hd
[j]
{dk}{1}
{2}
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(3,3,3)(2,4,3)
(1,2,6)(0,2,1)(2,2,5)
[0]
11 10
1
96
74
3
852
[1]
For each non basic arc,
We start with
d10 = 4+-3-0 = 1
d1 = 2+4-4 = 2
d4 = 2+2-4 = 0
[4]
[7]
[2]
[5]
[2]
jkik hd
[j]
{dk}{1}
{2}{0}
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(3,3,3)(2,4,3)
(1,2,6)(0,2,1)(2,2,5)
[0]
11 10
1
96
74
3
852
[1]
For each non basic arc,
We start with
d10 = 4+-3-0 = 1
d1 = 2+4-4 = 2
d4 = 2+2-4 = 0
d5 = 2+1-7 = -4
[4]
[7]
[2]
[5]
[2]
jkik hd
[j]
{dk}{1}
{2}{0}
{-4}
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(3,3,3)(2,4,3)
(1,2,6)(0,2,1)(2,2,5)
[0]
11 10
1
96
74
3
852
[1]
For each non basic arc,
We start with
d10 = 4+-3-0 = 1
d1 = 2+4-4 = 2
d4 = 2+2-4 = 0
d5 = 2+1-7 = -4
d9 = 1+5-5 = -1
[4]
[7]
[2]
[5]
[2]
jkik hd
[j]
{dk}{1}
{2}{0}
{-4}
{-1}
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(3,3,3)(2,4,3)
(1,2,6)(0,2,1)(2,2,5)
[0]
11 10
1
96
74
3
852
[1]
For each non basic arc,
We start with
d10 = 4+-3-0 = 1
d1 = 2+4-4 = 2
d4 = 2+2-4 = 0
d5 = 2+1-7 = -4
[4]
[7]
[2]
[5]
[2]
jkik hd
[j]
{dk}{1}
{2}{0}
{-4}
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(3,3,3)(2,4,3)
(1,2,6)(0,2,1)(2,2,5)
[0]
11 10
1
96
74
3
852
[1]
For each non basic arc,
d5 = 2+1-7 = -4
This loop allows me to save 4 for each unit of flow which agrees with d5 = -4
[4]
[7]
[2]
[5]
[2]
jkik hd
[j]
{dk}{1}
{2}{0}
{-4}
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(1,3,3)(4,4,3)
(1,2,6)(2,2,1)(0,2,5)
[0]
11 10
1
96
74
3
852
[1]
For each non basic arc,
d5 = 2+1-7 = -4
Move the maximum aroundthis loop. Since capacity of d2 is 2, we move 2.
[4]
[7]
[2]
[5]
[2]
jkik hd
[j]
{dk}{1}
{2}{0}
{-4}
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(1,3,3)(4,4,3)
(1,2,6)(2,2,1)(0,2,5)
11 10
1
96
74
3
852
[j]
{dk}
Find
jki h
[0]
3 = 0 + 1 = 1
[1]
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(1,3,3)(4,4,3)
(1,2,6)(2,2,1)(0,2,5)
11 10
1
96
74
3
852
[j]
{dk}
Find
jki h
[0]
3 = 0 + 1 = 1
[1]
6 = 1 + 5 = 6
5 = 1 + 6 = 7
4 = 1 + 3 = 42 = 7 – 1 = 66 = 6 + 3 = 91 = 9 - 3 = 6
[7]
[4]
[6]
[9]
[6]
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(1,3,3)(4,4,3)
(1,2,6)(2,2,1)(0,2,5)
11 10
1
96
74
3
852
[j]
{dk}
Find
[0]
[1]
[7]
[4]
[6]
[9]
[6]jkik hd
d1 = 6+4-4 = 6d4 = 6+2-4 = 4d2 = 6+5-7 = 4d9 = 1+5-9 = -3
{-3}
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(1,3,3)(4,4,3)
(1,2,6)(2,2,1)(0,2,5)
11 10
1
96
74
3
852
[j]
{dk}
Find
[0]
[1]
[7]
[4]
[6]
[9]
[6]jkik hd
Note I can move no unitsof flow since d9 is at capacity
{-3}
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(1,3,3)(4,4,3)
(1,2,6)(2,2,1)(0,2,5)
11 10
1
96
74
3
852
[j]
{dk}
Find
[0]
jkik hd
Note I can move no unitsof flow since d9 is at Capacity
Arc d9 enters basis, arc d2 leaves basis
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(1,3,3)(4,4,3)
(1,2,6)(2,2,1)(0,2,5)
11 10
1
96
74
3
852
[j]
{dk}
[0]
Find
jki h 3 = 0 + 1 = 15 = 1 + 6 = 76 = 1 + 5 = 62 = 6 - 3 = 34 = 1 + 3 = 41 = 6 - 3 = 3
[1]
[7]
[6]
[3]
[4][3]
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(1,3,3)(4,4,3)
(1,2,6)(2,2,1)(0,2,5)
11 10
1
96
74
3
852
[j]
{dk}
[0]
Find
[1]
[7]
[6]
[3]
[4][3]
Find
jkik hd
d1 = 3+4-4 = 3d4 = 3+2-4 = 1d5 = 3+1-7 = -3d10 = 4+-3-1 = 1
Recall
• For each basic arc
• For each non-basic arc
jki h
jkik hd
ikjk hd
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(1,3,3)(4,4,3)
(1,2,6)(2,2,1)(0,2,5)
11 10
1
96
74
3
852
[j]
{dk}
[0]
Find
[1]
[7]
[6]
[3]
[4][3]
Find
jkik hd
d1 = 3+4-4 = 3d4 = 3+2-4 = 1d5 = 7-1-3 = 3d10 = 4+-3-1 = 1
Initial Feasible (Max Flow)
1
2
3
4
5
6
7(flow, capacity, cost)
(1,2,1) (0,2,-3)
(0,1,4)(0,2,2)(2,4,3)
(1,1,5)(1,3,3)(4,4,3)
(1,2,6)(2,2,1)(0,2,5)
11 10
1
96
74
3
852
[j]
{dk}
[0]
Find
[1]
[7]
[6]
[3]
[4][3]
Find
jkik hd
d1 = 3+4-4 = 3d4 = 3+2-4 = 1d5 = 7-1-3 = 3d10 = 4+-3-1 = 1
All dk positive, optimal solution