# Time to find the best solution in a mixed-integer linear programming model with JuMP

**URL:** <https://discourse.julialang.org/t/time-to-find-the-best-solution-in-a-mixed-integer-linear-programming-model-with-jump/106985>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, cplex\
**Created:** [December 1, 2023, 10:54am UTC](https://discourse.julialang.org/t/time-to-find-the-best-solution-in-a-mixed-integer-linear-programming-model-with-jump/106985 "2023-12-01T10:54:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![baprata](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baprata/32/204269_2.png) [@baprata](https://discourse.julialang.org/u/baprata)\
**Post date:** [December 1, 2023, 10:54am UTC](https://discourse.julialang.org/t/time-to-find-the-best-solution-in-a-mixed-integer-linear-programming-model-with-jump/106985/1 "2023-12-01T10:54:23Z")

</div>

I am solving a mixed-integer linear programming model with JuMP and CPLEX. How could I measure the time required to find the best solution?

Sometimes, the global optimal solution is found, but the solver continues the search, aiming to prove its optimality. In other scenarios, a local optimum is found, but such a solution is not improved within the specified time limit.

Best regards,

Bruno

---

<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:** [December 1, 2023, 10:17pm UTC](https://discourse.julialang.org/t/time-to-find-the-best-solution-in-a-mixed-integer-linear-programming-model-with-jump/106985/2 "2023-12-01T22:17:01Z")

</div>

I dont know if there is an easy way.

You could write a solver-specific callback that recorded when each solution is found. See

> **[GitHub - jump-dev/CPLEX.jl: Julia interface for the CPLEX optimization software](https://github.com/jump-dev/CPLEX.jl#callbacks)**
>
> Julia interface for the CPLEX optimization software - GitHub - jump-dev/CPLEX.jl: Julia interface for the CPLEX optimization software

---

<div class="post-metadata">

**Author:** ![baprata](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baprata/32/204269_2.png) [@baprata](https://discourse.julialang.org/u/baprata)\
**Post date:** [December 2, 2023, 10:28am UTC](https://discourse.julialang.org/t/time-to-find-the-best-solution-in-a-mixed-integer-linear-programming-model-with-jump/106985/3 "2023-12-02T10:28:53Z")

</div>

Dear Oscar,  
Thank you so much for your help.  
Best,  
Bruno
