Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertion fail in cbc #684

Open
jessehersch opened this issue Dec 16, 2024 · 4 comments
Open

assertion fail in cbc #684

jessehersch opened this issue Dec 16, 2024 · 4 comments

Comments

@jessehersch
Copy link

For a particular MPS file I am hitting this assertion fail in cbc, using 2.10.7 on ubuntu 22.04:

cbc: OsiClpSolverInterface.cpp:7521: void OsiClpSolverInterface::crunch(): Assertion `whichRow[i] >= -CoinMax(numberRows, numberColumns) && whichRow[i] < CoinMax(numberRows, numberColumns)' failed.

The mps file that provokes this is attached below:
fail.mps.txt

$ /usr/bin/cbc -import ~/fail.mps.txt -max -branch -timeMode elapsed -printingOptions all -solve -solution /tmp/fail.sol
Welcome to the CBC MILP Solver 
Version: 2.10.7 
Build Date: Feb 14 2022 

command line - /usr/bin/cbc -import /home/jhersch/fail.mps.txt -max -branch -timeMode elapsed -printingOptions all -solve -solution /tmp/fail.sol (default strategy 1)
At line 2 NAME          MODEL
At line 3 ROWS
At line 63 COLUMNS
At line 8660 RHS
At line 8719 BOUNDS
At line 9070 ENDATA
Problem MODEL has 58 rows, 350 columns and 7546 elements
Coin0008I MODEL read with 0 errors
Continuous objective value is 79.61 - 0.01 seconds
Cgl0003I 0 fixed, 0 tightened bounds, 5 strengthened rows, 0 substitutions
Cgl0004I processed model has 2 rows, 2 columns (2 integer (2 of which binary)) and 3 elements
Cutoff increment increased from 1e-05 to 0.00999
cbc: OsiClpSolverInterface.cpp:7521: void OsiClpSolverInterface::crunch(): Assertion `whichRow[i] >= -CoinMax(numberRows, numberColumns) && whichRow[i] < CoinMax(numberRows, numberColumns)' failed.
Aborted (core dumped)

I also tried setting the random seed, same result:

$ /usr/bin/cbc -import ~/fail.mps.txt -max -branch -timeMode elapsed -printingOptions all -randomSeed 242489 -randomCbcSeed 242489 -solve -solution /tmp/fail.sol
Welcome to the CBC MILP Solver 
Version: 2.10.7 
Build Date: Feb 14 2022 

command line - /usr/bin/cbc -import /home/jhersch/fail.mps.txt -max -branch -timeMode elapsed -printingOptions all -randomSeed 242489 -randomCbcSeed 242489 -solve -solution /tmp/fail.sol (default strategy 1)
At line 2 NAME          MODEL
At line 3 ROWS
At line 63 COLUMNS
At line 8660 RHS
At line 8719 BOUNDS
At line 9070 ENDATA
Problem MODEL has 58 rows, 350 columns and 7546 elements
Coin0008I MODEL read with 0 errors
Continuous objective value is 79.61 - 0.01 seconds
Cgl0003I 0 fixed, 0 tightened bounds, 5 strengthened rows, 0 substitutions
Cgl0004I processed model has 2 rows, 2 columns (2 integer (2 of which binary)) and 3 elements
Cutoff increment increased from 1e-05 to 0.00999
cbc: OsiClpSolverInterface.cpp:7521: void OsiClpSolverInterface::crunch(): Assertion `whichRow[i] >= -CoinMax(numberRows, numberColumns) && whichRow[i] < CoinMax(numberRows, numberColumns)' failed.
Aborted (core dumped)

I must assume that there is something invalid about the MPS file but I am not smart enough about CBC or the MPS format to know what it is! In any case I'd think that an appropriate error messages instead of an assertion fail would be wanted here. Assertions really should not happen even if the input is somehow bad right?

Thanks for looking!

@jjhforrest
Copy link
Contributor

Works in master - can reproduce error in stable. Will look at it.

@jessehersch
Copy link
Author

Thanks for the quick response! I have lots more example mps files that reproduce this if you need any.

@jessehersch
Copy link
Author

I just tried the x86_64-ubuntu22-gcc1140-static.tar.gz build from the tag here and it passed: https://github.com/coin-or/Cbc/releases/tag/releases%2F2.10.12

So this was probably fixed in the meantime, somewhere between 2.10.7 and 2.10.12. I was using an older version only for convenience of installing with apt-get. I'm sure I can figure out how to install from that tag download instead!

$ /home/jhersch/bin/cbc -import /home/jhersch/fail.mps.txt -max -branch -timeMode elapsed -printingOptions all -solve -solution /tmp/fail.sol
Welcome to the CBC MILP Solver 
Version: 2.10.12 
Build Date: Aug 20 2024 

command line - /home/jhersch/bin/cbc -import /home/jhersch/fail.mps.txt -max -branch -timeMode elapsed -printingOptions all -solve -solution /tmp/fail.sol (default strategy 1)
At line 2 NAME          MODEL
At line 3 ROWS
At line 63 COLUMNS
At line 8660 RHS
At line 8719 BOUNDS
At line 9070 ENDATA
Problem MODEL has 58 rows, 350 columns and 7546 elements
Coin0008I MODEL read with 0 errors
Continuous objective value is 79.61 - 0.00 seconds
Cgl0003I 0 fixed, 0 tightened bounds, 5 strengthened rows, 0 substitutions
Cgl0004I processed model has 2 rows, 2 columns (2 integer (2 of which binary)) and 3 elements
Cutoff increment increased from 1e-05 to 0.00999
Cbc0038I Initial state - 0 integers unsatisfied sum - 0
Cbc0038I Solution found of 79.61
Cbc0038I Before mini branch and bound, 2 integers at bound fixed and 0 continuous
Cbc0038I Mini branch and bound did not improve solution (0.01 seconds)
Cbc0038I After 0.01 seconds - Feasibility pump exiting with objective of 79.61 - took 0.00 seconds
Cbc0012I Integer solution of 79.61 found by feasibility pump after 0 iterations and 0 nodes (0.01 seconds)
Cbc0001I Search completed - best objective 79.61, took 0 iterations and 0 nodes (0.01 seconds)
Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost
Cuts at root node changed objective from 79.61 to 79.61
Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)

Result - Optimal solution found

Objective value:                79.61000000
Enumerated nodes:               0
Total iterations:               0
Time (CPU seconds):             0.01
Time (Wallclock seconds):       0.01

Option for timeMode changed from cpu to elapsed
Option for printingOptions changed from normal to all
Continuous objective value is 79.61 - 0.00 seconds
Cbc0006I The LP relaxation is infeasible or too expensive
Cbc0045I Solution of 79.61 already found by heuristic
Cuts at root node changed objective from -1.79769e+308 to 1.79769e+308
Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)

Result - Optimal solution found

Objective value:                79.61000000
Enumerated nodes:               0
Total iterations:               0
Time (CPU seconds):             0.00
Time (Wallclock seconds):       0.01

Total time (CPU seconds):       0.03   (Wallclock seconds):       0.03

@jjhforrest
Copy link
Contributor

There was an error in the assert code. This had been fixed in master so I have copied that to stable. Just added

  •  if (i>=small->getNumRows()&&i<numberRows)
    
  • continue; // row was removed so doesn't matter

before assert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants