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

Andreas Gebauer andreas.gebauer at rwth-aachen.de
Wed Feb 13 23:49:16 MET 2013


Hi Ambros, Stefan and Gerald,
Thanks for your ideas.

I found another way which seems to be a little bit more complicated; but 
nevertheless, it works well.
A copy method helps to create and store a local copy of the problemdata 
before adding variables and constraints.
After SCIPfreeProb this copy is passed to the problem.
I think I will combine it with Stefan's ideas (especially using 
SCIPsetProbdata-method that I wasn't aware of)

Best regards,
Andreas

________________________________________________

Andreas Gebauer

andreas.gebauer at rwth-aachen.de
Rheinisch-Westfälische Technische Hochschule Aachen

Tel.: 0174-20 66686

Heiligenhauser Straße 32
40599 Düsseldorf
-----Ursprüngliche Nachricht----- 
From: Gerald Gamrath
Sent: Wednesday, February 13, 2013 10:13 PM
To: Stefan Heinz
Cc: Andreas.Gebauer at rwth-aachen.de ; scip at zib.de
Subject: Re: [Scip] how to free a problem preserving the problem data

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