function r = getr(n,s,B,T) % % find the index to kick out % % On input: % B: current basis index % T: current Tableau % s: s-th column is to JOIN the index. % n: number of unknowns. % % On output: % % r: B(r)-th column is to LEAVE the index. % r < 0 indicates unbounded LP. % x = zeros(n,1); x(B)= T(:,n+1); t = T(:,s); if (max(t)0); [lamda, r] = min(x(B(mask))./t(mask)); r = mask(r);