Clear Filters
Clear Filters

Programmatically Hard Stop intlinprog

3 views (last 30 days)
I would like to know how to programmatically send intlinprog a "hard stop" signal, which makes it immediately exit and return the best incumbent, global upper bound, global lower bound, etc. I am solving a large number of MILP problem instances, each of which might possibly take several days to run to full optimality, and would like to prevent them from running too long. Ctrl+C is not an option because it is infeasible for me to sit at the keyboard and press it repeatedly when I'm solving hundreds of MILP problems in a batch.
According to this answer and this documentation, the MaxTime option causes intlinprog to stop generating subproblems after the time exceeds MaxTime, but does not actually completely stop intlinprog. In my case the solver often continues running far longer than the MaxTime limit with no end in sight. I'm forced to kill it with Ctrl+C, which loses all the data I've obtained so far.
I've tried using an Output Function to send a stop signal to the solver, but I get the same problem as with MaxTime--the solver will not immediately quit and continues running indefinitely.
Is it possible for me to do this?

Accepted Answer

Alan Weiss
Alan Weiss on 21 Nov 2018
Sorry, no. When you use an output function or the MaxTime option, intlnprog stops when it reaches a safe place to exit. This safe place might be after more time has passed than you like, but currently it is the only way we have to stop the solver without losing information. The same goes for plot functions, they all use the same mechanism.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 Comments
James Usevitch
James Usevitch on 24 Nov 2018
Thanks for the answer--that's really good to know. Could you provide more details on what constitutes a "safe place to exit" and roughly how much additional time it might take to reach there? For example, can you confirm that the solver tries to solve all subproblems / unexplored child nodes in the branch and bound tree before exiting as per this answer?
Alan Weiss
Alan Weiss on 26 Nov 2018
Well, it is hard to say because it depends on your MATLAB version. intlinprog does not necessarily solve all subproblems between the times it looks to see if it should stop; in fact, more recent versions have it look more often than it did in older versions. But exactly where these places are in the code is something I cannot share. Sorry.
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!