[Scip] How to find out which constraints were active during the solving process

Gerald Gamrath gamrath at zib.de
Thu Apr 18 17:47:10 MEST 2013


On 18.04.2013 17:32, Rostislav Stanek wrote:
> Dear Stefan,
> thank you very much for your quick response. I tried this solution now 
> but I still get false for all constraints. Is it correct that the 
> function does not ask the SCIP-solver as parameter?
http://scip.zib.de/doc/html/pub__cons_8h.shtml#a8d003272514fb88ff433a01f0ef9729a

Concerning your other question: What constraints are those which you
check? How did you create them? Did you add them via SCIPaddCons()?

I'm also not sure whether we mean the same thing with active:
SCIPconsIsActive() means essentially that the constraint is valid at the
current node, if you do not add local constraints, that it is a model
constraint. It has nothing to do with whether the current (LP) solution
fulfills an inequality as an equality.

What do you want to check and why? Perhaps also the statistics might
give you some (more general) info?

Best,
Gerald


> Best regards
> Rostislav
>
>
> Dne 18.4.2013 14:03, Stefan Vigerske napsal(a):
>> Hi,
>>
>> probably you look at the constraints in the original problem, but you
>> want the one from the transformed problem.
>>
>> Try getting the transformed cons first:
>>     SCIP_CONS* tconstraint;
>>     SCIP_CALL( SCIPgetTransformedCons(scip, constraint, &tconstraint) );
>>     if( tconstraint && SCIPconsIsActive(tconstraint) )
>>     {
>>       /* found one */
>>     }
>>
>> See also
>> http://scip.zib.de/doc/html/scip_8h.shtml#ac783997fa88d9b38b4bb7cfc0c101e95
>>
>> Best,
>> Stefan
>>
>> On 04/18/2013 01:50 PM, Rostislav Stanek wrote:
>>> Dear SCIP community,
>>>
>>> I have the following problem: I would like to find out which constraints
>>> were active during the solving process and which did not at all.
>>>
>>> Thus I defined an event handler and set the events
>>> SCIP_EVENTTYPE_FIRSTLPSOLVED and SCIP_EVENTTYPE_LPSOLVED and
>>> SCIP_EVENTTYPE_NODESOLVED.
>>>
>>> Then I call SCIPconsIsActive(constraint) in the method
>>> SCIP_DECL_EVENTEXEC(EventHandlerLPSolved::scip_exec) and always obtain
>>> false. (I have references to all constraints (std::vector<SCIP_CONS *>
>>> &constraints;) in the class).
>>>
>>> Am I doing something wrong? Is it possible to get out all constraints
>>> used during the solving process?
>>>
>>> Thank you very much for all hints and tips.
>>>
>>> Yours faithfully
>>> Rostislav Stanek
>>> _______________________________________________
>>> 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