Open modosist opened 1 year ago
@modosist Thanks for fixing this bug. Would you please add the tests you posted to the code base?
@modosist Thanks for fixing this bug. Would you please add the tests you posted to the code base?
Sure, I will prepare some tests! Hopefully I will get to it within a week.
BTW: I found out that similar issue is also within Gurobi wrapper (although it is not related to relaxed models)
However, this one probably needs more discussion: should python-mip
also return UNBOUNDED_OR_INFEASIBLE status or should python-mip
check which of the outcomes actually holds? I do not know whether Gurobi has similar API to asking for primal formulation infeasibility, but their recommendation is to re-run the optimization with setting of specific parameter see here. Should I open an issue for this?
BTW: I found out that similar issue is also within Gurobi wrapper
Yes, and something related happens with the (WIP) HiGHS wrapper as well. The status codes from the solver and the mip
library don't map one-to-one, see https://github.com/coin-or/python-mip/blob/9082252dfc5cebfacc9dd170049c45ab7441660d/mip/highs.py#L1005-L1008
Might be closely related to this here https://github.com/coin-or/python-mip/issues/285
I added a few tests for the relaxed models. The tests will fail on Gurobi (and looking at code from @rschwarz , HiGHS should fail as well). I will address the remaining solvers in another issue.
Hi, thanks for the awesome work on the library! I believe that I found a small bug in handling of result from CBC relaxed models.
Current version of
python-mip
(tested version 1.15.0 on Apple M1) does not work correctly for the relaxations of following ILPsComparing the
python-mip
CBC solverhttps://github.com/coin-or/python-mip/blob/6044fc8f0414d71430e94b8a08573b695dc35b5a/mip/cbc.py#L1110-L1113
and actual
CBC
code forCbc_solveLinearProgram
https://github.com/coin-or/Cbc/blob/f3a8af7b627ac068853d847c67d05614dcd99d39/src/Attic/Cbc_C_Interface.cpp#L1753-L1761
I concluded that the status codes for infeasible and unbounded programs are swapped in the
python-mip
code. Moreover, looking at CBC code, I believe that status 3 fromCbc_solveLinearProgram
should be interpreted as primal formulation is either unbounded or infeasible (as dual infeasibility may lead primal to be either unbounded or infeasible); however, I could not find documentation for CBC on these status codes so I cannot be certain what the CBC developers meant by this status code. Therefore, I added a followup check for this status code to see whether the primal formulation is infeasible or unbounded.I never worked with CBC before so hopefully I did not miss some detail.