			CS 525 Final Exam Solutions
			Wednesday December 18, 1996
>> %Problem 1 Solution%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> Q=[1 -1;-1 1];p=[8 -2]';A=[1 2;1 -1];b=[1 -7]';
>> M=[Q -A';A zeros(2,2)];q=[p;-b];
>> H=lemketbl(M,q);
              z1         z2         z3         z4         1    
       -------------------------------------------------------
  w1= |     1.0000    -1.0000    -1.0000    -1.0000     8.0000 
  w2= |    -1.0000     1.0000    -2.0000     1.0000    -2.0000 
  w3= |     1.0000     2.0000     0.0000     0.0000    -1.0000 
  w4= |     1.0000    -1.0000     0.0000     0.0000     7.0000 
>> H=addcol(H,[1 1 1 1]','z0',5);
              z1         z2         z3         z4         z0         1    
       ------------------------------------------------------------------
  w1= |     1.0000    -1.0000    -1.0000    -1.0000     1.0000     8.0000 
  w2= |    -1.0000     1.0000    -2.0000     1.0000     1.0000    -2.0000 
  w3= |     1.0000     2.0000     0.0000     0.0000     1.0000    -1.0000 
  w4= |     1.0000    -1.0000     0.0000     0.0000     1.0000     7.0000 
>> H=ljx(H,2,5);
              z1         z2         z3         z4         w2         1    
       ------------------------------------------------------------------
  w1= |     2.0000    -2.0000     1.0000    -2.0000     1.0000    10.0000 
  z0= |     1.0000    -1.0000     2.0000    -1.0000     1.0000     2.0000 
  w3= |     2.0000     1.0000     2.0000    -1.0000     1.0000     1.0000 
  w4= |     2.0000    -2.0000     2.0000    -1.0000     1.0000     9.0000 
>> H=ljx(H,2,2);
              z1         z0         z3         z4         w2         1    
       ------------------------------------------------------------------
  w1= |     0.0000     2.0000    -3.0000     0.0000    -1.0000     6.0000 
  z2= |     1.0000    -1.0000     2.0000    -1.0000     1.0000     2.0000 
  w3= |     3.0000    -1.0000     4.0000    -2.0000     2.0000     3.0000 
  w4= |     0.0000     2.0000    -2.0000     1.0000    -1.0000     5.0000 
>> %Complementary tableau!
>> %x1=z1=0, x2=z2=2, u1=z3=0, u2=z4=0, z0=0
>> %   w1=6,    w2=0,    w3=3,    w4=5.      Hence z'w=0. 
>> % min f(x)=-2.
%Problem 2 Solution%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> %min x3 subject to: -x3=<x1+x2-1=<x3
>> %                   -x3=<x1-x2+2=<x3
>> A=[1 1 1;-1 -1 1;1 -1 1;-1 1 1];b=[1 -1 -2 2]';c=[0 0 1]';
>> H=totbl(A,b,c);
	                  x1         x2         x3         1    
	           --------------------------------------------
	      x4= |     1.0000     1.0000     1.0000    -1.0000 
	      x5= |    -1.0000    -1.0000     1.0000     1.0000 
	      x6= |     1.0000    -1.0000     1.0000     2.0000 
	      x7= |    -1.0000     1.0000     1.0000    -2.0000 
		   --------------------------------------------
	       z= |     0.0000     0.0000     1.0000     0.0000 
>> H=ljx(H,4,2);
	                  x1         x7         x3         1    
                   -------------------------------------------- 
              x4= |     2.0000     1.0000     0.0000     1.0000 
              x5= |    -2.0000    -1.0000     2.0000    -1.0000 
              x6= |     0.0000    -1.0000     2.0000     0.0000 
              x2= |     1.0000     1.0000    -1.0000     2.0000 
	           --------------------------------------------
	       z= |     0.0000     0.0000     1.0000     0.0000 
>> H=ljx(H,2,3);
	                  x1         x7         x5         1    
		     --------------------------------------------
              x4= |     2.0000     1.0000     0.0000     1.0000 
              x3= |     1.0000     0.5000     0.5000     0.5000 
              x6= |     2.0000     0.0000     1.0000     1.0000 
              x2= |     0.0000     0.5000    -0.5000     1.5000 
	            --------------------------------------------
	       z= |     1.0000     0.5000     0.5000     0.5000 
>> %Optimal tableau!
>> %min x3=z=1/2 at x1=0, x2=1.5.
>> %Problem 3 Solution%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> A=[-1 1;-1 0];b=[-1 -2]';p=[-1 0]';q=[2 1]';
>> H=totbl(A,b,p);
              x1         x2         1    
       ---------------------------------
  x3= |    -1.0000     1.0000     1.0000 
  x4= |    -1.0000     0.0000     2.0000 
       ---------------------------------
   z= |    -1.0000     0.0000     0.0000 
>> H=addrow(H,[q' 0],'z0',3);
              x1         x2         1    
       ---------------------------------
  x3= |    -1.0000     1.0000     1.0000 
  x4= |    -1.0000     0.0000     2.0000 
  z0= |     2.0000     1.0000     0.0000 
       ---------------------------------
   z= |    -1.0000     0.0000     0.0000 
>> %-1+2t>=0, 0+t>=0 imply optimal tableau for t>=1/2 
>> %-1+2t<0 when t<1/2. So first column is pivot column.
>> H=ljx(H,1,1);
              x3         x2         1    
       ---------------------------------
  x1= |    -1.0000     1.0000     1.0000 
  x4= |     1.0000    -1.0000     1.0000 
  z0= |    -2.0000     3.0000     2.0000 
       ---------------------------------
   z= |     1.0000    -1.0000    -1.0000 
>> %1-2t>=0, -1+3t>=0 imply optimal tableau for 1/2>=t>=1/3
>> %-1+3t<0 when t<1/3 so column 2 is pivot column.
>> H=ljx(H,2,2);
              x3         x4         1    
       ---------------------------------
  x1= |     0.0000    -1.0000     2.0000 
  x2= |     1.0000    -1.0000     1.0000 
  z0= |     1.0000    -3.0000     5.0000 
       ---------------------------------
   z= |     0.0000     1.0000    -2.0000 
>> %0+t>=0, 1-3t>=0 imply optimal tableau for 1/3>=t>=0
>> %0+t<0 fot t<0 so column 1 is pivot column. But.....
>> %column 1 has no negative elements so z(t) is unbounded below for t<0. 
>> %Summary%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> %For t>=1/2, optimal z(t)=0 at x1=0, x2=0 
>> %For 1/2>=t>=1/3, optimal z(t)=-1+2t at x1=1, x2=0
>> %For 1/3>=t>=0, optimal z(t)=-2+5t at x1=2, x2=1
>> %For 0>t, z(t) is unbounded below
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
