In relation to using CBC via Pyomo:

I was wondering if anyone knew if it was possible to set a maximum allowed time to improve a solution, rather than a maximum total time. This way, if you've been stuck on a solution without improving for a while, you can exit the solver by default.

A work around could be to pause the solver and check the logs but I couldn't find anything about pausing a solver either.

Many thanks.


1 Answer 1


Please check this question which is asked and answered in Stack Overflow. Also, this link includes the explanation of different termination condition in Pyomo. One of those conditions is "userInterrupt" that I think can be used to define a condition inside Pyomo to force the solver to stop. In that situation, the solver status will be "Aborted".

  • 1
    $\begingroup$ Thanks for your answer Oguz, but I don't think either of those links answer my question. I was hoping to find a way to give a solver an option to return the best current solution once there has been no improvement for a set time, rather than just setting a hard time limit on the solving. Given I have not been able to find anything else about this on the internet I assume it probably doesn't exist. $\endgroup$
    – domdomdom
    Jul 16, 2019 at 13:48
  • $\begingroup$ I think so, in that situation you need to code it yourself. After every iteration, get the current solution and compare to the previous solution, then you can decide whether to continue if there is an improvement in the solution or to stop if the two compared answers are the same. It’s actually defining a problem specific stopping criteria which is very common in the computational research fields. $\endgroup$ Jul 16, 2019 at 15:30
  • $\begingroup$ Makes sense, thanks for your help. $\endgroup$
    – domdomdom
    Jul 16, 2019 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.