[Scip] [SCIP] adding constraints during pricing

Stefan Heinz heinz at zib.de
Wed May 2 22:17:27 MEST 2012


Hi Daniel,

On 05/02/2012 10:51 AM, Daniel Karch wrote:
> Hi Stefan,
>
> I did as you suggested. The linear constraints are now added to the
> initconss array in conshdlrAddInitcons,
> but the conflict will be found again in the Pricer, and the same (violated)
> constraints are added.
> When the conflict is found for the first time, the variables z1 and z2 are
> created along with the constraints
>
> x1 + x2  - z1<= 1 // cons0
> x3 - z2<= 0 // cons1
> z1 + z2<= 1 // cons2
>
> When the conflict is found for the second time, I check the feasibility of
> the constraints
>
> SCIPgetFeasibilityLinear(scip, cons0, 0) -->  -1
> SCIPgetFeasibilityLinear(scip, cons1, 0) -->  -1
> SCIPgetFeasibilityLinear(scip, cons2, 0) -->   0
>
> i.e. the variables are set to x1 = x2  = x3 = 1, z1 = z2 = 0, which clearly
> is not feasible for the above constraints.
>
> So, it still doesn't work, unfortunately. :-(
I check that issue.
> Is there a way to print the current LP, i.e. all the rows that are
> currently in the LP?
SCIPwriteLP() in scip.h

Stefan
>
>    Daniel
>
>
> 2012/4/28 Stefan Heinz<heinz at zib.de>
>
>> Hi Daniel,
>>
>> I see the issue. What happens if you replaces "stat->nnodes<= 1" with
>> TRUE?
>>
>> Stefan
>>
>>
>> On 04/27/2012 10:32 AM, Daniel Karch wrote:
>>
>>> Hi,
>>>
>>> I have the same problem. In my pricer, I first create two variables and
>>> add
>>> them to the problem
>>> with SCIPaddPricedVar.
>>> Then, I create the linear constraints using these new variables with the
>>> flags
>>> initial, separate, enforce, check, propagate set to TRUE.
>>> SCIP does not seem to take the new constraints into account at all.
>>> I have stepped into SCIPaddCons with gdb, until it arrives at the
>>> following:
>>>
>>> in cons.c, l. 1334:
>>> /* add constraint to the initconss array if the constraint is initial and
>>> added to the focus node */
>>> if( focusnode&&   cons->initial )
>>>
>>> {
>>>     SCIP_CALL( conshdlrAddInitcons(conshdlr, set, cons) );
>>> }
>>>
>>> Here, focusnode is FALSE. The function conshdlrActivateCons where this
>>> occurs is called in the function SCIPconsActivate,
>>> which in turn is called like this:
>>>
>>> SCIP_CALL( SCIPconsActivate(cons, set, stat, -1, (stat->nnodes<= 1)),
>>>
>>> and focusnode is set to FALSE because (stat->nnodes<= 1) is not satisfied.
>>> When this happens, we are *not in the root node* anymore.
>>>
>>> Does this mean that I can add linear constraints only in the root node?
>>> This confuses me ... I thought this was what the 'local' flag is for.
>>>
>>> I would appreciate if you could give me a hint as to how I should proceed.
>>>
>>> Best regards,
>>>
>>>    Daniel
>>>
>>>
>>>
>>> 2012/3/31 Stefan Heinz<heinz at zib.de>
>>>
>>>   Hi,
>>>> when you create the new linear constraints did you set the initial flag
>>>> to TRUE (this is the first Boolean of the ten)?
>>>>
>>>>
>>>> http://scip.zib.de/doc/html/**cons__linear_8h.html#**
>>>> aa7aed137a4130b35b168812414413**481<http://scip.zib.de/doc/html/cons__linear_8h.html#aa7aed137a4130b35b168812414413481>
>>>>
>>>> Doing that should put the new constraints into the LP before it is
>>>> solved again. The magic happens in the method SCIPpriceLoop()
>>>>
>>>> http://scip.zib.de/doc/html_**devel/solve_8c_source.html#**l01625<http://scip.zib.de/doc/html_devel/solve_8c_source.html#l01625>
>>>>
>>>> in line 01755.
>>>>
>>>> Best Stefan
>>>>
>>>> On 03/30/2012 11:33 AM, Hélène Toussaint wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have a BCP code. When I generate a new variable in the redcost
>>>>> function of the pricer I must generate also several constraints in
>>>>> which this new variable appears. To generate and add these constraints
>>>>> I use SCIPcreateConsLinear and SCIPaddCons.
>>>>>
>>>>> My problem is that some of these constraints are not taken into
>>>>> account: before branching I use SCIPvarGetLPSol to see the current lp
>>>>> solution and this solution does not always satisfy all the constraints
>>>>> added in the pricer.
>>>>>
>>>>> How to tell SCIP to take into account my new constraints ? I'd like
>>>>> the current lp solution be updated every time a new constraint is
>>>>> added (even before generate a new variable since it changes the dual
>>>>> costs).
>>>>>
>>>>> Best,
>>>>> Hélène
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ______________________________**_________________
>>>>> Scip mailing list
>>>>> Scip at zib.de
>>>>> http://listserv.zib.de/**mailman/listinfo/scip<http://listserv.zib.de/mailman/listinfo/scip>
>>>>>
>>>> ______________________________**_________________
>>>> Scip mailing list
>>>> Scip at zib.de
>>>> http://listserv.zib.de/**mailman/listinfo/scip<http://listserv.zib.de/mailman/listinfo/scip>
>>>>
>>>>



More information about the Scip mailing list