[Scip] Using ObjVardata::scip_copy()

michael.winkler@zib.de michael.winkler at zib.de
Mon Oct 11 22:22:35 MEST 2010


Hi,

that was a bug and should now be fixed. I added a new version of
objvardata.cpp with which you should replace your old one in the
src/objscip/ directory. Now you shouldn't need to copy your vardata, if
you don't want too.

Why is it that the RENS heuristic can't use the vardata?, Is it because
your plugin doesn't get copied to? If you copy your plugin than probably
inside the rens heuristic your copied plugin inside the copied SCIP can
use your copied vardata.

If you implemented a scip_copy() method and set the "deleteobject" boolean
to false( it means that you will do the deletion yourself ) you should
also implement a scip_delorig() method (probably a scip_deltrans() method
too) which deletes the copied/created vardata objects, because the
"deleteobject" boolean is copied too from the original SCIP_VARDATA to the
copy. Otherwise you get the memory leak.

I hope that makes it a little bit clearer ;).


Best, Michael


> 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
>
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> http://listserv.zib.de/mailman/listinfo/scip
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: objvardata.cpp
Type: text/x-c++src
Size: 6986 bytes
Desc: not available
Url : http://listserv.zib.de/mailman/private/scip/attachments/20101011/f9642315/objvardata.bin


More information about the Scip mailing list