[Osi] re-solving with osiclp branchAndBound

Goossens Jan-Willem Jan-Willem.Goossens at nc3a.nato.int
Mon Apr 6 11:49:24 EDT 2009


Hi,

I understand that the branchAndBound support within OsiClp is meant to be only basic. Still:

How can I branchAndBound(), then add a constraint, and branchAndBound() again?
Just like that, it doesn't work. With CBC's saveReferenceModel in mind, I tried

      OsiClpSolverInterface model;

      int start[] = { 0, 1, 2};
      int index[] = { 0, 0};
      double values[] = {1.0, 2.0};
      double collb[] = {0.0, 0.0};
      double colub[] = {10.0, 10.0};
      double obj[] = { 1.0, 1.0};
      double rowlb[] = { 0.0};
      double rowub[]= { 3.9};

      // obj: Max x0 + x1
      //  st. x0 + 2 x1 <= 3.9
      //          0 <= x0 <= 10 and integer
      //          0 <= x1 <= 10
      model.loadProblem(2, 1, start, index, values, collb, colub, obj, rowlb, rowub);
      model.setInteger(0);
      model.setObjSense(-1.0);

      model.saveBaseModel(); // maybe this helps, and restoreBaseModel(1)
      model.branchAndBound();
      bool optimal = model.isProvenOptimal();
      const double *val = model.getColSolution(); // x0 = 3, x1 = 0.45
      model.restoreBaseModel(1);

      const int rowCols[] = {0};
      const double rowElements = { 1.0};

      // add x0 <= 2, and solve once again.
      CoinPackedVector v(1, rowCols, rowElements);
      model.addRow(v, 0.0, 2.0);
      model.branchAndBound();
      optimal = model.isProvenOptimal(); // should be x0 = 2, x1 = 0.95

Gives the output

Clp0006I 0  Obj 3.45 Primal inf 1 (1) Dual inf 1e+010 (1)
Clp0006I 1  Obj 2.95
Clp0000I Optimal - objective value 2.95
The LP relaxation is infeasible

So, almost there, but for some reason "The LP relaxation is infeasible". The reasons seems to be that within branchAndBound, the test "isDualObjLimitReached" of the initialSolve returns true..

Note, I'm not working with the very latest sources, so if you cannot reproduce this...

Thanks,

Jan-Willem

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/osi/attachments/20090406/2bb61978/attachment.html>


More information about the Osi mailing list