[Scip] reduce cost in plugin INIT

Gregor Hendel hendel at zib.de
Tue Oct 21 10:36:17 CEST 2014


Dear He

There exists another callback to invoke special behavior for sub-SCIPs, 
namely the NODESELCOPY callback.

I see two options for you: The easy option is to disable the node 
selector completely inside the sub-SCIPs and resort to one of the 
default node selectors. This is achieved by setting the copy callback to 
NULL.

Unfortunately, it is not possible to communicate with the main SCIP data 
structures in this callback, so that
I would advise you to use some static global nodeselector data pointer 
instead, which you initially set to NULL.

Inside the include callback of your node selector, you check if the 
global data is set to NULL, and if so,
allocate memory for it at the moment you do it now. Whenever a sub-SCIP 
tries to include your node selector as well,
you can simply let it point to the same data as the main node selector does.

For being able to correctly free the global data, you could try to count 
the number of node selectors that currently point to
this data, and increase/decrease it correctly whenever you are now 
freeing your data, but only free it when the usage counter reaches zero.

For this second suggestion, you need to modify only the your include- 
and free callbacks, or possibly init/exit, depending on where you 
initialize your data data structures right now. The copy callback can be 
left as is, see for yourself in one of the other node selectors of SCIP.

The whole business becomes slightly more involved if your node selector 
not only reads, but only modifies the data when time is evolving, in 
which case you indeed have to copy the data from the global data 
structure into a local data structure.

Kind regards,
Gregor





Am 20.10.2014 um 01:23 schrieb 何河:
> Dear all,
>
> From the documentation:
> The NODESELINIT callback is executed after the problem was 
> transformed. The node selector may, e.g., use this call to initialize 
> his node selector data.
>
> If the INIT is costly, e.g. including file reading, is there a way to 
> just do it once at the beginning and simply copy the values read? In 
> my case, it's called many times after the plugin is copied to solve a 
> sub-SCIP process and the same file is read repeatedly. Any suggestion 
> is appreciated. Thanks!!
>
> He
>
>
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> http://listserv.zib.de/mailman/listinfo/scip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.zib.de/pipermail/scip/attachments/20141021/781a7313/attachment.html>


More information about the Scip mailing list