0

I am implementing the (dual) simplex algorithm in Matlab/Octave.

My algorithm works just fine for a small test problem, but as soon as I try a bigger problem as afiro.mps (from http://www.netlib.org/lp/data/) I get the warning "matrix singular to machine precision, rcond=0" and octave throws an error (or does not terminate). The exact command is:

x = zeros(n,1);
x(B) = A(:,B) \ b; % Compute primal variables
y = A(:,B)' \ c(B); % Compute dual variables

The problem is in standard form

min c*x
s.t. Ax=b
x>=0

A is a m-x-n matrix and B is the index vector of the inactive constraints (base variables). As I am doing a two phased simplex I choose 1:size(A,1) as an initial base for the dual simplex.

The problem is read from a mps file via a self coded reader. I expect the mps file is read correctly, as the glpk function solves the problem correctly, when it has A,b,c as input parameters.

Is there some way to avoid the warning or do I have an error in my coding?

tilman151
  • 563
  • 1
  • 10
  • 20

1 Answers1

0

The basis matrices of linear programming problems usually have very bad condition numbers. This is one the difficulties when implementing a stable simplex algorithm.

You should have a look at this paper that explains this phenomenon: On the Factorization of Simplex Basis Matrices

mattmilten
  • 6,242
  • 3
  • 35
  • 65