[SCIP] Using SCIPdisableCons in problem creation stage

Gregor Hendel hendel at zib.de
Fri Oct 11 14:26:51 CEST 2019


Hi Lan,

but in the Binpacking example, everything works as expected. Both 
constraints added by ryanfoster-branching are inactive at first, because 
they are added to the child nodes. They are only activated when their 
nodes become active.

 1. Did you accidentally create your constraints with the "local" flag
    set to FALSE?
 2. Can you trace back when the constraint gets activated? You can do
    this by printing a nice debug message from within the
    SCIP_DECL_CONSACTIVE-callback of your constraint handler.


Best,
Gregor

Am 10.10.19 um 12:21 schrieb Ngô Lan:
>
> Hi Gregor,
>
>
> Yeah the second question is about the main scip. So I saved all the 
> branching constraint to probdata after adding to main scip and later 
> in subscip, going through the vector of branching constraints, 
> checking which one is active using SCIPconsIsActive and getting the 
> dual of those that are active. The issue here is that when I branch to 
> 2 child nodes and enter the first child node, it says the the 
> constraint for the other child node is also active in this node. I 
> just followed what you did in binpacking example: create cons, create 
> child, and add cons to child node. I think it is pretty clear so that 
> is why I don't really have any ideas what can go wrong here. Any help 
> is appreciated.
>
>
> Thank you for your time.
>
>
> Best,
>
> Lan
>
> ------------------------------------------------------------------------
> *From:* Gregor Hendel <hendel at zib.de>
> *Sent:* 10 October 2019 09:47:38
> *To:* Ngô Lan; Scip at zib.de
> *Subject:* Re: [SCIP] Using SCIPdisableCons in problem creation stage
> Hello Lan,
>
> find the answers to your two questions inline.
>
> Am 10.10.19 um 01:40 schrieb Ngô Lan:
>>
>> Hi Gregor,
>>
>>
>> Thank you for your reply. It works now. Would it be possible to add 
>> the deleted constraints again to scip? Ideally, when a node is 
>> entered again, I would like to enable the constraint instead of 
>> creating a new one. My code does not run yet so I haven't had chance 
>> to test it.
>>
> As long as you do not release the constraint pointers (using 
> SCIPreleaseCons()), SCIP will not physically delete the constraint, 
> but only remove it from the problem, so that you can later add them 
> again. An explanation of the capture/release mechanism for variables 
> can be found here https://scip.zib.de/doc/html/OBJ.php, the 
> explanation also applies to constraints.
>>
>>
>> I also have another problem with the child nodes. So for branching, I 
>> created a linear branching constraint and a marker constraint from my 
>> constraints handler and added them into a child node (sticking at 
>> node is true). However, in subscip when I check in which branch I am 
>> at using SCIPconsIsActive, I get true even for the constraints that 
>> were not created in this node. Do you have any idea where things 
>> might go wrong?
>>
> As far as I understand your approach, all constraints of the subscip 
> should be active, because at every node (of the main solving process), 
> you free the transformed problem of the subscip and then you add 
> exactly those constraints that reflect your current branching 
> decision. Are you using SCIPconsIsActive on the main solving process 
> constraints, or on the subscip constraints? For the main SCIP, I 
> expect that all branching constraints (there might be several ones 
> along the path from the root) are active, and the rest is not active.
>
> Kind regards,
> Gregor
>
>>
>> Best,
>>
>> Lan
>>
>> ------------------------------------------------------------------------
>> *From:* Scip <scip-bounces at zib.de> on behalf of Gregor Hendel 
>> <hendel at zib.de>
>> *Sent:* 09 October 2019 10:32:17
>> *To:* scip at zib.de
>> *Subject:* Re: [SCIP] Using SCIPdisableCons in problem creation stage
>> Good morning Lan,
>>
>> how about using SCIPdelCons() instead of SCIPdisableCons()?
>>
>> Let me know if that works for you,
>> Gregor
>>
>> Am 09.10.19 um 01:03 schrieb Ngô Lan:
>>>
>>> Hi all,
>>>
>>>
>>> I am solving a project scheduling problem using branch-price-cut and 
>>> I am having an issue with SCIPdisableCons function. So after each 
>>> pricing iteration, I will not release the subscip but only free the 
>>> transformed problem using SCIPfreetransform and modify the objective 
>>> function of the subscip in the next iteration. During branching, in 
>>> CONSACTIVE, I will create an additional constraint for the 
>>> subproblem depending on the branching decision and in CONSDEACTIVE, 
>>> I will disable the related constraint using SCIPdisableCons. 
>>> However, I got the error: cannot call method <SCIPdisableCons> in 
>>> problem creation stage. Do you know another function that can work? 
>>> Or what should I do differently?
>>>
>>>
>>> Thank you for your time,
>>>
>>>
>>> Best,
>>>
>>> Lan
>>>
>>>
>>> _______________________________________________
>>> Scip mailing list
>>> Scip at zib.de
>>> https://listserv.zib.de/mailman/listinfo/scip
>>
>

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


More information about the Scip mailing list