410 likes | 551 Views
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.
E N D
ENGM 792Network 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.
Minimum Cost Flow Solutions • Initial feasible solution • Maximal flow • Use of artificial arcs
Initial Feasible (Max Flow) (2,1) (2,-3) 7 (1,4) 1 4 [-2] [4] 1 (2,2) (2,5) 2 3 (4,3) (4,3) 4 (2,1) 2 5 [3] [-3] 5 6 (3,3) (2,6) 7 8 [3] (1,5) 3 6 [-6] 9
Initial Feasible (Max Flow) [0] 7 [bfi] (flow, capacity) [3] [1] Start at top and assign Max flow to each arc Assign 1 unit flow arc 1 Need to satisfy 3 more Units of supply Need one more unit at Node 4 (1,1) 1 4 [-2] [4] 1 2 5 [3] [-3] [3] 3 6 [-6]
Initial Feasible (Max Flow) [0] 7 [bfi] (flow, capacity) [1] [-1] Start at top and assign Max flow to each arc Assign 1 unit to arc 1, 2 units to arc 2 Need to satisfy 1 more Unit of supply (1,1) 1 4 [3] 1 (2,2) 2 [-1] 2 5 [3] [-3] [3] 3 6 [-6]
Initial Feasible (Max Flow) [0] 7 [bfi] (flow, capacity) [0] [-1] Start at top and assign Max flow to each arc Assign 1 unit to arc 1, 2 units to arc 2 1 unit to arc 3 Arc 3 could take 3 more Units of flow, but supply Is exhausted (1,1) 1 4 [1] 1 (2,2) 2 3 (1,4) 2 5 [-1] [3] [-5] [3] 3 6 [-6]
Initial Feasible (Max Flow) [0] 7 [bfi] (fk,ck) [0] [0] (1,1) 1 4 [-2] [4] (2,2) (1,2) (1,4) [0] [0] (1,2) 2 5 [3] [-3] (1,3) [-4] [3] [3] 3 6 [-6]
Initial Feasible (Max Flow) [0] 7 [bfi] (fk,ck) [0] [0] (1,1) 1 4 [-2] Arc 3 to 6 now at capacity, But we still need to meet 2 units of supply at node 3 Max flow says look at arc 3 to 4 and arc 3 to 5 [4] (2,2) (1,2) (1,4) [0] [0] (1,2) 2 5 [3] [-3] (1,3) [-3] [2] [3] (1,1) 3 6 [-6]
Initial Feasible (Max Flow) [0] 7 [bfi] (fk,ck) [0] [0] Arc 3 to 6 now at capacity, But we still need to meet 2 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 meet Supply at node 3. We remove Arc 1 to 4 since it forces us to Exceed demand at 4 1 4 [-2] [4] (2,2) (2,4) [0] [0] (1,2) 2 5 [3] [-3] (2,4) (2,3) [-1] [0] [3] (1,1) 3 6 [-6]
Initial Feasible (Max Flow) [-1] (1,2) (0,2) 7 [bfi] (flow, capacity) Final max flow Solution Initial feasible solution Is it basic ? 1 4 [0] [0] (1,2) (2,4) (3,4) (1,2) 2 5 [0] [0] (1,2) (2,3) [0] (1,1) 3 6 [0]
Initial Feasible (Max Flow) (2,1) (2,-3) 7 (1,4) 1 4 [-2] [4] 1 (2,2) (2,5) 2 3 (4,3) (4,3) 4 (2,1) 2 5 [3] [-3] 5 6 (3,3) (2,6) 7 8 [3] (1,5) 3 6 [-6] 9
Initial Feasible (Max Flow) [-1] (1,2) (0,2) 7 [bfi] (flow, capacity) Final max flow Solution 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 1 4 [0] [0] (1,2) (2,4) (3,4) (1,2) 2 5 [0] [0] (1,2) (2,3) [0] (1,1) 3 6 [0]
Initial Feasible (Artificial Arc) (6,6,R) (3,3,R) 7 (3,3,R) (3,3,R) (Flow, capacity, cost) (2,2,R) (4,4,R) We must add the possibility Of a slack flow since demand Exceeds supply 1 4 [4] [-2] 2 5 [3] [-3] 3 6 [-6] [3]
Initial Feasible (Artificial Arc) (0,2,1) (6,6,R) (3,3,R) 7 (3,3,R) (3,3,R) Flow, capacity, cost) (2,2,R) (4,4,R) (0,2,-3) Note that we have 7 Nodes; n+m-1 = 6 We have 6 arcs with flow Initial basic feasible soln. We now add in remaining Arcs with zero flow. 1 4 [4] [-2] 2 5 [3] [-3] 3 6 [-6] [3]
Initial Feasible (Artificial Arc) (0,2,1) (6,6,R) (3,3,R) 7 (3,3,R) (3,3,R) Flow, capacity, cost) (2,2,R) (4,4,R) (0,2,-3) (0,4) 1 4 1 (0,2) (0,5) [4] [-2] 2 3 (0,3) (0,3) 4 (0,1) 2 5 5 6 [3] [-3] (0,3) (0,6) 7 8 (0,5) 3 6 9 [-6] [3]
Moving to a Solution • For each basic arc • For each non-basic arc
Moving to a Solution • For each basic arc • For each non-basic arc
Initial Feasible (Max Flow) (flow, capacity, cost) (1,2,1) (0,2,-3) 7 (0,1,4) (0,2,2) 1 4 (2,4,3) (2,2,5) 2 5 (0,2,1) (1,2,6) (2,4,3) 3 (3,3,3) 6 (1,1,5)
Initial Feasible (Max Flow) [j] [0] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 11 10 Six basic arcs For each basic arc, We start with 7 = 0 (0,1,4) (0,2,2) 1 4 1 (2,4,3) 4 7 (2,2,5) 2 2 5 (0,2,1) 5 (1,2,6) 8 (2,4,3) 3 3 (3,3,3) 6 6 (1,1,5) 9
Initial Feasible (Max Flow) [j] [0] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 11 10 Six basic arcs For each basic arc, We start with 7 = 0 3= 0 + 1 = 1 (0,1,4) (0,2,2) 1 4 1 (2,4,3) 4 7 (2,2,5) 2 2 5 (0,2,1) 5 (1,2,6) 8 (2,4,3) [1] 3 3 (3,3,3) 6 6 (1,1,5) 9
Initial Feasible (Max Flow) [j] [0] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 11 10 Six basic arcs For each basic arc, We start with 7 = 0 3= 0 + 1 = 1 4= 1 + 3 = 4 (0,1,4) (0,2,2) 1 4 1 (2,4,3) [4] 4 7 (2,2,5) 2 2 5 (0,2,1) 5 (1,2,6) 8 (2,4,3) [1] 3 3 (3,3,3) 6 6 (1,1,5) 9
Initial Feasible (Max Flow) [j] [0] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 11 10 {1} Six basic arcs For each basic arc, We start with 7 = 0 3= 0 + 1 = 1 4= 1 + 3 = 4 (0,1,4) (0,2,2) 1 4 [2] 1 (2,4,3) [4] 4 7 (2,2,5) 2 2 5 (0,2,1) [2] [7] 5 (1,2,6) 8 (2,4,3) [1] 3 3 (3,3,3) 6 [5] 6 (1,1,5) 9
Initial Feasible (Max Flow) [j] [0] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 11 10 {1} {dk} For each non basic arc, We start with d10 = 4+-3-0 = 1 (0,1,4) (0,2,2) 1 4 [2] 1 (2,4,3) [4] 4 7 (2,2,5) 2 2 5 (0,2,1) [2] [7] 5 (1,2,6) 8 (2,4,3) [1] 3 3 (3,3,3) 6 [5] 6 (1,1,5) 9
Initial Feasible (Max Flow) [j] [0] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 11 10 {1} {dk} For each non basic arc, We start with d10 = 4+-3-0 = 1 d1= 2+4-4 = 2 {2} (0,1,4) (0,2,2) 1 4 [2] 1 (2,4,3) [4] 4 7 (2,2,5) 2 2 5 (0,2,1) [2] [7] 5 (1,2,6) 8 (2,4,3) [1] 3 3 (3,3,3) 6 [5] 6 (1,1,5) 9
Initial Feasible (Max Flow) [j] [0] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 11 10 {1} {dk} For each non basic arc, We start with d10 = 4+-3-0 = 1 d1= 2+4-4 = 2 d4= 2+2-4 = 0 {2} (0,1,4) (0,2,2) 1 4 {0} [2] 1 (2,4,3) [4] 4 7 (2,2,5) 2 2 5 (0,2,1) [2] [7] 5 (1,2,6) 8 (2,4,3) [1] 3 3 (3,3,3) 6 [5] 6 (1,1,5) 9
Initial Feasible (Max Flow) [j] [0] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 11 10 {1} {dk} 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 {2} (0,1,4) (0,2,2) 1 4 {0} [2] 1 (2,4,3) [4] 4 7 (2,2,5) 2 2 5 (0,2,1) {-4} [2] [7] 5 (1,2,6) 8 (2,4,3) [1] 3 3 (3,3,3) 6 [5] 6 (1,1,5) 9
Initial Feasible (Max Flow) [j] [0] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 11 10 {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 {dk} {2} (0,1,4) (0,2,2) 1 4 {0} [2] 1 (2,4,3) [4] 4 7 (2,2,5) 2 2 5 (0,2,1) {-4} [2] [7] 5 (1,2,6) 8 (2,4,3) [1] 3 3 (3,3,3) 6 [5] 6 (1,1,5) {-1} 9
Initial Feasible (Max Flow) [j] [0] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 11 10 {1} {dk} 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 {2} (0,1,4) (0,2,2) 1 4 {0} [2] 1 (2,4,3) [4] 4 7 (2,2,5) 2 2 5 (0,2,1) {-4} [2] [7] 5 (1,2,6) 8 (2,4,3) [1] 3 3 (3,3,3) 6 [5] 6 (1,1,5) 9
Initial Feasible (Max Flow) [j] [0] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 11 10 {1} {dk} 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 {2} (0,1,4) (0,2,2) 1 4 {0} [2] 1 (2,4,3) [4] 4 7 (2,2,5) 2 2 5 (0,2,1) {-4} [2] [7] 5 (1,2,6) 8 (2,4,3) [1] 3 3 (3,3,3) 6 [5] 6 (1,1,5) 9
Initial Feasible (Max Flow) [j] [0] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 11 10 {1} {dk} For each non basic arc, d5= 2+1-7 = -4 Move the maximum around this loop. Since capacity of d2 is 2, we move 2. {2} (0,1,4) (0,2,2) 1 4 {0} [2] 1 (2,4,3) [4] 4 7 (0,2,5) 2 2 5 (2,2,1) {-4} [2] [7] 5 (1,2,6) 8 (4,4,3) [1] 3 3 (1,3,3) 6 [5] 6 (1,1,5) 9
Initial Feasible (Max Flow) [0] [j] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 {dk} 11 10 (0,1,4) Find (0,2,2) 1 4 1 (2,4,3) 4 7 3 = 0 + 1 = 1 (0,2,5) 2 2 5 (2,2,1) 5 (1,2,6) 8 (4,4,3) [1] 3 3 (1,3,3) 6 6 (1,1,5) 9
Initial Feasible (Max Flow) [0] [j] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 {dk} 11 10 (0,1,4) Find (0,2,2) 1 4 [6] 1 (2,4,3) [4] 4 7 3 = 0 + 1 = 1 (0,2,5) 6 = 1 + 5 = 6 2 2 5 (2,2,1) [6] [7] 5 5 = 1 + 6 = 7 (1,2,6) 8 4 = 1 + 3 = 4 2= 7 – 1 = 6 6= 6 + 3 = 9 1= 9 - 3 = 6 (4,4,3) [1] 3 3 (1,3,3) 6 [9] 6 (1,1,5) 9
Initial Feasible (Max Flow) [0] [j] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 {dk} 11 10 (0,1,4) Find (0,2,2) 1 4 [6] 1 (2,4,3) [4] 4 7 d1= 6+4-4 = 6 d4= 6+2-4 = 4 d2= 6+5-7 = 4 d9= 1+5-9 = -3 (0,2,5) 2 2 5 (2,2,1) [6] [7] 5 (1,2,6) 8 (4,4,3) [1] 3 3 (1,3,3) 6 [9] 6 (1,1,5) {-3} 9
Initial Feasible (Max Flow) [0] [j] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 {dk} 11 10 (0,1,4) Find (0,2,2) 1 4 [6] 1 (2,4,3) [4] 4 7 Note I can move no units of flow since d9 is at capacity (0,2,5) 2 2 5 (2,2,1) [6] [7] 5 (1,2,6) 8 (4,4,3) [1] 3 3 (1,3,3) 6 [9] 6 (1,1,5) {-3} 9
Initial Feasible (Max Flow) [0] [j] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 {dk} 11 10 (0,1,4) Find (0,2,2) 1 4 1 (2,4,3) 4 7 Note I can move no units of flow since d9 is at Capacity Arc d9 enters basis, arc d2 leaves basis (0,2,5) 2 2 5 (2,2,1) 5 (1,2,6) 8 (4,4,3) 3 3 (1,3,3) 6 6 (1,1,5) 9
Initial Feasible (Max Flow) [0] [j] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 {dk} 11 10 (0,1,4) Find (0,2,2) 1 4 1 [3] (2,4,3) [4] 4 7 3 = 0 + 1 = 1 5= 1 + 6 = 7 6= 1 + 5 = 6 2= 6 - 3 = 3 4= 1 + 3 = 4 1 = 6 - 3 = 3 (0,2,5) 2 2 5 (2,2,1) [3] [7] 5 (1,2,6) 8 (4,4,3) [1] 3 3 (1,3,3) 6 [6] 6 (1,1,5) 9
Initial Feasible (Max Flow) [0] [j] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 {dk} 11 10 (0,1,4) Find Find (0,2,2) 1 4 1 [3] (2,4,3) [4] 4 7 d1= 3+4-4 = 3 d4= 3+2-4 = 1 d5= 3+1-7 = -3 d10 = 4+-3-1 = 1 (0,2,5) 2 2 5 (2,2,1) [3] [7] 5 (1,2,6) 8 (4,4,3) [1] 3 3 (1,3,3) 6 [6] 6 (1,1,5) 9
Recall • For each basic arc • For each non-basic arc
Initial Feasible (Max Flow) [0] [j] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 {dk} 11 10 (0,1,4) Find Find (0,2,2) 1 4 1 [3] (2,4,3) [4] 4 7 d1= 3+4-4 = 3 d4= 3+2-4 = 1 d5= 7-1-3 = 3 d10 = 4+-3-1 = 1 (0,2,5) 2 2 5 (2,2,1) [3] [7] 5 (1,2,6) 8 (4,4,3) [1] 3 3 (1,3,3) 6 [6] 6 (1,1,5) 9
Initial Feasible (Max Flow) [0] [j] (flow, capacity, cost) (1,2,1) (0,2,-3) 7 {dk} 11 10 (0,1,4) Find Find (0,2,2) 1 4 1 [3] (2,4,3) [4] 4 7 d1= 3+4-4 = 3 d4= 3+2-4 = 1 d5= 7-1-3 = 3 d10 = 4+-3-1 = 1 All dk positive, optimal solution (0,2,5) 2 2 5 (2,2,1) [3] [7] 5 (1,2,6) 8 (4,4,3) [1] 3 3 (1,3,3) 6 [6] 6 (1,1,5) 9