[Scip] Dual values of constraints of own constraint handler
Stefan Heinz
heinz at zib.de
Mon Jun 25 22:10:35 MEST 2012
Hi Grit,
in that particular case, setting the modifiable flag to TRUE is the
right way to do.
Enjoy SCIP
Stefan
On 06/25/2012 10:16 AM, Grit Claßen wrote:
> Hello Stefan,
>
> thank you for your detailed answer! Obviously, I had missed some
> details on the implementation of a branching constraint handler.
>
> I have just one further question. Why is it important to set the
> "modifiable" flag of the rows to FALSE? Assume that I have created two
> child nodes of the root node, each containing a branching constraint
> which includes priced variables. The B&B procedure processes one of
> these two child nodes first. During this process new variables are
> priced which also have to be considered in the branching constraint of
> the second child node. This is why I would set this branching
> constraint to modifiable and add newly priced variables to the
> constraint before processing the node. I cannot do this when the
> constraint is not modifiable, can I?
>
> Thank you for your assistance,
> Grit
>
> On 06/23/2012 12:27 PM, Stefan Heinz wrote:
>> Hi Grit,
>>
>> the branching constraints should be initial. That means that the
>> scip_initlp() method of the C++ constraint handler class is called
>> for the node where the branching constraint is added. The initial
>> flag is the one in SCIPcreateCons()
>> http://scip.zib.de/doc/html/scip_8h.html#a8d771b778ea2599827e84d01c0aceaf2
>>
>> which you should call in you constraint handler. That ensurs that you
>> get a chance to put your row into the LP.
>>
>> In that callback (scip_initlp()) you create the SCIP_ROW* of your
>> constraint. It is important that the "local" flag is set to TRUE and
>> the "modifiable" and "removable" flag is set to FALSE. Setting the
>> removable flag to FALSE ensures that SCIP does remove the constraint
>> from the LP (except it leave the the sub tree). See the following two
>> methods for creating a row there you also see the three flags.
>>
>> SCIPcreateRow()
>> http://scip.zib.de/doc/html/scip_8h.html#a0f3f5d2982142da67c59fb8de0ccbd9c
>>
>>
>> SCIPcreateEmptyRow()
>> http://scip.zib.de/doc/html/scip_8h.html#ad250ffa5f36870fc0eb2c10e1e2eaa67
>>
>>
>> After that you add the row to the LP. Here it is important to set the
>> force flag to TRUE to ensure that the row enters the LP. Therefore
>> use the method:
>> SCIPaddCut()
>> http://scip.zib.de/doc/html/scip_8h.html#a04afcc23c6c21a921cd5e9e2f86d77ea
>>
>>
>> Doing all that should ensure that the branching constraint belonging
>> to the path of a particular search node are part of the LP
>> relaxation. The next step would be to get these active branching
>> constraints. That are the once of the path to a search node. That can
>> be done in the same fashion as in the binpacking example. You just
>> ask for all active constraints of your branching constraint handler.
>> Therefore check the code of the binpacking example:
>>
>> http://scip.zib.de/doc/examples/Binpacking/pricer__binpacking_8c_source.html#l00103
>>
>>
>> Having these active constraints, the final step is get the dual
>> values. Therefore, you should implement an interface method in you
>> constraint handler similar to once for the linear, knapsack, setppc,
>> and logicor constraint handler. Therefore have a look at the
>> following code.
>> http://scip.zib.de/doc/html_devel/cons__logicor_8c_source.html#l03489
>>
>> This interface method delivers the dual values of the active
>> constraints.
>>
>> Hope that helps
>> Stefan
>>
>>
>>
>>
>>
>> On 06/22/2012 11:19 AM, Grit Claßen wrote:
>>> Hello,
>>>
>>> this email somehow continues my question on SCIP_ConsData from the
>>> beginnig of this week. I have implemented the constraint handler for
>>> branching constraints in my Branch-and-Price framework. But now in my
>>> pricer, I also have to consider the new constructed branching
>>> constraints with their dual values. The question is how to get the dual
>>> values of the constraints of my branching constraint handler?
>>>
>>> I have included a "SCIP_ROW* row" member in my SCIP_ConsData to be able
>>> to call SCIProwGetDualsol(...). However, I do not know when the rows
>>> are
>>> created. Do I have to create them in a callback function of the
>>> constraint handler? I tried to create the rows when creating the
>>> branching constraints. But there must be an error somewhere since my
>>> program creates the same branching constraints twice (consecutively). I
>>> presume that the rows are not handled correctly.
>>>
>>> An alternative way I can think of is to create the rows in the sepalp
>>> callback. Would this be the correct way? Anyway, do I have to handle
>>> the
>>> rows to be able to get dual values of my branching constraints?
>>>
>>> Thank you and best wishes
>>> Grit
>>>
>>> --
>>> Dipl.-Comp.Math. Grit Claßen
>>>
>>> UMIC Research Centre and Lehrstuhl II für Mathematik
>>> RWTH Aachen University
>>> 52056 Aachen
>>> Germany
>>>
>>> phone: +49 241 80 20753 or +49 241 80 94999
>>> http://www.math2.rwth-aachen.de
>>> http://www.isek.rwth-aachen.de
>>>
>>> _______________________________________________
>>> Scip mailing list
>>> Scip at zib.de
>>> http://listserv.zib.de/mailman/listinfo/scip
>>
>>
>
>
More information about the Scip
mailing list