I am trying to obtain the list of basic variables and constraints (that form the basis matrix) after an LP solve.
However, Gurobi is not returning number of basic constraints to be equal to the number of basic variables. Basis matrix is supposed to be a square matrix.
Here is the code I am using:
basicVars = []
for v in vars:
if v.VBasis == 0:
basicVars.append(v)
#get the list of basic constraints
basicConstrs = []
for c in constrs:
if c.CBasis == 0:
basicConstrs.append(c)
Here are the lengths I am getting for the some of the LPs
print len(basicVars), basicConstrs
496 2750
232 748
217 717
193 548
Can someone please tell what is the right way of obtaining the basic variables and constraints?