% This program is used in simplex programs to perform the pivoting in the % simplex tableau. % The problem is to minimize z=c*x+d, subject to constraints Ax=b and x>=0. % The input data are d, c, A, b, the size of A, as well as the row and column % number identifying the pivot position. % Written by helga schaffrin, oct. 2003 function [d,c,A,b]=pivot(d,c,A,b,m,n,row,column) % Starting the pivoting: A(row,column) should be 1. b(row)=b(row)/A(row,column); A(row,:)=A(row,:)/A(row,column); % Continuing with the pivoting: All other rows should have entry 0 % in that column... b([1:row-1 row+1:m])=b([1:row-1 row+1:m])-(b(row)*A([1:row-1 row+1:m],column)); A([1:row-1 row+1:m],:)=A([1:row-1 row+1:m],:)-A([1:row-1 row+1:m],column)*A(row,:); % ...including c. d=d-b(row)*c(column); c=c-c(column)*A(row,:);