[Cbc] Detecting presolve infeasible/unbounded
Dr.-Ing. Christoph Cullmann
cullmann at absint.com
Mon Dec 11 06:49:12 EST 2017
Hi,
I try to use a driver6.cpp like solver driver, e.g. like:
<snip>
// Pass to Cbc initialize defaults
CbcModel modelA(solver1);
modelA.passInMessageHandler (&messageHandler);
CbcModel * model = &modelA;
CbcMain0(modelA);
/* Now go into code for standalone solver
Could copy arguments and add -quit at end to be safe
but this will do
*/
const char * argv2[]={"clpsolve","-solve","-quit"};
CbcMain1(2,argv2,modelA);
// Solver was cloned so get current copy
OsiSolverInterface * solver = model->solver();
// Print solution if finished (could get from model->bestSolution() as well
if (model->isProvenOptimal()) {
// Good
} else if (model->isProvenDualInfeasible() || model->isContinuousUnbounded()){
handleNoResult (*solver, "This problem is unbounded", Ur::MessageNumber::ILPSolving::InfeasibleOrUnboundedProblem);
return true;
} else if (model->isProvenInfeasible()) {
handleNoResult (*solver, "This problem is infeasible", Ur::MessageNumber::ILPSolving::InfeasibleOrUnboundedProblem);
return true;
} else {
// some error
Ur::printf (Ur::Error, "No optimal solution found, solving failed.");
return false;
}
</snip>
But I fail to detect unbounded as seen in presolve by CglPreProcess.cpp
if (!startModel2->isProvenOptimal()) {
if (!startModel2->isProvenDualInfeasible()) {
handler_->message(CGL_INFEASIBLE,messages_)<< CoinMessageEol ;
#if CBC_USEFUL_PRINTING>1
startModel2->writeMps("infeas");
#endif
} else {
handler_->message(CGL_UNBOUNDED,messages_)<< CoinMessageEol ;
}
return NULL;
}
Is there a way to get that?
Would it be save to catch the message numbers CGL_INFEASIBLE/CGL_UNBOUNDED in the message handler I pass to modelA?
I can do some unbounded or infeasible based on status == 0 && secondaryStatus == 1 but that would be too imprecise for my
needs.
Greetings
Christoph
--
----------------------------- Dr.-Ing. Christoph Cullmann ---------
AbsInt Angewandte Informatik GmbH Email: cullmann at AbsInt.com
Science Park 1 Tel: +49-681-38360-22
66123 Saarbrücken Fax: +49-681-38360-20
GERMANY WWW: http://www.AbsInt.com
--------------------------------------------------------------------
Geschäftsführung: Dr.-Ing. Christian Ferdinand
Eingetragen im Handelsregister des Amtsgerichts Saarbrücken, HRB 11234
More information about the Cbc
mailing list