[Coin-lpsolver] problem in addRow of OsiClp
John J Forrest
jjforre at us.ibm.com
Thu Aug 2 05:46:07 EDT 2007
Anureet,
To fix a different error freeCachedResults was moved down code in addRow(s)
which then exposed the error you found. I have split the code into two so
it should be OK now.
John
Anureet Saxena
<anureet at yahoo.co
m> To
Sent by: coin-lpsolver at list.coin-or.org,
coin-lpsolver-bou anureet at yahoo.com, John J
nces at list.coin-or Forrest/Watson/IBM at IBMUS
.org cc
Subject
08/02/2007 01:32 [Coin-lpsolver] problem in addRow
AM of OsiClp
hi,
I am using the trunk version of OsiClp and valgrind reports a bug on the
following code. The valgrind error is attached at the end. No such bug is
reported when the same code is compiled and run with the stable version of
Osi obtained via the stable version of Cgl; this suggests the problem
originates somewhere in the recently modified trunk version of the code.
I will greatly appreciate if someone could help me fix this.
regards & thanks,
anureet
PS: I will be more than happy to use the stable version of the code, except
that some of the COIN-OR code I am using (cbc bonmin etc) depends on the
trunk version of OsiClp.
/*******************************************************************************/
#include "OsiClpSolverInterface.hpp"
#include "CoinPackedVector.hpp"
int main()
{
OsiSolverInterface * si = new OsiClpSolverInterface();
si->readMps("p0033.mps");
const char* rsense=si->getRowSense();
int mx_nci=3;
int* ci=new int[mx_nci];
double* el=new double[mx_nci];
int nci;
nci=0;
ci[nci]=0; el[nci]=16; nci++;
ci[nci]=1; el[nci]=16; nci++;
ci[nci]=2; el[nci]=10; nci++;
CoinPackedVector* vec=new CoinPackedVector(nci, ci,el, false);
si->addRow(*vec, -si->getInfinity(), 11);
}
/*******************************************************************************/
Valgrind report:
Invalid write of size 8
at 0x45CBB6: OsiSolverInterface::convertBoundToSense(double, double,
char&, double&, double&) const (OsiSolverInterface.hpp:1788)
by 0x7514C4: OsiClpSolverInterface::setRowBounds(int, double, double)
(OsiClpSolverInterface.cpp:3801)
by 0x75C674: OsiClpSolverInterface::addRow(CoinPackedVectorBase const&,
double, double) (OsiClpSolverInterface.cpp:2158)
by 0x405550: main (BonLgp.cpp:20)
Address 0x4F06378 is 0 bytes after a block of size 128 alloc'd
at 0x4A05E45: operator new[](unsigned long) (vg_replace_malloc.c:199)
by 0x748973: OsiClpSolverInterface::extractSenseRhsRange() const
(OsiClpSolverInterface.cpp:3149)
by 0x748AD6: OsiClpSolverInterface::getRowSense() const
(OsiClpSolverInterface.cpp:1749)
by 0x4053F3: main (main.cpp:8)
Anureet Saxena
anureet at cmu.edu
anureet at yahoo.com
--This mail was delivered to you on 100% recyclable electrons.
Looking for a deal? Find great prices on flights and hotels with Yahoo!
FareChase._______________________________________________
Coin-lpsolver mailing list
Coin-lpsolver at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/coin-lpsolver
More information about the Clp
mailing list