How to set JuMP.jl timeout?

Does anybody know how to set timeout for JuMP.jl?
I used JuMP for some optimization problems, but sometime it falls in long time computation. I hope the calculation time is explicitly limited even though a exception is acceptable.
I’ve read this: Implement time out when creating the model - Specific Domains / Optimization (Mathematical) - Julia Programming Language (julialang.org), but it’s not what I want.

Any suggestion, appreciated.

Most solvers support a time limit, which you can using set_time_limit_sec:

The results can be solver-dependent though. They may not terminate exactly on the limit, but at the next available opportunity.

Thanks,I tried it with EAGO.jl optimizer, it works.

1 Like