CS 525 Linear Programming Midterm March 7, 1996 Solutions ------------------------------- >> %Solution 1 >> A=[-1 0 1;1 1 1;3 2 1];b=[1 -1 -4]'; >> H=totbl(A,b); x1 x2 x3 1 -------------------------------------------- y1= | -1.0000 0.0000 1.0000 -1.0000 y2= | 1.0000 1.0000 1.0000 1.0000 y3= | 3.0000 2.0000 1.0000 4.0000 >> H=ljx(H,1,1); y1 x2 x3 1 -------------------------------------------- x1= | -1.0000 0.0000 1.0000 -1.0000 y2= | -1.0000 1.0000 2.0000 0.0000 y3= | -3.0000 2.0000 4.0000 1.0000 >> H=ljx(H,2,2); y1 y2 x3 1 -------------------------------------------- x1= | -1.0000 0.0000 1.0000 -1.0000 x2= | 1.0000 1.0000 -2.0000 -0.0000 y3= | -1.0000 2.0000 0.0000 1.0000 >> %System has no solution, because y1(x)=y2(x)=0 ===> y3(x)=1. >> >> >> %Solution 2 >> A=[1 -1 1;2 -1 1;-1 1 2];b=[-1 -2 0]';p=[1 -1 2]'; >> H=totbl(A,b,p); x1 x2 x3 1 -------------------------------------------- x4= | 1.0000 -1.0000 1.0000 1.0000 x5= | 2.0000 -1.0000 1.0000 2.0000 x6= | -1.0000 1.0000 2.0000 -0.0000 -------------------------------------------- z= | 1.0000 -1.0000 2.0000 0.0000 >> H=ljx(H,1,2); x1 x4 x3 1 -------------------------------------------- x2= | 1.0000 -1.0000 1.0000 1.0000 x5= | 1.0000 1.0000 0.0000 1.0000 x6= | 0.0000 -1.0000 3.0000 1.0000 -------------------------------------------- z= | 0.0000 1.0000 1.0000 -1.0000 >> >> %Optimal tableau! z_min=-1 at x1=0, x2=1, x3=0. >> >> >> %Solution 3 >> A=[2 1 -1;3 5 1;-1 3 -2];b=[-2 -1 1]';p=[-1 -2 -1]'; >> H=totbl(A,b,p); x1 x2 x3=unres. 1 -------------------------------------------- x4= | 2.0000 1.0000 -1.0000 2.0000 0=x5= | 3.0000 5.0000 1.0000 1.0000 x6= | -1.0000 3.0000 -2.0000 -1.0000 -------------------------------------------- z= | -1.0000 -2.0000 -1.0000 0.0000 >> H=ljx(H,2,3); x1 x2 x5=0 1 -------------------------------------------- x4= | 5.0000 6.0000 -1.0000 3.0000 unx3= | -3.0000 -5.0000 1.0000 -1.0000 x6= | 5.0000 13.0000 -2.0000 1.0000 -------------------------------------------- z= | 2.0000 3.0000 -1.0000 1.0000 >> >> %Optimal tableau if we ignore column x5 (x5=0 never becomes >> %basic again) and ignore row x3 (x3 is unrestricted). >> %Solution: z_min=1 at x1=0, x2=0, x3=-1. >> >> >> Answer 4 >> A=[4 1 17;1 -1 1;6 2 13];b=[2 1 5]';p=[3 2 1]'; >> H=totbl(A,b,p); x1 x2 x3 1 -------------------------------------------- x4= | 4.0000 1.0000 17.0000 -2.0000 x5= | 1.0000 -1.0000 1.0000 -1.0000 x6= | 6.0000 2.0000 13.0000 -5.0000 -------------------------------------------- z= | 3.0000 2.0000 1.0000 0.0000 >> %Nonnegative bottom row. Hence dual feasible. >> %Pick a pivot row that results in an easy pivot. >> %Row x4 gives pivot=17. Row x6 gives pivot=13. So..... >> H=ljx(H,2,3); x1 x2 x5 1 -------------------------------------------- x4= | -13.0000 18.0000 17.0000 15.0000 x3= | -1.0000 1.0000 1.0000 1.0000 x6= | -7.0000 15.0000 13.0000 8.0000 -------------------------------------------- z= | 2.0000 3.0000 1.0000 1.0000 >> >> %Optimal tableau! z_min=1 at x1=0, x2=0, x3=1. >> diary off