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

James Gibbons James.Gibbons at nottingham.ac.uk
Tue Mar 28 08:46:32 EST 2006


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.





More information about the Coin-discuss mailing list