>> %%%%%%%%%%% CS525 Midterm March 9, 2000 Answers %%%%%%%%%%%
>> %%%%%%%%%%%%%%%%%%%%% Question 1 Answer %%%%%%%%%%%%%%%%%%%
>> A=[1 -1 -1;-1 2 0;1 1 -3];b=[-1 2 -1]';H=totbl(A,b);
              x1         x2         x3         1   
       --------------------------------------------
0=y1= |     1.0000    -1.0000    -1.0000     1.0000 
0=y2= |    -1.0000     2.0000     0.0000    -2.0000 
0=y3= |     1.0000     1.0000    -3.0000     1.0000 
>> H=ljx(H,1,1);
            0=y1         x2         x3         1   
       --------------------------------------------
  x1= |     1.0000     1.0000     1.0000    -1.0000 
0=y2= |    -1.0000     1.0000    -1.0000    -1.0000 
0=y3= |     1.0000     2.0000    -2.0000     0.0000 
>> H=ljx(H,2,2);
            0=y1       0=y2         x3         1   
       --------------------------------------------
  x1= |     2.0000     1.0000     2.0000     0.0000 
  x2= |     1.0000     1.0000     1.0000     1.0000 
0=y3= |     3.0000     2.0000     0.0000     2.0000 
>> %Blocked! No solution because: y1=0 & y2=0 imply y3=2.
>> %%%%%%%%%%%%%%%%%%%%% Question 2 Answer %%%%%%%%%%%%%%%%%%%
>> A=[1 3 -2;1 1 -1;0 2 -1];b=[1 1 -1]';p=[-1 -1 2]';H=totbl(A,b,p);
              x1         x2    free x3=        1   
       --------------------------------------------
  x4= |     1.0000     3.0000    -2.0000    -1.0000 
0=x5= |     1.0000     1.0000    -1.0000    -1.0000 
  x6= |     0.0000     2.0000    -1.0000     1.0000 
       --------------------------------------------
 z  = |    -1.0000    -1.0000     2.0000     0.0000 
>> %Exchange 0=x5 with free x3 
>> H=ljx(H,2,3);
              x1         x2         x5=0       1   
       --------------------------------------------
  x4= |    -1.0000     1.0000     2.0000     1.0000 
frx3= |     1.0000     1.0000    -1.0000    -1.0000 
  x6= |    -1.0000     1.0000     1.0000     2.0000 
       --------------------------------------------
 z  = |     1.0000     1.0000    -2.0000    -2.0000 
>> %Optimal tableau (ignoring col x5 row x3)! z_min=-2 at x1=0, x2=0, x3=-1.
>> %%%%%%%%%%%%%%%%%%%%% Question 3 Answer %%%%%%%%%%%%%%%%%%%
>> A=[-13 1 -2;1 0 1;2 1 3];b=[-1 -2 -1]';p=[-3 -1 1]';H=totbl(A,b,p);
              x1         x2         x3         1   
       --------------------------------------------
 x4 = |   -13.0000     1.0000    -2.0000     1.0000 
 x5 = |     1.0000     0.0000     1.0000     2.0000 
 x6 = |     2.0000     1.0000     3.0000     1.0000 
       --------------------------------------------
 z  = |    -3.0000    -1.0000     1.0000     0.0000 
>> %Primal feasible, BUT unbounded! z-->-infinity for x1=x3=0 & x2-->+infinity
>> %%%%%%%%%%%%%%%%%%%%% Question 4 Answer %%%%%%%%%%%%%%%%%%%
>> A=[1 -2 -1;-1 1 1;-1 4 2];b=[3 -1 -8]';p=[1 2 1];H=totbl(A,b,p);
              x1         x2         x3         1   
       --------------------------------------------
 x4 = |     1.0000    -2.0000    -1.0000    -3.0000 
 x5 = |    -1.0000     1.0000     1.0000     1.0000 
 x6 = |    -1.0000     4.0000     2.0000     8.0000 
       --------------------------------------------
 z  = |     1.0000     2.0000     1.0000     0.0000 
>> %Dual feasible! Apply dual simplex phase II.
>> H=dualbl(H);H=ljx(H,1,1);
                  u4 =       u5 =       u6 =       w  = 
                   x1         x2         x3         1   
           --------------------------------------------
-u1  x4 = |     1.0000    -2.0000    -1.0000    -3.0000 
-u2  x5 = |    -1.0000     1.0000     1.0000     1.0000 
-u3  x6 = |    -1.0000     4.0000     2.0000     8.0000 
           --------------------------------------------
-1   z  = |     1.0000     2.0000     1.0000     0.0000 
                  u1 =       u5 =       u6 =       w  = 
                   x4         x2         x3         1   
           --------------------------------------------
-u4  x1 = |     1.0000     2.0000     1.0000     3.0000 
-u2  x5 = |    -1.0000    -1.0000     0.0000    -2.0000 
-u3  x6 = |    -1.0000     2.0000     1.0000     5.0000 
           --------------------------------------------
-1   z  = |     1.0000     4.0000     2.0000     3.0000 
>> %Dual unbounded! w-->+infinity for u4=u3=0 and u2-->+infinity.
>> %Equivalently by Strong Duality or by above tableau primal is infeasible,
>> %because: x4>=0, x2>=0, x3>=0 imply x5=<-2.
>> diary off
