coin-or / Bonmin

Basic Open-source Nonlinear Mixed INteger programming
https://coin-or.github.io/Bonmin
Eclipse Public License 1.0
121 stars 22 forks source link

B-iFP throws on simple example #36

Closed jschueller closed 1 year ago

jschueller commented 1 year ago

similar to with #31 ifp throws on the simple example with a backtrace similar to: (replace BB with iFP in examples/CppExample/MyBonmin.cpp)

Breakpoint 1, 0x00007ffff624b4d0 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) bt
#0  0x00007ffff624b4d0 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00007ffff417ddbf in ?? () from /lib/x86_64-linux-gnu/libbonmin.so.4
#2  0x00007ffff41cce84 in Bonmin::OsiTMINLPInterface::resolveForRobustness(int) () from /lib/x86_64-linux-gnu/libbonmin.so.4
#3  0x00007ffff41d643c in Bonmin::OsiTMINLPInterface::initialSolve(char const*) () from /lib/x86_64-linux-gnu/libbonmin.so.4
#4  0x00007ffff41ba11d in Bonmin::MinlpFeasPump::performOa(OsiCuts&, Bonmin::OaDecompositionBase::solverManip&, Bonmin::BabInfo*, double&, CglTreeInfo const&) const ()
   from /lib/x86_64-linux-gnu/libbonmin.so.4
#5  0x00007ffff41b0052 in Bonmin::OaDecompositionBase::generateCuts(OsiSolverInterface const&, OsiCuts&, CglTreeInfo) () from /lib/x86_64-linux-gnu/libbonmin.so.4
#6  0x00007ffff3d86045 in CbcCutGenerator::generateCuts(OsiCuts&, int, OsiSolverInterface*, CbcNode*) () from /lib/x86_64-linux-gnu/libCbc.so.3
#7  0x00007ffff3de17a6 in CbcModel::serialCuts(OsiCuts&, CbcNode*, OsiCuts&, int) () from /lib/x86_64-linux-gnu/libCbc.so.3
#8  0x00007ffff3de38d8 in CbcModel::solveWithCuts(OsiCuts&, int, CbcNode*) () from /lib/x86_64-linux-gnu/libCbc.so.3
#9  0x00007ffff3dd1d96 in CbcModel::branchAndBound(int) () from /lib/x86_64-linux-gnu/libCbc.so.3
#10 0x00007ffff418a9f5 in Bonmin::Bab::branchAndBound(Bonmin::BabSetupBase&) () from /lib/x86_64-linux-gnu/libbonmin.so.4
#11 0x00007ffff7238409 in OT::Bonmin::run (this=0x7fffffffd4a0) at /home/schueller/projects/openturns/schueller/lib/src/Base/Optim/Bonmin.cxx:169
#12 0x000055555555d112 in main () at /home/schueller/projects/openturns/schueller/lib/test/t_Bonmin_std.cxx:118

this time the MinlpFeasPump class has no generateCuts method at all (Bonmin::OaDecompositionBase::generateCuts is called), is this allowed ? cc @svigerske @pobonomo

pobonomo commented 1 year ago

Now a real Bonmin developper would be needed :scream:

What you point looks correct as far as I can remember and I can see from the trace. There is a specific method for OA for the Feasibility pump that is called. Then something goes wrong when solving an NLP.

pobonomo commented 1 year ago

I tried to run it but didn't get that error. On the other hand there's an infinite loop with a quite trivially wrong update to cutoff in iFP.

After fixing it, it's still an infinite loop... but that is numerical and iFP is a bit dangerous. The parameter cutoff_decr should be set to a larger value for this case (1e-4 works).

svigerske commented 1 year ago

@pobonomo Sorry I thought you had left. Great to see that "a real Bonmin developer" is still around :).

@jschueller I cannot reproduce this either, neither with Bonmin 1.8.8, nor stable/1.8, nor current master. You could increase some print or log levels to see why the NLP solve failed. (Maybe your Ipopt isn't working?) A number of ouput options are listed at https://coin-or.github.io/Bonmin/options_list.html
Setting option nlp_failure_behavior could also help to get around this exception (though iFP may then just terminate).

I can confirm the infinite loop that @pobonomo observed, and that the patch from #37 helps to get into a different (nicer looking) infinite loop, and that setting a cutoff_decr helps to get around that.

jschueller commented 1 year ago

yes, that works, thanks a lot