function [t,inb,otb] = initialize(f,A,b) % % returns an initial tableau corresponding to the problem % max f'*x subject to A*x <= b % % on entry: % f coefficients of the linear objective function; % A coefficients of the linear inequalities; % b right hand side vector of the constraints. % % on return: % t initial tableau; % inb indices to variables in the basis, % inb(i) gives column for i-th unit vector; % otb indices to variables outside the basis. % n = size(A,2); % number of variables m = size(A,1); % number of constraints inb = zeros(1,m); otb = zeros(1,n); t = zeros(m+1,n+m+1); for j=1:n % copy objective f and A in t t(1,j) = f(j); for i=1:m t(i+1,j) = A(i,j); end; otb(j) = j; % original variables are outside the basis end; for i=1:m % assign identity and b in t t(i+1,n+i) = 1; t(i+1,n+m+1) = b(i); inb(i) = n+i; % all slack variables are in the basis end;