[Scip] Deleting variables

Gerald Gamrath gamrath at zib.de
Tue Apr 23 11:04:40 MEST 2013


Hi Jonas,

please add an if( prob->transformed ) before the call of
SCIPprobUpdateNObjVars(). This methods updates the counter for the
number of variables with nonzero objective coefficient, but this counter
is only used in the transformed problem.

Best,
Gerald


On 23.04.2013 10:48, Jonas Witt wrote:
> Hi Timo, Ambros and Gerald,
>
> I already called  SCIPfreeTransform() and the deleted flag of 
> SCIPdelVar() returns TRUE.
>
> I added the line
> SCIP_CALL( SCIPprobPerformVarDeletions(scip->origprob, 
> scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp, 
> scip->branchcand) );
> but then I got the following:
>
> gcg.linux.x86_64.gnu.dbg.spx: src/scip/prob.c:1480: 
> SCIPprobUpdateNObjVars: Assertion `prob->transformed' failed.
>
> Program received signal SIGABRT, Aborted.
> 0x00007ffff6b78425 in __GI_raise (sig=<optimized out>) at 
> ../nptl/sysdeps/unix/sysv/linux/raise.c:64
> 64    ../nptl/sysdeps/unix/sysv/linux/raise.c: Datei oder Verzeichnis 
> nicht gefunden.
> (gdb) bt
> #0  0x00007ffff6b78425 in __GI_raise (sig=<optimized out>) at 
> ../nptl/sysdeps/unix/sysv/linux/raise.c:64
> #1  0x00007ffff6b7bb8b in __GI_abort () at abort.c:91
> #2  0x00007ffff6b710ee in __assert_fail_base (fmt=<optimized out>, 
> assertion=0xc54a71 "prob->transformed", file=0xc53ce0 "src/scip/prob.c",
>      line=<optimized out>, function=<optimized out>) at assert.c:94
> #3  0x00007ffff6b71192 in __GI___assert_fail (assertion=0xc54a71 
> "prob->transformed", file=0xc53ce0 "src/scip/prob.c", line=1480,
>      function=0xc55080 "SCIPprobUpdateNObjVars") at assert.c:103
> #4  0x000000000081b044 in SCIPprobUpdateNObjVars (prob=0x252a3d0, 
> set=0x23bb720, oldobj=0, newobj=0) at src/scip/prob.c:1480
> #5  0x0000000000819e24 in SCIPprobPerformVarDeletions (prob=0x252a3d0, 
> blkmem=0x23b9700, set=0x23bb720, stat=0x2529970, eventqueue=0x0,
>      lp=0x0, branchcand=0x0) at src/scip/prob.c:1066
> #6  0x00000000008402dc in SCIPdelVar (scip=0x23b6770, var=0x6dd6498, 
> deleted=0x7fffffffba00) at src/scip/scip.c:8958
>
> Thanks for your help and best regards,
> Jonas
>
>
> Am 23.04.2013 10:28, schrieb Gerald Gamrath:
>> Hi all,
>>
>> I guess it is not fixed by calling SCIPfreeTranform(), because he wants
>> to delete original variables. With SCIPdelVar(), these variables are
>> marked for deletion, but the final deletion is never performed for the
>> original problem. We could think of adding an interface method that can
>> be used to trigger the deletion. For now, I would suggest the following:
>> In SCIPdelVar(), in case SCIP_STAGE_PROBLEM, please add the line
>> SCIP_CALL( SCIPprobPerformVarDeletions(scip->origprob,
>> scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp,
>> scip->branchcand) );
>> after the SCIPprobDelVar() call. Then, the marked variable should be
>> deleted immediately.
>>
>> Best,
>> Gerald
>>
>> On 23.04.2013 09:54, Ambros Gleixner wrote:
>>> Hi Jonas,
>>>
>>> deleting variables is only difficult during the solution process.  As I
>>> understand, you want to delete variables only after finishing one solve.
>>>    To do this, you have to call SCIPfreeTransform() to return to the
>>> problem creation stage.  Does this solve your problem?
>>>
>>> Best regards,
>>>
>>> Ambros
>>>
>>>
>>> Am 23.04.2013 08:53, schrieb Jonas Witt:
>>>> Hi all,
>>>>
>>>> I'm having problems with deleting variables. I know you list deleting
>>>> variables as a known bug on your website, but maybe you can still help me.
>>>>
>>>> I use a sub-SCIP and initialize it with some initial variables and
>>>> constraints. This should work as some kind of pattern. So everytime I
>>>> use this sub-SCIP, I want to add new variables and constraints to it,
>>>> solve it and then delete the recently added variables and constraints.
>>>> So after this solving proccess, the sub-SCIP should only consist of
>>>> initial variables and constraints.
>>>>
>>>> I delete the recently added constraints with SCIPdelCons(). After this
>>>> deletion the recently added variables do not belong to any constraint of
>>>> the problem. Then I tried to delete these variables via SCIPdelVar() but
>>>> failed (the variables still belong to the problem). It is important to
>>>> really delete these variables and not just fix them to zero.
>>>>
>>>> How can I use the sub-SCIP the way I have described it without copying
>>>> the whole problem?
>>>>
>>>> Best regards,
>>>> Jonas
>>>> _______________________________________________
>>>> 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