[Coin-SMI] Smi unitTest crashes
Francois Margot
fmargot at andrew.cmu.edu
Fri Mar 11 09:22:58 EST 2005
Hi:
Note that the information on the coin-smi mailing list does not appear on the
main page at:
http://www.coin-or.org/mail.html
It only appears on:
http://list.coin-or.org/mailman/listinfo/
The following is a repost of the message I sent to coin-discuss yesterday.
All COIN and Smi code are compiled with -g, lapack, and blas installed.
The unitTest of Smi fails on an assert related to upper bounds on variables.
This comes from the fact that ClpModel::gutsOfLoadModel readjusts the upper
bounds to COIN_DBL_MAX when the upper bound is > 1e27. In the unitTest
code, infinity is set to 1e31 and the assert fails since the expected
value of the upper bound is 1e31 when it is COIN_DBL_MAX.
The easiest way to fix this is to set INF = 1e25 in Smi/unitTest.cpp
(Note that INF is defined at two places in Smi/UnitTest.cpp).
After this change, the program still crashes on line 820 (initialSolve()).
I could not figure out why, but valgrind detects an error in CoinMpsIO.
The allocation of hash_ (in startHash()) is done with a new and the memory
is freed with a free() instead of a delete in releaseRedundantInformation().
Also, the destructor in SmiScnModel.cpp does not free memory correctly:
several delete must be replace by delete[] to get:
SmiScnModel::~SmiScnModel()
{
delete osiStoch_;
if (core_)
delete core_;
if (drlo_)
delete[] drlo_;
if (drup_)
delete[] drup_;
if (dclo_)
delete[] dclo_;
if (dcup_)
delete[] dcup_;
if (dobj_)
delete[] dobj_;
if (matrix_)
delete matrix_;
Even after correcting all the above, it still crashes. The first
error detected by valgrind is:
==28062== Invalid write of size 4
==28062== at 0xD558C6: ClpNonLinearCost::ClpNonLinearCost(ClpSimplex*)
(ClpNo
nLinearCost.cpp:108)
==28062== by 0xDBBAA3: ClpSimplex::startup(int, int)
(ClpSimplex.cpp:5622)
==28062== by 0xDD6081: ClpSimplexPrimal::primal(int, int)
(ClpSimplexPrimal.c
pp:191)
==28062== by 0xDB3DB5: ClpSimplex::primal(int, int) (ClpSimplex.cpp:3632)
==28062== by 0x647A85: OsiClpSolverInterface::initialSolve()
(OsiClpSolverInt
erface.cpp:169)
==28062== by 0x8054059: SmiScnModelScenarioUnitTest() (unitTest.cpp:820)
==28062== by 0x8055797: main (unitTest.cpp:1467)
==28062== by 0x674BFB: __libc_start_main (in /lib/libc-2.3.2.so)
==28062== by 0x804D730: (within
/home/fmargot/COIN/Smi/Test/Linux-g/unitTest)
==28062== Address 0x49085FC is 0 bytes after a block of size 300504
alloc'd
==28062== at 0x507886: __builtin_vec_new (vg_replace_malloc.c:203)
==28062== by 0x5078DD: operator new[](unsigned) (vg_replace_malloc.c:216)
==28062== by 0xD5580D: ClpNonLinearCost::ClpNonLinearCost(ClpSimplex*)
(ClpNo
nLinearCost.cpp:96)
==28062== by 0xDBBAA3: ClpSimplex::startup(int, int)
(ClpSimplex.cpp:5622)
==28062== by 0xDD6081: ClpSimplexPrimal::primal(int, int)
(ClpSimplexPrimal.c
pp:191)
==28062== by 0xDB3DB5: ClpSimplex::primal(int, int) (ClpSimplex.cpp:3632)
==28062== by 0x647A85: OsiClpSolverInterface::initialSolve()
(OsiClpSolverInt
erface.cpp:169)
==28062== by 0x8054059: SmiScnModelScenarioUnitTest() (unitTest.cpp:820)
==28062== by 0x8055797: main (unitTest.cpp:1467)
==28062== by 0x674BFB: __libc_start_main (in /lib/libc-2.3.2.so)
==28062== ==28062== Invalid write of size 4
I hope someone knowing a little bit more about Smi than I do can fix this.
Francois
More information about the Coin-SMI
mailing list