%% Math 464 Linear Optimization (Spring 2023) %% Lecture 10, 02/09/2023 %% bfs <==? vertex correspondences, and %% Degenerate bfs's >> format rat >> format compact %% Restarting with the same LP >> A = [1 1 -1 0 0; 3 1 0 -1 0; 3 2 0 0 1] A = 1 1 -1 0 0 3 1 0 -1 0 3 2 0 0 1 >> Bind = [1 4 5]; >> B = A(:,Bind) B = 1 0 0 3 -1 0 3 0 1 >> b = [2 4 10]'; >> xB = inv(B)*b xB = 2 2 4 >> % This == A(2,0) %% Let's find some basic solutions that are *NOT* feasible >> Bind = [1 2 3]; >> B = A(:,Bind) B = 1 1 -1 3 1 0 3 2 0 >> xB = inv(B)*b xB = -2/3 6 10/3 >> % This is H(-2/3,6) >> Bind = [1 2 4]; >> B = A(:,Bind) B = 1 1 0 3 1 -1 3 2 0 >> xB = inv(B)*b xB = 6 -4 10 % This is (6,-4), the point of intersection of % 3x1 + 2x2 = 10 and x1 + x2 = 2 % Finding the determinants of B in each case to % fill the table of vertex-bfs correspondences >> Bind = [1 4 5]; B = A(:,Bind); det(B) ans = -1 >> xB = inv(B)*b xB = 2 2 4 >> % This == A(2,0) >> Bind = [1 3 4]; B = A(:,Bind); det(B) ans = 3 >> xB = inv(B)*b xB = 10/3 4/3 6 >> % This == B(10/3,0) >> Bind = [2 3 4]; B = A(:,Bind); det(B) ans = 2 >> xB = inv(B)*b xB = 5 3 1 >> % This == C(0,5) >> Bind = [2 3 5]; B = A(:,Bind); det(B) ans = 1 >> xB = inv(B)*b xB = 4 2 2 >> % This == D(0,4) >> Bind = [1 2 5]; B = A(:,Bind); det(B) ans = -2 >> xB = inv(B)*b xB = 1 1 5 >> % This == E(1,1) %% Degenerate bfs example: Adding x1 <= 10/3 >> oldA = A; % saving a copy of original A and b >> oldb = b; >> A = [ [A zeros(3,1)]; [1 0 0 0 0 1]] A = 1 1 -1 0 0 0 3 1 0 -1 0 0 3 2 0 0 1 0 1 0 0 0 0 1 >> b = [b; 10/3] b = 2 4 10 10/3 % We know Bind should include 1,3,4; we need one more column index % from {2,5,6}. Any one of them would work here! >> Bind = [1 2 3 4]; >> B = A(:,Bind) B = 1 1 -1 0 3 1 0 -1 3 2 0 0 1 0 0 0 >> det(B) ans = -2 >> xB = inv(B)*b xB = 10/3 0 4/3 6 >> % x1 = 10/3, x2=0, x3=4/3, x4=6; B(10/3,0) >> Bind = [1 5 3 4]; >> B = A(:,Bind);det(B) ans = -1 >> xB = inv(B)*b xB = 10/3 0 4/3 6 >> >> % x1 = 10/3, x5=0, x3=4/3, x4=6; B(10/3,0)