[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Interrupting GLPK on demand

From: Szabolcs Horvát
Subject: [Help-glpk] Interrupting GLPK on demand
Date: Mon, 14 Oct 2019 14:45:59 +0200


Is there a way to interrupt GLPK without killing the entire process?

I am interested in terminating glp_intopt(). In principle, this is
possible by calling glp_ios_terminate() from the callback function
passed to glp_intopt(). However, glp_intopt() will internally call
glp_simplex(), which may take a very long time. Thus in practice this
does not work. I could not find any way to interrupt glp_simplex() on
demand.  It is possible to set a time limit (tm_lim in glp_smcp), but
this is not what I need. I would like to have the ability to
interactively interrupt the computation.

For example, glp_simplex() could periodically call a user-supplied
function. If this function returns "true", the computation should be
interrupted gracefully.

I do not need a partial result to be returned. I simply need a clean
interruption, with the resources used by the function properly cleaned
up (e.g. no unreleased memory). I assume that this is possible, since
a time limit is already implemented. In principle, I could even look
up the part of the code that checks the time, and add an additional
interruption check. I am wondering why this wasn't implemented
already, and whether simply doing this would cause any problems. Some
old messages posted to this mailing list seem to suggest that
implementing interruption may not be easy, which seems to be in
contradiction with the fact that a time limit is already implemented.


 - Is there a way to interrupt glp_intopt() cleanly and reliably?
 - If not, consider this a feature request. Please add this functionality.
 - Would there be an issue with extending the time-limit check to also
call a user-supplied interruption-check function?

Use case:

I am not very familiar with ILP solvers. I am actually using graph
theory code that relies on GLPK. I am using this code from a
high-level language that is typically used interactively (think Python
in a Jupyter notebook). Given the nature of the problems that GLPK
solves, it is very hard to predict how long a computation would take.
It could be seconds or days. Therefore, it is important to be able to
interrupt computations gracefully, without needing to kill the entire

In particular, this problem came up while working on the igraph

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]