[Coin-discuss] Correct use of CglPreProcess with CbcModel?

John J Forrest jjforre at us.ibm.com
Tue Mar 28 11:31:52 EST 2006


James,

Try the second way of using CglPreProcess as given in sample2.cpp.  This 
uses CbcStrategy and passes that in to Cbcmodel.  So CbcModel handles 
copies of solvers.  If that has a memory leak tell me and I will fix.

John Forrest



"James Gibbons" <James.Gibbons at nottingham.ac.uk> 
Sent by: coin-discuss-bounces at list.coin-or.org
03/28/2006 08:46 AM
Please respond to
Discussions about open source software for Operations Research 
<coin-discuss at list.coin-or.org>


To
<coin-discuss at list.coin-or.org>
cc

Subject
[Coin-discuss] Correct use of CglPreProcess with CbcModel?






Hi,

I'm having some problems using CglPreProcess and CbcModel together. My 
code involves modifying a matrix, solving and changing the many times. My 
code works but it leaks memory until eventually all memory is exhausted. 
The essentials of the code are at the end of this message (note though 
that in my application the LP solve and global solver are in different 
functions, and heuristics and cuts are used). To my naive eye it looks 
like I need to delete solver1 as preProcess returns a new solver instance, 
but this causes a crash. I'm happy to go about things in a different way 
if anyone can recommend an alternative. However, CglPreProcess does reduce 
the time to find a solution for me so I'd like to keep using it,

Thanks,
James

//code as follows

solver0_(new OsiClpSolverInterface());
solver0_->readLp(filename_.c_str(),1e-08);

for(int i=0;i<numRuns;++i) {

                 //LP solve function
                 solver0_->intitalSolve();
 
                 //Global solve function
                 CglPreProcess pinfo1;
                 OsiSolverInterface *solver1 = 
pinfo1.preProcess(*solver0_,false,15);
                 CbcModel model(*solver1);

                 //add cuts and heuristics to model

                 model.branchAndBound();
                 model.deleteObjects();          //is this necessary?
                 pinfo1.postProcess(*model.solver());
                 //delete solver1;               //causes crash   

                 //my update matrix function
                 updateMatrix();
}

delete solver0_;






This message has been checked for viruses but the contents of an 
attachment
may still contain software viruses, which could damage your computer 
system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.


_______________________________________________
Coin-discuss mailing list
Coin-discuss at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/coin-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/coin-discuss/attachments/20060328/3c0b8869/attachment.html>


More information about the Coin-discuss mailing list