# Unstable performance of MILP with JuMP

**URL:** <https://discourse.julialang.org/t/unstable-performance-of-milp-with-jump/90715>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, optimization\
**Created:** [November 23, 2022, 2:49pm UTC](https://discourse.julialang.org/t/unstable-performance-of-milp-with-jump/90715 "2022-11-23T14:49:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shuhua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shuhua/32/27618_2.png) [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Post date:** [November 23, 2022, 2:49pm UTC](https://discourse.julialang.org/t/unstable-performance-of-milp-with-jump/90715/1 "2022-11-23T14:49:07Z")

</div>

It occasionally happens that the running time in solving a fixed MILP problem varies between a few seconds and a few minutes. The scenario remains the same regardless of the solver: I have tried Gurobi, Cbc, and HiGHS.

Typically, the first run after the Julia kernel is restarted appears to be the fastest one. Subsequent runs may slow down (i.e., I run the related cell again in Jupyter notebook).

Did anyone else encounter a similar issue? Is it due to JuMP or the solver?

---

<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:** [November 23, 2022, 7:17pm UTC](https://discourse.julialang.org/t/unstable-performance-of-milp-with-jump/90715/2 "2022-11-23T19:17:46Z")

</div>

This is likely one of two reasons:

- Randomness. Is your problem _exactly_ the same between runs? Are you using `rand()` anywhere?
- Running out of RAM. If you use too much RAM, it swaps to disk and performance drops significantly. Are you keeping multiple copies of the problem in memory?

Ultimately, it’s hard to offer advice without a reproducible example.

---

<div class="post-metadata">

**Author:** ![Shuhua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shuhua/32/27618_2.png) [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Post date:** [November 24, 2022, 2:47am UTC](https://discourse.julialang.org/t/unstable-performance-of-milp-with-jump/90715/3 "2022-11-24T02:47:07Z")

</div>

Many thanks. Sorry, I found that there was a `rand()` call, which produced different input data. After the random seed is fixed, the performance is much more stable now.
