MATLAB: Programmatically Hard Stop intlinprog

mixed-integer programmingoptimization

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?

Best Answer

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