Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 665 - LP Duality 1 ECE 665 Spring 2005 ECE 665 Spring 2005 Computer Algorithms with Applications to VLSI CAD Linear Programming Duality.

Similar presentations


Presentation on theme: "ECE 665 - LP Duality 1 ECE 665 Spring 2005 ECE 665 Spring 2005 Computer Algorithms with Applications to VLSI CAD Linear Programming Duality."— Presentation transcript:

1 ECE 665 - LP Duality 1 ECE 665 Spring 2005 ECE 665 Spring 2005 Computer Algorithms with Applications to VLSI CAD Linear Programming Duality

2 ECE 665 - LP Duality 2 Linear Program Dual – Example1 Primal LP (original)Primal LP (original) max 100x 1 + 80x 2 s.to: 10x 1 + 5x 2  50 5x 1 + 5x 2  35 5x 1 + 15x 2  80 Primal solution: x 1 =3, x 2 =4, F p = 620 max c T x s.to: A x  b x  0 Dual LP (original)Dual LP (original) min 50w 1 + 35w 2 + 80w 3 s.to: 10w 1 + 5w 2 + 5w 3  100 5w 1 + 5w 2 + 15w 3  80 Dual solution: w 1 =4, w 2 =12, w 3 =0 F d = 620 max w T b s.to: w T A  c T w  0 w1w1 w2w2 w3w3

3 ECE 665 - LP Duality 3 Example 2: Longest Path Problem Formulate it as a Linear Program (LP) – –Assign variables x i to each edge e i x i = 1 if edge e i is in the longest path x i = 0 otherwise – –Write the objective function – –Write the constraint set 1 2 3 4 5 6 4 5 2 2 2 5 3 3 6 x1 x2 x3 x4 x5 x6 x9 x8 x7

4 ECE 665 - LP Duality 4 Example 2: Longest Path Problem (2) Primal Problem x1 x2 x3 x4 x5 x6 x9 x8 x7 1 2 3 4 5 6 4 5 2 2 2 5 3 3 6 max 4x1 + 5x2 + 2x3 + 2x4 + 2x5 + 3x6 + 5x7 + 3x8 + 6x9 st - x1 - x2 - x3 = -1 x1 - x4 - x7 = 0 x2 + x4 - x5 = 0 x3 - x6 - x9 = 0 x5 + x6 - x8 = 0 x7 + x8 + x9 = 1 end

5 ECE 665 - LP Duality 5 Example 2: Longest Path Problem (3) Primal Problem - solution x1 x2 x3 x4 x5 x6 x9 x8 x7 1 2 3 4 5 6 4 5 2 2 2 5 3 3 6 max 4x1 + 5x2 + 2x3 + 2x4 + 2x5 + 3x6 + 5x7 + 3x8 + 6x9 st - x1 - x2 - x3 = -1 x1 - x4 - x7 = 0 x2 + x4 - x5 = 0 x3 - x6 - x9 = 0 x5 + x6 - x8 = 0 x7 + x8 + x9 = 1 end LP OPTIMUM FOUND AT STEP 2 OBJECTIVE FUNCTION VALUE 1) 11.000000 VARIABLE VALUE REDUCED COST X1 1.000000 0.000000 X2 0.000000 1.000000 X3 0.000000 0.000000 X4 1.000000 0.000000 X5 1.000000 0.000000 X6 0.000000 3.000000 X7 0.000000 2.000000 X8 1.000000 0.000000 X9 0.000000 3.000000

6 ECE 665 - LP Duality 6 Example 2: Longest Path Problem (4) Dual Problem formulation + solution min -w1 + w6 st -w1 + w2 > 4 -w1 + w3 > 5 -w1 + w4 > 2 -w2 + w3 > 2 -w3 + w5 > 2 -w4 + w5 > 3 -w2 + w6 > 5 -w5 + w6 > 3 -w4 + w6 > 6 end LP OPTIMUM FOUND AT STEP 7 OBJECTIVE FUNCTION VALUE 1) 11.000000 VARIABLE VALUE REDUCED COST W1 0.000000 0.000000 W6 11.000000 0.000000 W2 4.000000 0.000000 W3 6.000000 0.000000 W4 5.000000 0.000000 W5 8.000000 0.000000 Interpretation of dual variables: w i = distance of node I from source w6=11 1 2 3 4 5 6 4 5 2 2 2 5 3 3 6 w2=4 w1=0 w4=5 w3=6 w5=8 Note: This is still a longest path problem (Critical Path or Scheduling problem): Find a minimum distance from sink to source that satisfies all edge-length constraints.

