coin-or / Clp

COIN-OR Linear Programming Solver
Other
392 stars 82 forks source link

ClpSimplex::getBasics() not available after barrier with crossover #251

Closed pfetsch closed 1 year ago

pfetsch commented 1 year ago

When I call ClpSimplex::barrier() with crossover, then rowArray_ is not available and thus ClpSimplex::getBasics() cannot be successfully called. Indeed, rowArray_ does not seem to be copied to the original model.

Can this be (easily) fixed?

jjhforrest commented 1 year ago

Should be fixable.  Can you give some code that you want to work.  I presume you had a message from -

    printf("ClpSimplexPrimal or ClpSimplexDual must have been called with correct startFinishOption\n");

so it may be as simple as setting a few options.

On 11/12/2022 14:01, Marc Pfetsch wrote:

When I call ClpSimplex::barrier() with crossover, then |rowArray| is not available and thus |ClpSimplex::getBasics()| cannot be successfully called. Indeed, |rowArray| does not seem to be copied to the original model.

Can this be (easily) fixed?

— Reply to this email directly, view it on GitHub https://github.com/coin-or/Clp/issues/251, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWJYHG5RJ64FNCGS3GALZTWMXNDDANCNFSM6AAAAAAS27ZEKU. You are receiving this because you are subscribed to this thread.Message ID: @.***>

pfetsch commented 1 year ago

Indeed, I get the above message. It comes from a call from SCIP. I just call ClpSimplex::barrier(true) and then ClpSimplex::getBasics().

pfetsch commented 1 year ago

Example code:

#include <stdlib.h>
#include <ClpSimplex.hpp>
#include <ClpConfig.h>

int main(int argc, char** argv)
{
   ClpSimplex* clp = new ClpSimplex();

   clp->readMps("flugpl.mps");
   clp->setLogLevel(2);
   clp->barrier(true);

   int nrows = clp->numberRows();
   int* idx = (int*) malloc(nrows * sizeof(int));
   clp->getBasics(idx);

   delete clp;

   return 0;
}
jjhforrest commented 1 year ago

clp->dual() would also give same error. clp->dual(0,1) where 1 is the value given to startFinishOptions is needed for dual. barrier does not have the option to pass in startFinishOptions. I should say did not have the option. I have just checked in modifications (master) to allow that.

Inform me if the modifications don't work for you.

pfetsch commented 1 year ago

Yes it works very well, thank you!