CS525 Midterm Solutions October 24, 1996 ---------------------------------------- >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %Question 1 Answer >> A=[0 1 -1 -1;-1 1 0 -2 ;-1 2 -1 -3];b=[-1 0 0]'; >> H=totbl(A,b); x1 x2 x3 x4 1 ------------------------------------------------------- y1= | 0.0000 1.0000 -1.0000 -1.0000 1.0000 y2= | -1.0000 1.0000 0.0000 -2.0000 -0.0000 y3= | -1.0000 2.0000 -1.0000 -3.0000 -0.0000 >> H=ljx(H,2,2); x1 y2 x3 x4 1 ------------------------------------------------------- y1= | 1.0000 1.0000 -1.0000 1.0000 1.0000 x2= | 1.0000 1.0000 -0.0000 2.0000 0.0000 y3= | 1.0000 2.0000 -1.0000 1.0000 -0.0000 >> H=ljx(H,1,1); y1 y2 x3 x4 1 ------------------------------------------------------- x1= | 1.0000 -1.0000 1.0000 -1.0000 -1.0000 x2= | 1.0000 0.0000 1.0000 1.0000 -1.0000 y3= | 1.0000 1.0000 0.0000 0.0000 -1.0000 >> %No solution because whenever y1=0, y2=0 then y3=-1 >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %Question 2 Answer >> A=[-13 -1 1 3;2 -1 1 2;-1 1 2 1];b=[-1 -2 -1]';p=[-4 1 -2 1]'; >> H = totbl(A,b,p); x1 x2 x3 x4 1 ------------------------------------------------------- x5= | -13.0000 -1.0000 1.0000 3.0000 1.0000 x6= | 2.0000 -1.0000 1.0000 2.0000 2.0000 x7= | -1.0000 1.0000 2.0000 1.0000 1.0000 ------------------------------------------------------- z= | -4.0000 1.0000 -2.0000 1.0000 0.0000 >> %Feasible unbounded tableau: z-->-infinity for x1=x2=x4=0, x3-->+infinity >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %Question 3 Answer >> A=[1 -1 0 0;2 -1 2 4;1 1 -2 2];b=[-1 1 -2]';p=[-1 1 -2 -3]'; >> H=totbl(A,b,p); x1 free x2 x3 x4 1 ------------------------------------------------------- x5= | 1.0000 -1.0000 0.0000 0.0000 1.0000 0=x6= | 2.0000 -1.0000 2.0000 4.0000 -1.0000 x7= | 1.0000 1.0000 -2.0000 2.0000 2.0000 ------------------------------------------------------- z= | -1.0000 1.0000 -2.0000 -3.0000 0.0000 >> H=ljx(H,2,2); x1 0=x6 x3 x4 1 ------------------------------------------------------- x5= | -1.0000 1.0000 -2.0000 -4.0000 2.0000 freex2| 2.0000 -1.0000 2.0000 4.0000 -1.0000 x7= | 3.0000 -1.0000 0.0000 6.0000 1.0000 ------------------------------------------------------- z= | 1.0000 -1.0000 0.0000 1.0000 -1.0000 >> %Optimal tableau after deleting free variable row x2, and >> %equality constraint slack, column x6=0. >> %zmin=-1 at x1=x3=x4=0, x2=-1. >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %Question 4 Answer >> A=[7 4 3 1;1 -1 1 1];b=[-1 1]';p=[2 0 3 1]'; >> H=totbl(A,b,p);H=dualbl(H); u3= u4= u5= u6= w= x1 x2 x3 x4 1 ------------------------------------------------------- -u1 x5= | 7.0000 4.0000 3.0000 1.0000 1.0000 -u2 x6= | 1.0000 -1.0000 1.0000 1.0000 -1.0000 ------------------------------------------------------- 1 z= | 2.0000 0.0000 3.0000 1.0000 0.0000 >> %Use Dual Simplex because bottom row is nonnegative! >> H=ljx(H,2,4); u3= u4= u5= u2= w= x1 x2 x3 x6 1 ------------------------------------------------------- -u1 x5= | 6.0000 5.0000 2.0000 1.0000 2.0000 -u6 x4= | -1.0000 1.0000 -1.0000 1.0000 1.0000 ------------------------------------------------------- 1 z= | 1.0000 1.0000 2.0000 1.0000 1.0000 >> %Optimal! zmin=1 at x1=x2=x3=0, x4=1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%