clear all
!rm logoct6.txt
echo on
diary logoct6.txt
disp('initial data')
A=[3 2 1 1 0 0
1 1 2 0 1 0
2 1 1 0 0 1]
[m,n]=size(A)
b=[36; 32; 22]
c=[10 7 6 0 0 0 ]'
pause
disp('optimal basis - nonbasic variables')
B=[2 5 3]
N=[1 4 6]
[x isort]=sort([B N]);
pause
disp('optimal basis matrix')
A_B=A(:,B)
pause
disp('inverse of optimal basis matrix')
A_Bi=inv(A_B)
pause
disp('optimal primal solution x')
x_B=A_Bi*b
x_N=zeros(n-m,1);x=[x_B;x_N]; x=x(isort)     % sorted true x
pause
disp('c_B and dual vrbles y')
c_B=c(B)
y=(c_B'*A_Bi)'
pause
disp('verify dual feasibility and complementary slackness')
[A'*y-c   x]
pause
disp('reduced costs')
c'-y'*A
pause
disp('row 1 of current tableau for ratio test for basic c_2 change')
Abar=A_Bi*A;
Abar(1,N)
pause
disp('row 2 of current tableau for ratio test for basic c_5 change')
Abar=A_Bi*A;
Abar(2,N)
pause
disp('row 3 of current tableau for ratio test for basic c_3 change')
Abar=A_Bi*A;
Abar(3,N)
pause


echo off
diary off
