>> %%%%%%%%%%%%%%%%%CS525 Midterm Solutions March 5, 1998%%%%%%%%%%%%%%%%%%%% >> %Question 1 Answer >> A=[1 0 1 1;1 1 -1 1;-1 -2 3 -1];b=[1 1 1]'; >> H=totbl(A,b); x1 x2 x3 x4 1 ------------------------------------------------------- y1= | 1.0000 0.0000 1.0000 1.0000 -1.0000 y2= | 1.0000 1.0000 -1.0000 1.0000 -1.0000 y3= | -1.0000 -2.0000 3.0000 -1.0000 -1.0000 >> H=ljx(H,1,1); y1 x2 x3 x4 1 ------------------------------------------------------- x1= | 1.0000 -0.0000 -1.0000 -1.0000 1.0000 y2= | 1.0000 1.0000 -2.0000 0.0000 0.0000 y3= | -1.0000 -2.0000 4.0000 0.0000 -2.0000 >> H=ljx(H,2,2); y1 y2 x3 x4 1 ------------------------------------------------------- x1= | 1.0000 -0.0000 -1.0000 -1.0000 1.0000 x2= | -1.0000 1.0000 2.0000 -0.0000 -0.0000 y3= | 1.0000 -2.0000 0.0000 0.0000 -2.0000 >> %No solution because whenever y1=0, y2=0, then y3=-2 >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %Question 2 Answer >> A=[-1 -1 1 1;-2 -1 -1 1;3 1 2 1];b=[-2 -1 -3]';p=[-4 1 -2 -1]'; >> H = totbl(A,b,p); x1 x2 x3 x4 1 ------------------------------------------------------- x5= | -1.0000 -1.0000 1.0000 1.0000 2.0000 x6= | -2.0000 -1.0000 -1.0000 1.0000 1.0000 x7= | 3.0000 1.0000 2.0000 1.0000 3.0000 ------------------------------------------------------- z= | -4.0000 1.0000 -2.0000 -1.0000 0.0000 >> %Feasible unbounded tableau: z-->-infinity for x1=x2=x3=0 & x4--->+infinity >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %Question 3 Answer >> A=[1 3 1;3 2 1;-1 1 1];b=[-2 -2 -1]';p=[2 -1 -1]'; >> H=totbl(A,b,p); x1 x2 x3(unrs) 1 -------------------------------------------- x4= | 1.0000 3.0000 1.0000 2.0000 x5= | 3.0000 2.0000 1.0000 2.0000 0=x6= | -1.0000 1.0000 1.0000 1.0000 -------------------------------------------- z= | 2.0000 -1.0000 -1.0000 0.0000 >> H=ljx(H,3,3); x1 x2 x6=0 1 -------------------------------------------- x4= | 2.0000 2.0000 1.0000 1.0000 x5= | 4.0000 1.0000 1.0000 1.0000 x3= | 1.0000 -1.0000 1.0000 -1.0000 (unrs) -------------------------------------------- z= | 1.0000 0.0000 -1.0000 1.0000 >> %Optimal tableau after deleting column 3 (x6=0) & row 3 (x3: unrestricted) >> %zmin=1 at x1=0, x2=0, x3=-1 >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %Question 4 Answer >> A=[2 1 1;-1 1 1;3 1 2];b=[-1 1 -2]';p=[2 1 3]'; >> H=totbl(A,b,p); x1 x2 x3 1 -------------------------------------------- x4= | 2.0000 1.0000 1.0000 1.0000 x5= | -1.0000 1.0000 1.0000 -1.0000 x6= | 3.0000 1.0000 2.0000 2.0000 -------------------------------------------- z= | 2.0000 1.0000 3.0000 0.0000 >> %Dual feasible! Hence use dual simplex method. >> H=ljx(H,2,2); x1 x5 x3 1 -------------------------------------------- x4= | 3.0000 1.0000 0.0000 2.0000 x2= | 1.0000 1.0000 -1.0000 1.0000 x6= | 4.0000 1.0000 1.0000 3.0000 -------------------------------------------- z= | 3.0000 1.0000 2.0000 1.0000 >> %Optimal tableau! zmin=1 at x1=0, x2=1, x3=0. >> diary off