Closed dguittet closed 1 year ago
I get this Ecp bug, it just throws (no actual crash), you can reproduce by replacing BB to Ecp in examples/CppExample/MyBonmin.cpp, any info @svigerske ?
Also, I have the same infinite loop problem in iFP.
If I run the CppExample with current master of Bonmin and all dependencies and B-BB changed to B-Ecp, I get an assertion failing in Cbc:
NLP0012I
Num Status Obj It time Location
NLP0014I 1 OPT -2.618034 13 0.025398 build initial OA
NLP0014I 2 OPT -2.5001414 19 0.03226 check integer sol.
OA0003I New best feasible of -2.5001414 found after 0.035328 sec and
CppExample: ../../src/CbcModel.cpp:8566: bool CbcModel::solveWithCuts(OsiCuts&, int, CbcNode*): Assertion `n == numberOldActiveCuts_' failed.
If I disable the assert, I get a segfault sometime later:
NLP0012I
Num Status Obj It time Location
NLP0014I 1 OPT -2.618034 13 0.023718 build initial OA
NLP0014I 2 OPT -2.5001414 19 0.033009 check integer sol.
OA0003I New best feasible of -2.5001414 found after 0.036085 sec and
../../src/CbcModel.cpp:11098:39: runtime error: load of null pointer of type 'struct CbcCountRowCut *'
Maybe that is something @jjhforrest would like to look into? It could be that Bonmin code would need to be adjusted to work with current Cbc.
The bonmin-ecp-crash.nl file seems to work fine with Bonmin/master for me. I haven't tried 1.8.8. Does the issue on CppExample look like it could be the same problem, though?
Correction: Also bonmin-ecp-crash.nl has a problem with Bonmin/master. I forgot to set B-Ecp. With that, I get
NLP0012I
Num Status Obj It time Location
NLP0014I 1 OPT 0 9 0.017563 build initial OA
../../../../src/Algorithms/OaGenerators/BonDummyHeuristic.hpp:28:28: runtime error: load of value 32, which is not a valid value for type 'bool'
../../src/ClpModelParameters.hpp:85:9: runtime error: null pointer passed as argument 2, which is declared to never be null
../../src/ClpModelParameters.hpp:85:9: runtime error: null pointer passed as argument 2, which is declared to never be null
NLP0014I 2 OPT 0 0 0 check integer sol.
OA0003I New best feasible of 0 found after 4e-06 sec and
bonmin-ecp-crash.nl unrecognized exception
bonmin-ecp-crash.nl Finished exception
terminate called after throwing an instance of 'int'
Apart from the santizer warnings, the exception is thrown from here:
#0 0x00007fffe22a5f91 in __cxxabiv1::__cxa_throw (obj=0x55555563a9d0,
tinfo=0x7fffe24286f8 <typeinfo for int>, dest=0x0)
at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_throw.cc:81
#1 0x00007ffff7823118 in Bonmin::EcpCuts::performOa (this=0x555555608b40, cs=..., lpManip=...,
babInfo=0x5555555fc890, cutoff=@0x7fffffffb760: 0, info=...)
at ../../../../src/Algorithms/OaGenerators/BonEcpCuts.hpp:75
#2 0x00007ffff7869d73 in Bonmin::OaDecompositionBase::generateCuts (this=0x555555608b40,
si=..., cs=..., info=...) at ../../../../src/Algorithms/OaGenerators/BonOaDecBase.cpp:320
#3 0x00007ffff59ef796 in CbcCutGenerator::generateCuts (this=0x555555608aa0, cs=...,
fullScan=2, solver=0x5555555e5f20, node=0x0) at ../../src/CbcCutGenerator.cpp:352
#4 0x00007ffff5f08fce in CbcModel::serialCuts (this=0x7fffffffdfb8, theseCuts=..., node=0x0,
slackCuts=..., lastNumberCuts=0) at ../../src/CbcModel.cpp:10780
#5 0x00007ffff5ed5ec6 in CbcModel::solveWithCuts (this=0x7fffffffdfb8, cuts=...,
numberTries=1, node=0x0) at ../../src/CbcModel.cpp:9252
#6 0x00007ffff5da3e8a in CbcModel::branchAndBound (this=0x7fffffffdfb8, doStatistics=0)
at ../../src/CbcModel.cpp:4004
#7 0x00007ffff76cce81 in Bonmin::Bab::branchAndBound (this=0x7fffffffdf80, s=...)
at ../../../src/CbcBonmin/BonCbc.cpp:525
#8 0x00007ffff76b906b in Bonmin::Bab::operator() (this=0x7fffffffdf80, s=...)
at ../../../src/CbcBonmin/BonCbc.cpp:100
#9 0x00005555555598c9 in main (argc=3, argv=0x7fffffffe668) at ../../../src/Apps/BonMin.cpp:56
Looks like the code went into some place it wasn't expected to go, or that hasn't been finished implementing. Maybe there is some additional parameter that can be set to get around that - I don't know.
I get the same with Bonmin 1.8.8.
Since I'm not aware of anyone still developing (or even maintaining) Bonmin, I doubt you will see a fix for this anytime soon. Just avoid B-Ecp.
I can fix the error when running modified CppExample code. That was to do with lazy constraints. These were being added before any normal cuts were generated and were not deleted, so bookkeeping was inaccurate. I can't see the fix doing any harm, so I will put it into Cbc/master soon.
bonmin-ecp-crash.nl also worked
Thank you. That fixed the CppExample, indeed.
bonmin-ecp-crash.nl still crashes, but you need to have a bonmin.opt with line bonmin.algorithm B-Ecp
to make this happen.
So I would leave this issue open, in case some Bonmin developer will magically appear out of nowhere some day and will be interested in fixing this.
so it needs at least this commit: https://github.com/coin-or/Cbc/commit/11e6a79d2b78b5236324fad897946effde4618e2
is there a new release of cbc planned this year ?
Thank you. That fixed the CppExample, indeed.
bonmin-ecp-crash.nl still crashes, but you need to have a bonmin.opt with line
bonmin.algorithm B-Ecp
to make this happen.So I would leave this issue open, in case some Bonmin developer will magically appear out of nowhere some day and will be interested in fixing this.
Sounds like a challenge :-) but yes I think it's unlikely...
It looks like the wrong function was called:
#0 0x00007fffe22a5f91 in __cxxabiv1::__cxa_throw (obj=0x55555563a9d0,
tinfo=0x7fffe24286f8 <typeinfo for int>, dest=0x0)
at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_throw.cc:81
#1 0x00007ffff7823118 in Bonmin::EcpCuts::performOa (this=0x555555608b40, cs=..., lpManip=...,
babInfo=0x5555555fc890, cutoff=@0x7fffffffb760: 0, info=...)
at ../../../../src/Algorithms/OaGenerators/BonEcpCuts.hpp:75
#2 0x00007ffff7869d73 in Bonmin::OaDecompositionBase::generateCuts (this=0x555555608b40,
si=..., cs=..., info=...) at ../../../../src/Algorithms/OaGenerators/BonOaDecBase.cpp:320
I think that Bonmin::OaDecompositionBase::generateCuts
should not be called but instead Bonmin::EcpCuts::generateCuts
. Not sure why is it... (it probably worked some day).
But yes, most probably is no Bonmin developer is available.
Well, glad to see you back! Thanks for the hint. That helps. :)
@svigerske Thanks for fixing it! Beautiful a Bonmin bug was fixed in 2023. You should get a prize for that :-)
Thanks for the fix!
BONMIN with algorithm "B-Ecp" has a hard crash on a simple test integer program, which I had pulled from a larger MINLP that was having the same hard crash. The other algorithms are able to handle this problem (well, except for iFP which gets stuck in a loop).
Log & Error message
``` dguittet@dguittet-34208s T % bonmin /var/folders/yh/xvlf1svn0xq6r2l4hzsggz2xt3qfdr/T/tmpz3rp9td1.pyomo.nl -AMPL tol=1e-6 bonmin.algorithm=B-Ecp Bonmin 1.8.8 using Cbc 2.10.4 and Ipopt 3.12.12 bonmin: tol=1e-6 bonmin.algorithm=B-Ecp ****************************************************************************** This program contains Ipopt, a library for large-scale nonlinear optimization. Ipopt is released as open source code under the Eclipse Public License (EPL). For more information visit http://projects.coin-or.org/Ipopt ****************************************************************************** NLP0012I Num Status Obj It time Location NLP0014I 1 OPT 0 8 0.002881 build initial OA /var/folders/yh/xvlf1svn0xq6r2l4hzsggz2xt3qfdr/T/tmpz3rp9td1.pyomo.nl unrecognized exception /var/folders/yh/xvlf1svn0xq6r2l4hzsggz2xt3qfdr/T/tmpz3rp9td1.pyomo.nl Finished exception libc++abi.dylib: terminating with uncaught exception of type int zsh: abort bonmin /var/folders/yh/xvlf1svn0xq6r2l4hzsggz2xt3qfdr/T/tmpz3rp9td1.pyomo.nl ```I've attached the .nl file bonmin-ecp-crash.nl.zip
And here's the Python code that generated that nl file:
``` from pyomo.environ import ConcreteModel, Var, Param, Constraint, Objective, SolverFactory, \ Binary, NonNegativeReals, Reals, RangeSet n = 1 m = ConcreteModel() m.horiz = RangeSet(0, n) m.horiz_init = RangeSet(-1, n) m.timestep = Param(domain=NonNegativeReals, mutable=False, default=60) m.inlet_temp = Var(m.horiz, domain=Reals, bounds=(-20, 20)) m.outlet_temp = Var(m.horiz, domain=Reals, bounds=(-20, 20)) m.is_charging = Var(m.horiz, domain=Binary) m.is_discharging = Var(m.horiz, domain=Binary) m.temp_diff_ub = Param(domain=NonNegativeReals, mutable=False, default=40) m.one = Param(domain=Binary, mutable=False, default=1) m.op_mode_complement = Constraint(m.horiz, rule=lambda m, i: m.is_charging[i] + m.is_discharging[i] == m.one) m.discharge_mode_calc = Constraint(m.horiz, rule=lambda m, i: m.outlet_temp[i] - m.inlet_temp[i] <= (m.one - m.is_discharging[i]) * m.temp_diff_ub) m.charge_mode_calc = Constraint(m.horiz, rule=lambda m, i: m.inlet_temp[i] - m.outlet_temp[i] <= (m.one - m.is_charging[i]) * m.temp_diff_ub) m.outlet_temp[0].fix(1) m.inlet_temp[0].fix(10) m.obj = Objective(expr=0) solver = SolverFactory("bonmin") solver.options['bonmin.algorithm'] = 'B-Ecp' solver.solve(m, tee=False) ```Any ideas what might be causing this unhandled exception?
I'm using Bonmin 1.8.8 with Cbc 2.10.4 and Ipopt 3.12.12 with HSL on OSX 10.15.7.
Thank you!