<br><font size=2 face="sans-serif">James,</font>
<br>
<br><font size=2 face="sans-serif">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.</font>
<br>
<br><font size=2 face="sans-serif">John Forrest</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>"James Gibbons"
<James.Gibbons@nottingham.ac.uk></b> </font>
<br><font size=1 face="sans-serif">Sent by: coin-discuss-bounces@list.coin-or.org</font>
<p><font size=1 face="sans-serif">03/28/2006 08:46 AM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
Discussions about open source software for Operations Research
<coin-discuss@list.coin-or.org></font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif"><coin-discuss@list.coin-or.org></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">[Coin-discuss] Correct use of CglPreProcess
with CbcModel?</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><tt><font size=2>Hi,<br>
<br>
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,<br>
<br>
Thanks,<br>
James<br>
<br>
//code as follows<br>
<br>
solver0_(new OsiClpSolverInterface());<br>
solver0_->readLp(filename_.c_str(),1e-08);<br>
<br>
for(int i=0;i<numRuns;++i) {<br>
<br>
//LP solve function<br>
solver0_->intitalSolve();<br>
<br>
//Global solve function<br>
CglPreProcess pinfo1;<br>
OsiSolverInterface *solver1 = pinfo1.preProcess(*solver0_,false,15);<br>
CbcModel model(*solver1);<br>
<br>
//add cuts and heuristics to model<br>
<br>
model.branchAndBound();<br>
model.deleteObjects();
//is this necessary?<br>
pinfo1.postProcess(*model.solver());<br>
//delete solver1;
//causes crash
<br>
<br>
//my update matrix function<br>
updateMatrix();<br>
}<br>
<br>
delete solver0_;<br>
<br>
<br>
<br>
<br>
<br>
<br>
This message has been checked for viruses but the contents of an attachment<br>
may still contain software viruses, which could damage your computer system:<br>
you are advised to perform your own checks. Email communications with the<br>
University of Nottingham may be monitored as permitted by UK legislation.<br>
<br>
<br>
_______________________________________________<br>
Coin-discuss mailing list<br>
Coin-discuss@list.coin-or.org<br>
http://list.coin-or.org/mailman/listinfo/coin-discuss<br>
</font></tt>
<br>