[Scip] how to free a problem preserving the problem data

Gerald Gamrath gamrath at zib.de
Wed Feb 13 22:13:34 MET 2013


Hi Stefan,

nice solution. :-)

Alternatively, you could also create the problem, i.e., variables and
constraints, not already in the original space, but in the probtrans
callback of the probdata. In this case, freeing the transformed problem
should remove the complete problem, but keep your probdata.

Best,
Gerald

On 13.02.2013 20:21, Stefan Heinz wrote:
> Hi Andreas,
>
> it is actually a little bit more complicated since SCIPfreeProb() also 
> calls the callback method of the probdata to free it. Therefore, I 
> suggested the following:
>
> First you collect the probdata pointer
> probdata = SCIPgetProbData(scip)
> http://scip.zib.de/doc/html/scip_8h.shtml#aa49ecadcab6a4085933352f7a7e0750e
>
> Then you set the probdata pointer within SCIP to NULL
> SCIPsetProbdata(scip, NULL)
> http://scip.zib.de/doc/html/scip_8h.shtml#ae3e190835aa7114e9557f3c44d6c0fbe
>
> Then you call the free method.
> SCIPfreeProb(scip)
> http://scip.zib.de/doc/html/scip_8h.shtml#a9c7bee6cab2932a89e63bfb62053d72b
>
> Now you place the probdata back.
> SCIPsetProbdata(scip, probdata)
> http://scip.zib.de/doc/html/scip_8h.shtml#ae3e190835aa7114e9557f3c44d6c0fbe
>
> After doing this all variables and constraints are deleted and you 
> probdata is still alive.
>
> Best Stefan
>
> On 02/12/2013 05:34 PM, Ambros Gleixner wrote:
>> Hi Andreas,
>>
>> I think what you need is SCIPfreeProb(), see
>>
>> http://scip.zib.de/doc/html/scip_8h.shtml#a9c7bee6cab2932a89e63bfb62053d72b
>>
>> Best regards,
>> Ambros
>>
>>
>> Am 12.02.2013 15:35, schrieb Andreas Gebauer:
>>> Hi all,
>>>
>>> I just wondered what the best way may be in order to free a SCIP problem completely (including variables and constraints) except for the problem data.
>>> We try to implement a rolling solution process with a rather extensive initialization (using some self-written readers) that feeds the ProbData.
>>> After reaching a (hopefully good) solution, we want to delete all variables and constraints (as they are too specific in order to use them in the next step) and free the solving process. After that, new variables and constraints are added using the problem data.
>>> SCIPfreeTransform does not delete variables and constraints while SCIPfree frees all ProbData.
>>> I've also experimented with SCIPcopy functionality as well as with copying probdata but I got nowhere.
>>>
>>> Thanks and best regards
>>> Andreas
>>> _______________________________________________
>>> Scip mailing list
>>> Scip at zib.de
>>> http://listserv.zib.de/mailman/listinfo/scip
>>>
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> http://listserv.zib.de/mailman/listinfo/scip



More information about the Scip mailing list