Forum Discussion

FICO's avatar
FICO
Community Manager
4 years ago

Question about GetBasis method?

Hi,

I have a question about the GetBasis method.problem.getbasis (fico.com)

I made a console application with c#(as below) to test it.

sol = 10, rowStatus = 2 and colStatus = 1.

Why rowStatus is 2? It's at the lower bound, so it should be 0.

Thanks.

c# code:

      XPRS.Init("");

      var prob = new XPRSprob();

      prob.ReadProb("model", "");

      int nCol, nRow;

      prob.GetIntAttrib((int)XPRSattribute.Cols, out nCol);

      prob.GetIntAttrib((int)XPRSattribute.Rows, out nRow);

      int[] rowStatus = new int[nRow];

      int[] colStatus = new int[nCol];

      double[] sol = new double[nCol];

      prob.LpOptimize();

      prob.GetSol(sol, null, null, null);

      prob.GetBasis(rowStatus, colStatus);

model.lp

\ Using Xpress-MP extensions

Minimize

 x

Subject To

Min: x >= 10

Bounds

End

4 Replies

  • FICO's avatar
    FICO
    Community Manager

    The test version is 40.1.1

  • FICO's avatar
    FICO
    Community Manager

    Also, why colStatus is 1?

  • FICO's avatar
    FICO
    Community Manager

    Hi,

    the basis status for rows is about the status of the artificial slack or surplus variable that we add to the row, so in essence it is the opposite of the row sense. A status of 2 is expected for a nonbasic row with a lower bound:

    https://www.fico.com/fico-xpress-optimization/docs/latest/solver/optimizer/python/HTML/problem.getbasis.html

    As for the column: it is basic. It can still be at its bound if the problem is degenerate.

    I hope this helps,

    Imre Polik

  • FICO's avatar
    FICO
    Community Manager

    LP standard form

    X – S = 10

    S > = 0

    Why S = 0 is not the lower bound?