Setting Time Limits for JuMP (with CBC solver)

Hi all. Is there a way to set time limit for JuMP models using CBC solver?
The “seconds” parameter only limits CPU seconds, which is different from Wallclock seconds.
I need to set a limit for Wallclock second!

1 Like

I don’t think so. Is the difference big?

Note that there is some time spent in JuMP setting up the problem that you will see in a call to optimize!(model) that is not captured by the time limit. Is that what you are observing?

I don’t think so. Attached the screenshot of what’s happening.
As you can see I set “seconds” to 120, but I think CPU seconds are counted.

I don’t know if there is a way make the time limit the wallclock.You could just increase the time limit to account for the multiple threads?

Note that even if you set a time limit, the solver will not stop immediately, but instead at the next available opportunity. (i.e., it stopped at 156 seconds, not 120).

What are you trying to achieve?

1 Like

I am doing some experiments on solving optimization problems when there is lack of resources, especially when there is time limit. I am trying to see how suboptimal the solutions are, depending on different time limits.

Note that there are plenty of issues to be aware of when trying to do this.

  • Solvers might not respect time limits the same way.
  • Insights are problem dependent.
  • Solving the same model with the same solver and a longer time limit is not guaranteed to get a better answer.

See this slide deck for some of the pitfalls:

1 Like

Wow did not know about these issues!
Thank you so much for the tips!