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

Stefan Heinz heinz at zib.de
Fri Feb 15 16:49:10 MET 2013


Hi Andreas,

that is correct.

Best Stefan

On 02/15/2013 03:20 PM, Andreas Gebauer wrote:
> Hi Stefan,
>
> I tried your suggestions but they did not work since SCIPfreeProb(scip) shifts scip to SCIP_STAGE_INIT but SCIPsetProbdata(scip,probdata) is only callable from SCIP_STAGE_PROBLEM and upwards.
> I guess it is necessary - and actually working - to replace SCIPsetProbdata(scip,probdata) by
>
> SCIPcreateProb(scip, probname, probdelorigBaggagerouting, probtransBaggagerouting, probdeltransBaggagerouting, probinitsolBaggagerouting, probexitsolBaggagerouting, probcopyBaggagerouting, probdata);
>
> Best regards,
> Andreas
>
> Am 02/13/13, schrieb Stefan Heinz  <heinz at zib.de>:
>
>> 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