[Scip] Using ObjVardata::scip_copy()

Matthias Peinhardt matthias.peinhardt at ovgu.de
Mon Oct 11 15:25:25 MEST 2010


Dear SCIPpers,

I am uncertain how to use the newly introduced ObjVardata::scip_copy().

In my code, I derive a class from ObjVardata, say MyObjVardata, for storing 
variable information. I thought that I don't need to implement scip_copy(), 
as the subscip that copies the data, in my case the Rens heuristic, can not 
use this data anyway. However, this triggered an assert():
src/scip/var.c:2002: SCIPvarCopy: Assertion `targetdata == ((void *)0) || 
result == SCIP_SUCCESS' failed.
So something is copied, as targetdata is not 0?

So I implemented this method by copying the data, like

SCIP_RETCODE MyObjVardata::scip_copy(...) {
	MyObjVardata* p = new MyObjVardata(*this);
	*objvardata = p;

	(*result) = SCIP_SUCCESS;

	return SCIP_OKAY;
}

But then I leak memory as the copied data is never freed.

So, how do I use that mechanism correctly?

Regards,
Matthias

-- 
Matthias Peinhardt
Otto-von-Guericke University
Faculty of Mathematics
Institute for Mathematical Optimization (IMO)
Universitätsplatz 2
D-39106 Magdeburg
===================================================
office: building 02 - room 208
mail: matthias.peinhardt at ovgu.de
fon: +49 391 67 11601
fax: +49 391 67 11171



More information about the Scip mailing list