User Tools

Site Tools

How do I interrupt a solver?

I want to interrupt my solver and have it return the current status, in much the same way as would be done if an iteration or resource limit were exceeded. How can I do this?
The Unix and PC systems now support a user interrupt that can be
triggered by the user to stop a solver job at the next convenient point.
Typically, solvers will check for a user interrupt in the same places
where the resource limit is checked. A user might wish to trigger an
interrupt in order to stop a MIP job that has found a good integer
feasible point but does not yet satisfy the convergence tolerances, or
to return an intermediate point for an LP or NLP. The solver will
return the current point and the appropriate model status, with a
solution status of 8 (USER INTERRUPT), and the GAMS run will
continue.

A user interrupt is triggered by sending an interrupt (SIGINT) to the
solver. This can be done in a number of ways, but the easiest is to
enter Control-C from the keyboard. This will send a signal to the
solver that will be caught and eventually cause the solver to
terminate after writing out its current status.

Users accustomed to using Control-C (SIGINT) to terminate the
entire GAMS run should now use the SIGBREAK signal on the PC
(hit Control-Break) and SIGQUIT on a Unix machine (typically
Control-\). Users should be aware that the SIGINT, SIGBREAK, and
SIGQUIT signals can be caught by other processes, so if you are
running GAMS inside a shell that does this, you may have to send
these signals in another way. For example, Emacs users will not be
able to use Control-C to send SIGINT when running GAMS jobs in
an Emacs subshell. Also, these signals can be bound to different
keys on a Unix machine via the stty command: use the stty
all command to find the current settings.

Not all solvers can be interrupted by the user. Currently, those that
can be interrupted include BDMLP, CONOPT, CPLEX, and MINOS,
with more soon to follow.