Programmatically Hard Stop intlinprog

조회 수: 4 (최근 30일)
James Usevitch
James Usevitch 2018년 11월 20일
댓글: Alan Weiss 2018년 11월 26일
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?

채택된 답변

Alan Weiss
Alan Weiss 2018년 11월 21일
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
James Usevitch
James Usevitch 2018년 11월 24일
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 2018년 11월 26일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by