Duality Theory LI Xiaolei Finding the dual of an LP When taking the dual of a given LP, we refer to the given LP as the primal. If the primal is a max problem, the dual will be a min problem, and vice versa. For convenience, we define the variables for the max problem to be z, x1,x2,…,xn and the variables for the min problem to be w,y1,y2,…,ym. Finding the dual of an LP A normal max problem may be written as max z c1 x1 c2 x2 cn xn s.t. a11 x1 a12 x2 a1n xn b1 a21 x1 a22 x2 a2 n xn b2 am1 x1 am 2 x2 amn xn bm x j 0(i 1,2, ,n) (16) Finding the dual of an LP The dual of a normal max problem is defined to be, min w b1 y1 b2 y2 bm ym s.t. a11 y1 a21 y2 am1 ym c1 a12 y1 a22 y2 am 2 ym c2 a1n y1 a2 n y2 amn ym cn yi 0(i 1,2 , ,m ) (17) Finding the dual of an LP A min problem like (17) that has all ≥constraints and all variables nonnegative is called a normal min problem. If the primal is a normal min problem like (17), we define the dual of (17) to be (16). A tabular approach makes it easy to find the dual of an LP. A normal min problem is found by reading down; the dual is found by reading across in the table. Finding the dual of an LP min w y1 0 y2 0 ym 0 y1 y2 ym max z x1 0 x2 0 x2 x1 a12 a11 a22 a21 am 2 am1 c2 c1 xn 0 xn b1 a1n b2 a2 n bm amn cn Finding the dual of an LP Illustrate by the Dakota problem, max z 60 x1 30x2 20x3 s.t. 8 x1 6 x2 x3 48 4 x1 2 x2 1.5 x3 20 2 x1 1.5 x2 0.5 x3 8 x j 0(i 1,2 ,3 ) Finding the dual of an LP max z x1 0 x2 0 x3 0 x1 x2 x3 min w y1 0 y2 0 y3 0 y1 y2 y3 8 4 2 60 6 2 1.5 30 1 1.5 0.5 20 48 20 8 Finding the dual of an LP Then, reading down, we find the Dakota dual to be max w 48 y1 20 y2 8 y3 s.t. 8 y1 4 y2 2 y3 60 6 y1 2 y2 1.5 y3 30 y1 1.5 y2 0.5 y3 20 x j 0(i 1,2,3 ) Finding the dual of a nonnormal LP Many LPs are not normal max or min problem. For example, (18) max z s.t. 2 x1 x2 (19) min w 2 y1 4 y2 6 y3 x1 x2 2 2 x1 x2 3 x1 x2 1 x1 0, x2 urs s.t. y1 2 y2 y3 2 y3 1 y1 y 2 y3 1 2 y1 y2 3 y1 urs, y 2 , y3 0 Finding the dual of a nonnormal LP An LP can be transformed into normal form. To place a max problem into normal form, we proceed as follows: Step 1 multiply each ≥ constraint by -1, converting it into a ≤ constraint. Step 2 replace each equality constraint by two inequality constraints (a ≤ constraint and a ≥ constraint). Then convert the ≥ constraint to a ≤ constraint. Step 3 replace each urs variable xi by xi=xi’-xi’’, where xi’ ≥0 and xi’’ ≥0 . Finding the dual of a nonnormal LP (18) has been transformed onto the following LP: max z 2 x1 x2 x2 s.t. x1 x2 x 2 - x1 x2 x 2 - 2 x1 x2 x 3 x1 x2 x 1 x1 , x2 , x2 0 Finding the dual of a nonnormal LP Transform a nonnormal min problem into a normal min problem: Step 1 multiply each ≤ constraint by -1, converting it into a ≥ constraint. Step 2 replace each equality constraint by two inequality constraints (a ≤ constraint and a ≥ constraint). Then convert the ≥ constraint to a ≤ constraint. Step 3 replace each urs variable yi by yi=yi’-yi’’, where yi’ ≥0 and yi’’ ≥0 . Finding the dual of a nonnormal max problem Find the dual of a nonnormal max LP without going through the transformations, Step 1 fill in table so that the primal can be read across. Step 2 making the following changes, (a) if the ith primal constraint is a ≥ constraint, the corresponding dual variable yi must satisfy yi≤0. (b) if the ith primal constraint is an equality constraint, the dual variable yi is now unrestricted in sign. (c) if the ith primal variable is urs, the ith dual constraint will be an equality constraint. Then the dual can be read down in the usual fashing. Finding the dual of a nonnormal max problem For example, max z 2 x1 x2 s.t. x1 x2 2 max z 2 x1 x2 3 x1 x2 1 x1 0, x2 urs ( x1 0) ( x2 urs)* x1 x2 min w ( y 3 0) y1 y2 y3 1 2 1 2 1 1 1 1 2* 3* 1 Finding the dual of a nonnormal max problem max z ( x1 0) ( x2 urs) x1 x2 min w ( y1 urs) ( y 2 0) ( y3 0) y1 y2 y3 1 2 1 2 1 1 1 1 2 3 1 Finding the dual of a nonnormal min LP Step 1 write out the primal table. Step 2 making the following changes, (a) if the ith primal constraint is a ≤ constraint, the corresponding dual variable xi must satisfy xi ≤0. (b) if the ith primal constraint is an equality constraint, the dual variable xi is now unrestricted in sign. (c) if the ith primal variable is urs, the ith dual constraint will be an equality constraint. Then the dual can be read down in the usual fashing. Economic interpretation of the dual problem The dual of the Dakota problem is, min w 48y1 20 y2 8 y3 s.t. 8 y1 4 y2 2 y3 60 (desk const raint) 6 y1 2 y2 1.5 y3 30 ( t able const raint) y1 1.5 y2 0.5 y3 20 (chair const raint) y1 , y2 , y3 0 Economic interpretation of the dual problem Suppose an entrepreneur wants to purchase all of Dakota’s resources. Then the entrepreneur must determine the price he or she is willing to pay for a unit of each of Dakota’s resources, then y1=price paid for 1 board ft of lumber y2=price paid for 1 finishing hour y3=price paid for 1 carpentry hour Economic interpretation of the dual problem The total price that should be paid for these resources is w. the cost of purchasing the resources is to be minimized. In setting resource prices, what constraints does the entrepreneur face? For example, the entrepreneur must offer Dakota at least $60 for a combination of resources that includes 8 board feet of lumber, 4 finishing hours, and 2 carpentry hours, because Dakota could use these resources to produce a desk that can be sold for $60. the same reason shows the other two constraints. The dual theorem and its consequences The dual theorem states that the primal and dual have equal optimal objective function values. The dual theorem and its consequences Primal problem max z c1 x1 c2 x2 cn xn s.t. a11 x1 a12 x2 a1n xn b1 a21 x1 a22 x2 a2 n xn b2 am1 x1 am 2 x2 amn xn bm x j 0(i 1,2, ,n) (22) The dual theorem and its consequences Dual problem min w b1 y1 b2 y2 bm ym s.t. a11 y1 a21 y2 am1 ym c1 a12 y1 a22 y2 am 2 ym c2 a1n y1 a2 n y2 amn ym cn yi 0(i 1,2 , ,m ) (23) The dual theorem and its consequences Weak duality If we choose any feasible solution to the primal and any feasible solution to the dual, the w-value for the feasible dual solution will be at least as large as the z-value for the feasible primal solution. The dual theorem and its consequences Lemma 1 Let x1 x 2 x xn Be any feasible solution to the primal and y=[y1 y2 … ym] be any feasible solution to the dual, then (z-value for x)≤(w-value for y). The dual theorem and its consequences If a feasible solution to either the primal or the dual is readily available, weak duality can be used to obtain a bound on the optimal objective function value for the other problem. The dual theorem and its consequences Lemma 2 Let x1 x x 2 xn Be a feasible solution to the primal and y=[y1 y2 … ym] be a feasible solution to the dual. If cx=yb, then x is optimal for the primal and y is optimal for the dual. The dual theorem and its consequences Lemma 3 If the primal is unbounded, the dual problem is infeasible. Lemma 4 If the dual is unbounded, the primal is infeasible. The dual theorem Theorem 1 The dual theorem Suppose BV is an optimal basis for the primal. Then cBVB-1 is an optimal solution to the dual. Also, z w The dual theorem Remarks A basis BV that is feasible for the primal is optimal if and only if cBVB-1 is dual feasible. When we find the optimal solution to the primal by using the simplex algorithm, we have also found the optimal solution to the dual. The dual theorem How to read the optimal dual solution from row 0 of the optimal tableau if the primal is a max problem Optimal value of dual variable yi =coefficient of si in optimal row 0 if constraint i is a ≤ constraint Optimal value of dual variable yi =-(coefficient of ei in optimal row 0) if constraint i is a ≥ constraint Optimal value of dual variable yi =(coefficient of ai in optimal row 0)-M if constraint i is a = constraint Example 10 To solve the following LP, max z 3 x1 2 x2 5 x3 s.t. x1 3 x2 2 x3 15 2 x2 x3 5 2 x1 x2 5 x3 10 x1 , x2 , x3 0 Example 10 The optimal tableau, z 1 x1 0 x2 0 x3 0 0 0 0 1 0 0 1 0 0 1 0 0 s1 e2 51 23 4 23 2 23 9 23 58 23 5 23 9 23 17 23 a2 M 58 23 a3 M 239 235 232 9 23 17 23 231 7 23 rhs 565 23 15 23 65 23 120 23 BV z 565 23 x3 15 23 x2 x1 65 23 120 23 Example 10 Solution To find the dual from the tableau, max z ( x1 0) ( x2 0) ( x3 0) x1 x2 x3 min w ( y1 0) ( y 2 0) ( y3 urs) y1 y2 y3 1 0 2 3 3 2 1 2 2 1 5 5 15 5* 10* Example 10 From the optimal primal tableau, we can find the optimal solution to dual as follows: Since the first primal constraint is a ≤ constraint, y1=coefficient of s1 in optimal row 0=51/23. Since the second primal constraint is a ≥ constraint, y2=(coefficient of e2 in optimal row 0)=-58/23. Since the third constraint is an equality constraint, y3=(coefficient of a3 in optimal row 0)-M=9/23. Example 10 By the dual theorem, the optimal dual objective function value w must equal 565/23. In summary, the optimal dual solution is 51 58 9 w 565 , y , y , y 1 2 3 23 23 23 23 The dual theorem How to read the optimal dual solution from row 0 of the optimal tableau if the primal is a min problem Optimal value of dual variable xi =coefficient of si in optimal row 0 if constraint i is a ≤ constraint Optimal value of dual variable xi =-(coefficient of ei in optimal row 0) if constraint i is a ≥ constraint Optimal value of dual variable xi =(coefficient of ai in optimal row 0)+M if constraint i is a = constraint The dual simplex method When we use the simplex method to solve a max problem (primal) , we begin with a primal feasible solution. Since at least one variable in row 0 of the initial tableau has a negative coefficient, our initial primal solution is not dual feasible. Through a sequence of simplex pivots, we maintain primal feasibility and obtain an optimal solution when dual feasibility is attained. The dual simplex method In many situations, it is easier to solve an LP by beginning with a tableau in which each variable in row 0 has a nonnegative coefficient (so the tableau is dual feasible) and at least one constraint has a negative right-hand side (so the tableau is primal infeasible). The dual simplex method maintains a nonnegative row 0 (dual feasibility) and eventually obtains a tableau in which each right-hand side is nonnegative (primal feasibility). Dual simplex method for a max problem Step1 Is the right-hand side of each constraint nonnegative? If so, an optimal solution has been found; if not, at least one constraint has a negative right-hand side, and we go to step 2. Dual simplex method for a max problem Step2 Choose the most negative basic variable as the variable to leave the basis. The row in which the variable is basic will be the pivot row. To select the variable that enters the basis, we compute the following ratio for each variable xj that has a negative coefficient in the pivot row: Coefficient of xj in row 0 Coefficient of xj in pivot row Choose the variable with the smallest ratio as the entering variable. This form of the ratio test maintains a dual feasible tableau (all variables in row 0 have nonnegative coefficients). Now use ero’s to make the entering variable a basic variable in the pivot row. Dual simplex method for a max problem Step 3 If there is any constraint in which the righthand side is negative and each variable has a nonnegative coefficient, the LP has no feasible solution. If no constraint indicating infeasibility is found, return to step 1. Dual simplex method for a max problem To illustrate the case of an infeasible LP, suppose the dual simplex method yielded a constraint such as x1+2x2+x3=-5. since x1,x2,x3≥0, then x1+2x2+x3≥0, the constraint cannot be satisfied. In this case, the original LP must be infeasible. Dual simplex method Three uses of the dual simplex follow: Finding the new optimal solution after a constraint is added to an LP Finding the new optimal solution after changing a right-hand side of an LP Solving a normal min problem Finding the new optimal solution after a constraint is added to an LP The dual simplex method is often used to find the new optimal solution to an LP after a constraint is added. When a constraint is added, one of the following three cases will occur: Case 1 the current optimal solution satisfies the new constraint. Case 2 the current optimal solution does not satisfy the new constraint, but the LP still has a feasible solution. Case 3 the additional constraint causes the LP to have no feasible solution. Finding the new optimal solution after a constraint is added to an LP Suppose we have added the constraint x1+x2+x3≤11 to the Dakota problem. The current optimal solution (z=280, x1=2, x2=0, x3=8) satisfies this constraint. Adding a constraint to an LP either leaves the feasible region unchanged or eliminates points from the feasible region. So, it either reduces the optimal z-value or leaves it unchanged. Since the current solution is still feasible and has z=280, it must still be optimal. Finding the new optimal solution after a constraint is added to an LP Suppose that in the Dakota problem, adds the constraint x2≥1 Since the current optimal solution has x2=0, it is no longer feasible and cannot be optimal. Appending the constraint –x2+e4=-1 to the optimal Dakota tableau. Finding the new optimal solution after a constraint is added to an LP BV 5 x2 z 2 x2 2 x2 x1 54 x2 x2 s1 x3 10s2 10s3 280 z 280 2 s2 8s3 24 s1 24 2 s2 4 s3 8 x3 8 12 s2 32 s3 2 x1 2 1 e4 1 e4 The variable e4=-1 is the most negative basic variable, so e4 will exit from the basis, and row 4 will be the pivot row. Since x2 is the only variable with a negative coefficient in row 4, x2 must enter into the basis. Finding the new optimal solution after a constraint is added to an LP BV z s1 x3 x1 10s2 10s3 5e4 275 z 275 2 s2 8s3 2e4 26 s1 26 2 s2 4 s3 2e4 10 x3 10 12 s2 32 s3 54 e4 x1 x2 This is an optimal tableau. e4 3 4 1 3 4 x2 1 Finding the new optimal solution after a constraint is added to an LP Suppose we add the constraint x1+x2≥12 to the Dakota problem. Appending the constraint –x1-x2+e4=-12 to the optimal Dakota tableau yields, BV 5 x2 z 2 x2 2 x2 x1 54 x2 x1 x2 s1 x3 10s2 10s3 280 z 280 2 s2 8s3 24 s1 24 2 s2 4 s3 8 x3 8 12 s2 32 s3 2 x1 2 e4 12 e4 12 Finding the new optimal solution after a constraint is added to an LP To eliminate x1 from the new constraint, BV 5 x2 z 10s2 10s3 280 z 280 2 s2 8s3 24 s1 24 2 s2 4 s3 8 x3 8 54 x2 12 s2 32 s3 2 x1 2 0.25x2 0.5s2 1.5s3 2 x2 2 x2 x1 s1 x3 e4 10 e4 10 Since e4=-10 is the most negative basic variable, e4 will leave the basis and row 4 will be the pivot row. The variable s2 is the only one with a negative coefficient in row 4, so s2 enters the basis. Finding the new optimal solution after a constraint is added to an LP BV 10x2 z x2 x2 x1 s1 x3 40s3 20e4 80 2 s3 4e4 16 s1 16 2 s3 4e4 32 x3 32 x2 0.5 x2 s2 3s3 z 280 e4 12 x2 12 2e4 20 s2 20 Now x3 must leave the basis, and row 2 will be the pivot. Since x2 is the only variable in row 2 with a negative coefficient, x2 now enters the basis. Finding the new optimal solution after a constraint is added to an LP BV 10x3 z x3 x2 x1 60s3 s1 60e4 4 s3 240 z 240 16 s1 16 x3 2 s3 4e4 32 x2 32 x3 2 s3 3e4 20 x1 20 4 s3 4e4 36 s2 36 0.5 x3 s2 Row 3 cannot be satisfied. Hence the Dakota problem with the additional constraint x1+x2≥12 has no feasible solution. Finding the new optimal solution after changing a right-hand side If the right-hand side of a constraint is changed and the current basis becomes infeasible, the dual simplex can be used to find the new optimal solution. To illustrate, suppose that 30 finishing hours are now available in Dakota problem. Then it changed the current optimal tableau to that shown -> Finding the new optimal solution after changing a right-hand side z +5x2 +10s2+10s3=380 -2x2 +s1+ 2s2 -8s3=44 -2x2+x3 +2s2 -4s3=28 x1+1.25x2 -0.5s2+1.5s3=-3 Basic variables z=380 s1=44 x3=28 x1=-3 x1 is the most negative one, so x1 must leave the basis, and row 3 will be the pivot row. Since s2 has the only negative coefficient in row 3, s2 will enter the basis. Finding the new optimal solution after changing a right-hand side Basic variables z+20x1+30x2 +40s3=320 z=320 4x1 +3x2 +s1 -2s3=32 s1=32 4x1 +3x2+x3 +2s3=16 x3=16 -2x1-2.5x2 +s2 -3s3=6 s2=6 This is an optimal tableau. Solving a normal min problem To solve the following LP: min z x1 2 x2 s.t. x1 - 2 x2 x3 4 2 x1 x2 x3 6 x1 , x2 , x3 0 Convert the LP to a max problem with objective function z’=-x1-2x2. Solving a normal min problem Subtracting excess variables e1 and e2 from the two constraints, and multiply each constraint through by -1, we can use e1 and e2 as basic variables. z x1 2 x2 x1 2 x2 2 x1 x2 x3 x3 e1 e2 BV 0 z 0 4 e1 4 6 e2 6 Solving a normal min problem At least one constraint has a negative right-hand side, so this is not an optimal tableau. We choose the most negative basic variable e2 to leave the basis. Since e2 is basic in row 2, row 2 will be the pivot row. To determine the entering variable, we find the following ratios: x1 ratio=1/2=0.5 x2 ratio=2/1=2 The smaller ratio is the x1 ratio, so x1 enters the basis in row 2. Solving a normal min problem z x1 32 x2 52 x2 12 x2 12 x3 32 x3 12 x3 e1 12 e2 12 e2 12 e2 BV 3 z 3 1 e1 1 3 e2 3 Since there is no constraint indicating infeasibility, we return to step 1. Solving a normal min problem The first constraint has a negative right-hand side, so the tableau is not optimal. Since e1=-1 is the only negative basic variable, e1 will exit from the basis, and row 1 will be the pivot row. The ratios are x3 ratio=(1/2)/(3/2)=1/3 e2 ratio=(1/2)/(1/2)=1 The smallest ratio is 1/3, so x3 will enter the basis in row 1. Solving a normal min problem z x1 73 x2 53 x2 13 x2 x3 13 e1 13 e2 23 e1 13 e2 13 e1 13 e2 103 23 103 BV z 103 e1 23 e2 103 Since each right-hand side is nonnegative, this is an optimal tableau. The original problem was a min problem, so the optimal solution to the original problem is z=10/3,x1=10/3, x3=2/3 and x2=0.