Civil Engineering Systems Analysis Lecture XIV Instructor: Prof. Naveen Eluru Department of Civil Engineering and Applied Mechanics
Today s Learning Objectives Dual 2
Linear Programming Dual Problem 3
Dual Example Primal Minimize 8x1 + 5x2 + 4x3 4x1 + 2x2 + 8x3 = 12 7x1 + 5x2 + 6x3 9 8x1 + 5x2 + 4x3 10 3x1 + 7x2 + 9x3 7 x1 0, x2 unrestricted, x3 0 Dual Max 12y1 +9y2 + 10y3 +7y4 4y1 + 7y2 + 8y3 + 3y4 8 2y1 + 5y2 + 5y3 + 7y4 = 5 8y1 + 6y2 + 4y3 + 9y4 4 y1 unrestricted, y2, y4 0 and y3 0 4
Points to Remember = constraint gives an unrestricted variable and vice versa Desirable constraints yield desirable variables and vice-versa In a minimization is desirable hence the variable corresponding to that will be 0 (look at constraints 2 and 4 in primal) In a minimization is undesirable and hence it gives us 0 variable (look at constraint 3 in primal) In any problem non-negativity is desirable, non-negative variable yield desirable constraint signs (see x1 in primal) Negative variables yield non-desirable constraint signs (see x3 in primal) 5
Primal Dual relationships Weak duality theorem If x is a feasible solution for the primal problem and y is a feasible solution to the dual problem, then cx yb Lets look at an example Primal: Max Z = 6x1+5x2 x1+x2 5 3x1+2x2 12 x1, x2 0 Dual Min W = 5y1+12y2 y1+ 3y2 6 y1 + 2y2 5 y1, y2 0 (0,0) Z = 0 (3,1) Z = 23 (3,3) Z = 51 (1,2) Z = 29 6
Primal Dual relationships Weak duality mathematically Lets say we have a feasible soln to primal and dual Then we write W = 5y1+12y2 W (x1+x2)y1+ (3x1+2x2)y2 W x1(y1+3y2)+ x2(y1+2y2) W 6x1+ 5x2 = Z W Z If we generalize this to matrices, we proved the weak duality 7
Primal Dual relationships Strong duality theorem If x* is an optimal solution for the primal problem and y* is an optimal solution for the dual problem then cx* = y*b If cx* = y*b then x* and y* are solutions to primal and dual respectively Primal: Max Z = 6x1+5x2 x1+x2 5 3x1+2x2 12 x1, x2 0 Try (2, 3) Dual: Min W = 5y1+12y2 y1+ 3y2 6 y1 + 2y2 5 y1, y2 0 Try (3,1) 8
Primal Dual Relationship Why do we care about weak duality and strong duality? We care because when we want to develop computer models to solve for large problems, we might use heuristics. Heuristics tap into such logical rules and try to solve the problem quickly For example in a large problem we have access to primal and dual Now if I can quickly find solutions to primal and dual with same objective function value.. I know I hit my optimum.. I can write my code with this as my criterion.. a search based algorithm that does not worry about simplex and so on! 9
Primal Dual relationships If one problem has a feasible solution and bounded objective function then so does the other problem If one problem is feasible with an unbounded objective function then the other problem has no feasible solution If one problem has no feasible solution, then other problem either has no feasible solution or is unbounded Again, these relationships can be exploited in solving large problems Lets say I figure out that the Dual has unbounded solution (1-2 iterations).. I don t have to solve primal, I know it is infeasible Once I find out for example, dual is infeasible then I can check directly for unboundedness or infeasibility in primal 10
Primal Dual relationships Complementary slackness conditions If x* and y* are optimal solutions to primal and dual respectively, we have xv + yu=0 U and V vector of slack variables for primal and dual We can write this as x i V i + y j U j =0 Because all of these 0 We can write x i V i = 0 and y j U j =0 And in fact, x i V i = 0; y j U j =0 What does this mean? If a particular primal variable is basic then it corresponding dual slack will be 0 11
Complementary slackness Primal Maximize Z = 3x1+5x2 x1 4 2x2 12 3x1 + 2x2 18 x1,x2 0 Maximize Z = 3x1+5x2 x1 + u1 = 4 2x2 +u2 = 12 3x1 + 2x2 + u3 = 18 x1, x2, u1, u2, u3 0 Solution (2, 6, 2, 0, 0) Dual Minimize W = 4y1+12y2+18y3 y1+ 3y3 3 2y2+2y3 5 y1, y2, y3 0 Minimize W = 4y1+12y2+18y3 y1+ 3y3 v1 = 3 2y2+2y3 v2 =5 y1, y2, y3, v1, v2 0 Solution From complementary slackness x1 is basic v1 =0; x2 is basic v2 =0 u1 is basic so y1 =0; u2 =0, y2 non-zero; u3 =0, y3 non-zero Solving we get Y2 = 3/2, Y3 =1! Z = 36 12
Complementary Slackness Primal: Max Z = 6x1+5x2 x1+x2 + u1 = 5 3x1+2x2 + u2 =12 x1, x2, u1, u2 0 Optimal Soln (2,3,0,0) and Z = 27 Does this satisfy complementary slackness Yes.. x1*v1=0, x2*v2=0 y1*u1=0, y2*u2=0 Dual Min 5y1 + 12y2 y1 + 3y2 v1 = 6 y1 + 2y2 v2 = 5 y1, y2, v1, v2 0 Optimal soln (3,1,0,0) and Z = 27 13
Dual Mathematical interpretation Maximize 22 X A +28X B 8X A +10X B 3400 2X A +3X B 960 X A,X B 0 Optimal solution is (150, 220, 0, 0) Dual Min 3400y1+960y2 8y1+2y2 22 10y1+3y2 28 y1,y2 0 Dual solution from complementary slackness u1 = 0; y1 non-zero u2 = 0; y2 non-zero x1 basic, v1 = 0 x2 basic, v2=0 Soln (5/2, 1, 0, 0) The dual represents the marginal value for the resource 14
Dual Marginal value interpretation Maximize 22 X A +28X B 8X A +10X B 3400 2X A +3X B 960 X A,X B 0 Lets say 3400 is increased by δ What will happen to the optimal solution Lets assume X A and X B are still in the basis In that case Solve for X A and X B ; X B = 220- δ/2; X A = 150 + 3δ/4 Znew = 9460+5/2δ We can do the same for 960 Simplex provides the entire range of values 15
Dual from Simplex table Solution to the problem in Simplex Basic Z X A X B Y1 Y2 Solution Z 1 0 0 5/2 1 9460 X A 0 1 0 3/4-5/2 150 X B 0 0 1-1/2 2 220 By observing the z row we can determine the dual solution at optimality Z 1 0 0 5/2 1 9460 v1 v2 y1 y2 16
Full set of iterations Min 3400y1+960y2 8y1+2y2 22; 10y1+3y2 28; y1,y2 0 Basic Z X A X B Y1 Y2 Solution Z 1-22 -28 0 0 0 Y1 0 8 10 1 0 3400 Y2 0 2 3 0 1 960 Basic Z X A X B Y1 Y2 Solution Z 1-10/3 0 0 28/3 8960 Y1 0 4/3 0 1-10/3 200 X B 0 2/3 1 0 1/3 320 Basic Z X A X B Y1 Y2 Solution Z 1 0 0 5/2 1 9460 X A 0 1 0 3/4-5/2 150 X B 0 0 1-1/2 2 220 17
Points to note Whenever the problem is feasible for the primal, but not yet optimal, the dual is infeasible But at optimality dual becomes feasible (as well as optimal) We will exploit this relationship in sensitivity analysis 18
Sensitivity Analysis Dual provides the shadow prices We know that we have this information in the simplex itself Dual allows us to do sensitivity analysis more efficiently If I change something in the primal, the change will also transfer to the dual also. Based on which problem will give me the result efficiently I can use that to address the sensitivity 19
Changes to a non-basic variable You have solved the primal to optimality and found your basic variables This means these are the set of variables that affect your bottom line Now, you realize the coefficients of the nonbasic variable are not reliable. So how do we test that? What is the impact of changes to the basic feasible solution? Is the solution still feasible? Yes Is the solution still optimal? We need to check 20
Example Max x1+4x2+2x3 x1+ x2+ x3 6 x1+ 3x2+ 2x3 12 x1+ 2x2 6 x1, x2, x3 0 Optimal solution is (0, 3, 1.5) 21
Example simplex solution x1 x2 x3 s1 s2 s3 RHS Z -1-4 -2 0 0 0 0 S1 1 1 1 1 0 0 6 S2 1 3 2 0 1 0 12 S3 1 2 0 0 0 1 6 x1 x2 x3 s1 s2 s3 RHS Z 1 0-2 0 0 2 12 S1 1/2 0 1 1 0-1/2 3 S2-1/2 0 2 0 1-3/2 3 x2 1/2 1 0 0 0 1/2 3 x1 x2 x3 s1 s2 s3 RHS Z 1/2 0 0 0 1 1/2 15 S1 ¾ 0 0 1-1/2 1/4 3/2 x3 - ¼ 0 1 0 1/2-3/4 3/2 x2 1/2 1 0 0 0 1/2 3 22
Example Now lets say the coefficient of x1 in obj. function is 2 Is the solution still feasible? Yes What about optimality? Is it easy to figure that out? This is where the dual comes in handy We know that since the solution is optimal, the corresponding dual solution is feasible Lets quickly compute the dual 23
Example Dual Min 6y1+12y2+6y3 y1+y2+1y3 1 y1+3y2+2y3 4 y1+2y2 2 y1, y2, y3 0 Can we determine the value of y1, y2, y3from simplex table (0,1, 0.5, 0.5, 0, 0) 24
Example Now when we changed the coefficient in obj. function for primal what will change in the dual The change will be only in the constraint 1 Now we know that the optimal solution to primal should remain feasible for the dual So, lets see if the solution is still feasible with new constraint (y1+y2+1y3 2) Soln 0, 1, 0.5 => not feasible Hence when we change the coefficient of x1 in objective function optimal basic solution will change! We checked it with just one constraint A good tool to make quick checks 25
Primal Dual relationships Consider the case of adding a new variable to the problem For example, a company produces three products currently and are considering producing a new product What will this mean? 26
Example Max x1+4x2+2x3 x1+ x2+ x3 6 x1+ 3x2+ 2x3 12 x1+ 2x2 6 x1, x2, x3 0 Optimal solution is (0, 3, 1.5) Now the company is interested to check if x new will provide more profit New Problem Max x1+4x2+2x3+3x new x1+ x2+ x3 +x new 6 x1+ 3x2+ 2x3+2x new 12 x1+ 2x2 +3x new 6 x1, x2, x3, x new 0 27
Example Is the solution still feasible? Yes What about optimality? Check dual feasibility We know that since the solution is optimal, the corresponding dual solution is feasible 28
Example New Dual Min 6y1+12y2+6y3 y1+y2+1y3 1 y1+3y2+2y3 4 y1+2y2 2 y1+2y2+3y3 3 (NEW) y1, y2, y3 0 Current optimal solution (0,1, 0.5) Do I have to worry about the entire dual? Only one constraint corresponding to x new is enough! Now check feasibility for new constraint -> still feasible - > so the new product does not change the optimal solution for the company, so you do not start producing x new! 29
Sensitivity Analysis Why do we need sensitivity analysis The parameters we use are not exact.. They are estimated.. So we need to understand which are the most important parameters, so that we can try to evaluate them carefully i.e. IDENTIFY SENSITIVE PARAMETERS Also, we would like to know the range of the parameters within which the solution we obtained will remain optimal i.e. RANGE OF THE PARAMETERS Two kinds: (1) range of parameters that ensures the solution is optimal and (2) range of parameters that ensures the solution has to change It will be extremely time consuming if we had to run everything again So, we use insights from our earlier attempts at solving the simplex to conduct sensitivity analysis 30
References Hillier F.S and G. J. Lieberman. Introduction to Operations Research, Ninth Edition, McGraw- Hill, 2010 31