# How to set JuMP.jl timeout?

**URL:** <https://discourse.julialang.org/t/how-to-set-jump-jl-timeout/102701>\
**Category:** Optimization (Mathematical)\
**Tags:** package, jump\
**Created:** [August 11, 2023, 2:06am UTC](https://discourse.julialang.org/t/how-to-set-jump-jl-timeout/102701 "2023-08-11T02:06:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![peng](https://avatars.discourse-cdn.com/v4/letter/p/c2a13f/32.png) [@peng](https://discourse.julialang.org/u/peng)\
**Post date:** [August 11, 2023, 2:06am UTC](https://discourse.julialang.org/t/how-to-set-jump-jl-timeout/102701/1 "2023-08-11T02:06:30Z")

</div>

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)](https://discourse.julialang.org/t/implement-time-out-when-creating-the-model/89451/2), but it’s not what I want.

Any suggestion, appreciated.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [August 11, 2023, 2:26am UTC](https://discourse.julialang.org/t/how-to-set-jump-jl-timeout/102701/2 "2023-08-11T02:26:22Z")

</div>

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

> **[Models · JuMP](https://jump.dev/JuMP.jl/stable/manual/models/#Set-a-time-limit)**
>
> Documentation for JuMP.

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

---

<div class="post-metadata">

**Author:** ![peng](https://avatars.discourse-cdn.com/v4/letter/p/c2a13f/32.png) [@peng](https://discourse.julialang.org/u/peng)\
**Post date:** [August 11, 2023, 6:15am UTC](https://discourse.julialang.org/t/how-to-set-jump-jl-timeout/102701/3 "2023-08-11T06:15:33Z")

</div>

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