[Scip] Event handler for "problem solved"

Timo Berthold berthold at zib.de
Tue Jan 22 18:46:57 MET 2013


tl;dr: Calling functions when using the interactive shell can be done
via dialog handlers

Hi Aurélien,

you could write your own main function, like, e.g. in
examples/MIPSolver/src/cppmain.cpp, which calls SCIPsolve()
However, in this case, you would not get an interactive shell, but only
a binary that you can start from your command line.

If you want to keep the interactive shell functionality, you could add a
dialog handler, that introduces a new SCIP shell command that
a) solves the problem and calls your function afterwards or
b) checks whether the stage is SOLVED and only calls your function.

Search SCIPdialogExecOptimize in src/scip/dialog_default.c to see how
the functionality of the "optimize" command is invoked.
Also, in cons_countsols, you can see an  example of a dialog handler
being added to SCIP.
If this is the way you go, please check the "How to add dialogs" section
of the doxygen docu.

Hope that helps.

Best,
Timo

Am 22.01.2013 18:23, schrieb Aurélien Questel:
>> I guess the easiest way is to insert a
>>
>> if( SCIPgetStage(scip) == SCIP_STAGE_SOLVED )
>> {
>>    /* call your function here */
>> }
>>
>> directly after the call of
>> SCIPsolve() in your code. This is nothing that needs to be adressed via
>> an event handler (also, there is no event for this, as you observed
>> correctly).
>> The event system is rather made for interacting with SCIP during the
>> soling procedure, when it is somewhere deep down in its internal routines.
>>
> Thank you for that fast response :)
> The problem is that I use the interactive shell, so I have no direct SCIPsolve call.
> Is there another place where I could test the stage of SCIP ?
>
> Best regards,
> Aurélien
>
>> Best regards,
>> Timo
>>
>> Am 22.01.2013 17:32, schrieb Aurélien Questel:
>>> Hi everybody,
>>> I would like to trigger a function when my main problem is solved (SCIP_STAGE_SOLVED), 
>>> however I'm a bit lost in all the different event types.
>>> What would be the best and easiest way to do that ?
>>>
>>> Thank you,
>>> regards,
>>>
>>> A.Q.
>>>
>>> _______________________________________________
>>> 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