7 ECE 665 - LP Duality 7 Example3: Max-Flow Min-Cut Primal Problem max x0 st -x1-x2+x0 = 0 x1-x3-x4 = 0 x2-x5-x6 = 0 x3+x5-x7 = 0 x4+x6-x8 = 0 x7+x8-x0 = 0 x1 <= 12 x2 <= 9 x3 <= 10 x4 <= 3 x5 <= 4 x6 <= 10 x7 <= 7 x8 <= 13 end 9 4 3 12 10 13 7 1 2 3 4 6 5 x1 x2 x3 x4 x6 x8 x7 x0 x5 x0 Edge capacities Flow variables Max flow

8 ECE 665 - LP Duality 8 Example3: Max-Flow Min-Cut (2) Primal Problem - Solution 9 4 3 12 10 13 7 1 2 3 4 6 5 X1=10 X2=9 X3=7 X4=3 X6=9 X8=12 X7=7 X0=19 X5=0 X0=19 LP OPTIMUM FOUND AT STEP 3 OBJECTIVE FUNCTION VALUE 1) 19.000000 VARIABLE VALUE REDUCED COST X0 19.000000 0.000000 X1 10.000000 0.000000 X2 9.000000 0.000000 X3 7.000000 0.000000 X4 3.000000 0.000000 X5 0.000000 1.000000 X6 9.000000 0.000000 X7 7.000000 0.000000 X8 12.000000 0.000000 Saturated edges: x2=9 x4=3 x7=7 Max flow = 19 = min cut of forward saturated eges min cut

9 ECE 665 - LP Duality 9 Example3: Max-Flow Min-Cut (3) Dual Problem - formulation 9 4 3 12 10 13 7 1 2 3 4 6 5 x1 x2 x3 x4 x6 x8 x7 x0 x5 x0 Edge constraints: dual variables w w1 w8 Node constraints: dual variables z z1 z6 Dual objective vector: [z1,…, z6, w1,…,w8] Dual objective cost: [ 0, …, 0, c1, …, c8] Edge capacities ( 12,9,10,3,4,10,7,13 ) Convert primal problem : Dual obj function: F dual = 0 z1+…+0 z2 + 12 w12 +… + 13 w8 max x0 st -x1-x2+x0 = 0 x1-x3-x4 = 0 x2-x5-x6 = 0 x3+x5-x7 = 0 x4+x6-x8 = 0 x7+x8-x0 = 0 x1 <= 12 x2 <= 9 x3 <= 10 x4 <= 3 x5 <= 4 x6 <= 10 x7 <= 7 x8 <= 13 end

10 ECE 665 - LP Duality 10 Example3: Max-Flow Min-Cut (4) Dual Problem min 12w1 +9w2 +10w3 +3w4 +4w5 +10w6 +7w7 +13w8 st z1-z6 >= 1 -z1+z2+w1 >= 0 -z1+z3+w2 >= 0 -z2+z4+w3 >= 0 -z2+z5+w4 >= 0 -z3+z4+w5 >= 0 -z3+z5+w6 >= 0 -z4+z6+w7 >= 0 -z5+z6+w8 >= 0 end z = node variables w = edge variables 1 2 3 4 6 5 z3 w6 z2 w1 w2 w3 w4 w5 w7 w8 z4 z6 z5 z1

11 ECE 665 - LP Duality 11 Example3: Max-Flow Min-Cut (5) Dual Problem - solution 1 2 3 4 6 5 z3=0 w6=0 z2=1 w1=0 w2=1 w3=0 w4=1w5=0 w7=1 w8=0 z4=1 z6=0 z5=0 z1=1 LP OPTIMUM FOUND AT STEP 9 OBJECTIVE FUNCTION VALUE 1) 19.000000 VARIABLE VALUE REDUCED COST W1 0.000000 2.000000 W2 1.000000 0.000000 W3 0.000000 3.000000 W4 1.000000 0.000000 W5 0.000000 4.000000 W6 0.000000 1.000000 W7 1.000000 0.000000 W8 0.000000 1.000000 Z1 1.000000 0.000000 Z6 0.000000 0.000000 Z2 1.000000 0.000000 Z3 0.000000 0.000000 Z4 1.000000 0.000000 Z5 0.000000 0.000000 S T min cut Interpretation of dual variables z i = 1 if node i is in set S 0 if it is in set T w i = 1 if edge i is in the min-cut 0 otherwise


Download ppt "ECE 665 - LP Duality 1 ECE 665 Spring 2005 ECE 665 Spring 2005 Computer Algorithms with Applications to VLSI CAD Linear Programming Duality."

Similar presentations


Ads by Google