coin-or / python-mip

Python-MIP: collection of Python tools for the modeling and solution of Mixed-Integer Linear programs
Eclipse Public License 2.0
518 stars 92 forks source link

Crash in Cbc with SOS2 and MIP start #160

Closed rschwarz closed 2 years ago

rschwarz commented 3 years ago

I create a MIP model, including a SOS2 set and provide a MIP start on a subset of variables. During solve, there is an error in Cbc.

With the Cbc that is shipped with python-mip, I get:

Cbc0045I MIPStart provided solution with cost 14
Cbc0012I Integer solution of 14 found by Reduced search after 0 iterations and 0 nodes (0.00 seconds)
corrupted size vs. prev_size
ERROR while running Cbc. Signal SIGABRT caught. Getting stack trace.

If I use Cbc built with debug mode instead, I get:

Cbc0045I MIPStart provided solution with cost 14
Illegal index 30 in OsiClpSolverInterface::setColUpper
Cbc_solve ERROR: OsiClpSolverInterface::setColUpper, Illegal index

I've created a gist with all files needed to recreate the issue as well as recorded outputs. In particular, see run.py. That gist also has some comments on what I think went wrong.

I thought that the issue lies within Cbc, not the python-mip wrapper, but I was unable to recreate the issue using Cbc from the command-line (reading problem and MIP start from files).

Versions:

sebheger commented 2 years ago

@rschwarz With version 1.13.0 I could not reproduce your behavior. Could you please confirm?

rschwarz commented 2 years ago

I tried again with mip-1.13 and observed conflicting behavior: When I ran the script the first time, it crashed again. When I repeated the call to capture the log output, it did not crash. I had to try 4 more times to see the crash, so it seems that the behavior is not deterministic?! (See OK and crash for the two cases.)

What I found curious is that at the top of the log, it still says:

Python:  3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110]
mip:     1.13.0
[...]
Welcome to the CBC MILP Solver 
Version: devel 
Build Date: Nov 15 2020 

So the Cbc build date is the same between mip versions 1.12 and 1.13? That doesn't seem to be right.

rschwarz commented 2 years ago

I tried this again using version 1.14 (with a lot of runs) and was not able to reproduce the crash, so I'm closing as fixed (probably because of updated Cbc).