[Cbc-tickets] [COIN-OR Branch-and-Cut MIP Solver] #120: Crash in presolve
COIN-OR Branch-and-Cut MIP Solver
coin-trac at coin-or.org
Tue Dec 6 12:48:50 EST 2011
#120: Crash in presolve
-------------------+--------------------------------------------------------
Reporter: falk | Owner: tkr
Type: defect | Status: new
Priority: major | Component: Cbc
Version: trunk | Keywords:
-------------------+--------------------------------------------------------
with current SVN, I see crashes in presolve. Here is an example:
{{{
#include <coin/OsiClpSolverInterface.hpp>
#include <coin/CbcModel.hpp>
#include <coin/CbcStrategy.hpp>
int main() {
OsiClpSolverInterface clp;
for (int i = 0; i < 3; i++) {
clp.addCol(0, NULL, NULL, 0.0, 1.0, 1.0);
clp.setInteger(i);
}
int indices1[2] = {1, 2};
double values1[2] = {1.0, 1.0 };
clp.addRow(2, indices1, values1, 1.0, COIN_DBL_MAX);
int indices2[2] = {0, 2};
double values2[2] = {1.0, 1.0, };
clp.addRow(2, indices2, values2, 1.0, COIN_DBL_MAX);
int indices3[2] = {0, 1};
double values3[2] = {1.0, 1.0, };
clp.addRow(2, indices3, values3, 1.0, COIN_DBL_MAX);
CbcModel model(clp);
CbcStrategyDefault strategy;
strategy.setupPreProcessing(1);
model.setStrategy(strategy);
model.initialSolve();
model.branchAndBound();
return 0;
}
}}}
{{{
falk at baltrum:/tmp% g++ test2.cc -I/home/falk/opt/cbc/include
-L/home/falk/opt/cbc/lib -lpthread -lCbcSolver -lCbc -lCgl -lClp
-lCoinUtils -lOsiClp -lOsi -lz -lrt -lbz2 && ./a.out
Coin0506I Presolve 3 (0) rows, 3 (0) columns and 6 (0) elements
Clp0006I 0 Obj 0 Primal inf 2.9999997 (3)
Clp0006I 3 Obj 1.5
Clp0000I Optimal - objective value 1.5
Clp0032I Optimal objective 1.5 - 3 iterations time 0.002
Clp0000I Optimal - objective value 1.5
Clp0006I 0 Obj 1.5
Clp0006I 0 Obj 1.5
Clp0000I Optimal - objective value 1.5
Clp0006I 0 Obj 1.5 Primal inf 0.4999999 (1) Dual inf 3e+08 (3)
Clp0029I End of values pass after 3 iterations
Clp0006I 3 Obj 2
Clp0006I 3 Obj 2
Clp0000I Optimal - objective value 2
zsh: segmentation fault ./a.out
}}}
valgrind shows the following problem:
{{{
==27977== Invalid read of size 4
==27977== at 0x5D2EBA8:
CoinPackedMatrix::CoinPackedMatrix(CoinPackedMatrix const&, int, int,
bool) (in /home/falk/opt/cbc-2.7/lib/libCoinUtils.so.0.0.0)
==27977== by 0x56D12F4:
CglProbing::gutsOfGenerateCuts(OsiSolverInterface const&, OsiCuts&,
double*, double*, double*, double*, CglTreeInfo*) const
(CglProbing.cpp:2040)
==27977== by 0x56D4C24:
CglProbing::generateCutsAndModify(OsiSolverInterface const&, OsiCuts&,
CglTreeInfo*) (CglProbing.cpp:1357)
==27977== by 0x56A3754: CglPreProcess::modified(OsiSolverInterface*,
bool, int&, int, int) (CglPreProcess.cpp:3916)
==27977== by 0x56AA559:
CglPreProcess::preProcessNonDefault(OsiSolverInterface&, int, int, int)
(CglPreProcess.cpp:2356)
==27977== by 0x5111AF7: CbcStrategyDefault::setupOther(CbcModel&)
(CbcStrategy.cpp:521)
==27977== by 0x50F8198: CbcModel::branchAndBound(int) (in
/home/falk/opt/cbc-2.7/lib/libCbc.so.0.0.0)
==27977== by 0x400F1F: main (cbc-crash2.cc:29)
==27977== Address 0x7b640c4 is 4 bytes after a block of size 0 alloc'd
==27977== at 0x4C26CF7: operator new[](unsigned long) (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27977== by 0x5D2E93C:
CoinPackedMatrix::CoinPackedMatrix(CoinPackedMatrix const&, int, int,
bool) (in /home/falk/opt/cbc-2.7/lib/libCoinUtils.so.0.0.0)
==27977== by 0x56D12F4:
CglProbing::gutsOfGenerateCuts(OsiSolverInterface const&, OsiCuts&,
double*, double*, double*, double*, CglTreeInfo*) const
(CglProbing.cpp:2040)
==27977== by 0x56D4C24:
CglProbing::generateCutsAndModify(OsiSolverInterface const&, OsiCuts&,
CglTreeInfo*) (CglProbing.cpp:1357)
==27977== by 0x56A3754: CglPreProcess::modified(OsiSolverInterface*,
bool, int&, int, int) (CglPreProcess.cpp:3916)
==27977== by 0x56AA559:
CglPreProcess::preProcessNonDefault(OsiSolverInterface&, int, int, int)
(CglPreProcess.cpp:2356)
==27977== by 0x5111AF7: CbcStrategyDefault::setupOther(CbcModel&)
(CbcStrategy.cpp:521)
==27977== by 0x50F8198: CbcModel::branchAndBound(int) (in
/home/falk/opt/cbc-2.7/lib/libCbc.so.0.0.0)
==27977== by 0x400F1F: main (cbc-crash2.cc:29)
==27977==
}}}
Maybe there is a problem with the matrix becoming zero-sized.
--
Ticket URL: <https://projects.coin-or.org/Cbc/ticket/120>
COIN-OR Branch-and-Cut MIP Solver <http://projects.coin-or.org/Cbc>
An LP-based branch-and-cut MIP solver.
More information about the Cbc-tickets
mailing list