[Coin-lpsolver] problem in addRow of OsiClp

Anureet Saxena anureet at yahoo.com
Thu Aug 2 01:32:43 EDT 2007


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/clp/attachments/20070801/113d503d/attachment.html>


More information about the Clp mailing list