[SCIP] Doubt of SCIP
Stefan Vigerske
svigerske at gams.com
Wed Nov 23 18:52:30 CET 2022
Hi,
via Pyomo, you have very limited access to SCIP.
Pyomo writes your problem into an .nl file and then calls the SCIP
executable for this .nl file (using SCIP's AMPL interface).
You don't have easy control about what is happening while this
executable is running. I guess if you get access to the log while SCIP
is running, you could parse that and send an interrupt signal to the
executable to make SCIP stop and return the best solution found so far.
If you connect to SCIP via an interface that uses SCIP as a library,
then you have much more control.
For the first question: You can do this. For example, you could add an
event handler, which would be called at every node, for example, and in
the event handler you could call the SCIPinterruptSolve() function
(https://www.scipopt.org/doc-8.0.2/html/group__PublicSolveMethods.php#gab207a6210ea634cca6fae72dde4d9a91)
if you want SCIP to stop as soon as possible.
Also have a separate thread that monitors the state of SCIP and calls
SCIPinterruptSolve() when appropriate should work.
For the second question: Some parameters can be changed in the middle of
calculation. I don't think it is documented for which one this is the
case, but limits like gap, time, solutions, should be possible. You can
change parameters via an API (similar to how to call
SCIPinterruptSolve() above) or via the SCIP shell (there is a section on
this at https://www.scipopt.org/doc-8.0.2/html/SHELL.php).
Not all interfaces/APIs to SCIP
(https://www.scipopt.org/doc-8.0.2/html/INTERFACES.php) offer the same
amount of functionality. With the C API, you get everything. Since you
say Pyomo, looking at PySCIPOpt is likely. It's likely that you have
access to SCIPinterruptSolve() there, too. The PySCIPOpt devs/users
could say for sure.
You should also be able to use Pyomo for the modeling and let it write
out a .nl file, and then call SCIP via one of its APIs. You can then let
SCIP read the .nl file and do the solve. Not sure about getting the
solution back into Pyomo, though.
Hope that helps,
Stefan
On 23/11/2022 15:24, Pablo Falcón wrote:
> Hi,
>
> I'm Pablo and I have two questions to see if SCIP is useful for me:
>
> - ¿Can I stop SCIP when I'm doing the calculation and get the results? I
> know that I can establish parameters like time limit, the gap... I want to
> stop it while calculating because in this way I see the results and I have
> enough information to know if I want to stop the model.
> - ¿Can I change parameters like the gap in the middle of a calculation?
> For example, sometimes I establish a very low gap and the calculation
> doesn't stop in a reasonable time.
>
> I would like to know if I can apply these options to SCIP in Pyomo and if
> the answer is no if I can apply in another language.
>
> Best regards,
> Pablo
>
>
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip
More information about the Scip
mailing list