# How to save algorithm iteration result when using JuMP

**URL:** <https://discourse.julialang.org/t/how-to-save-algorithm-iteration-result-when-using-jump/115684>\
**Category:** Optimization (Mathematical)\
**Tags:** question\
**Created:** [June 15, 2024, 10:23am UTC](https://discourse.julialang.org/t/how-to-save-algorithm-iteration-result-when-using-jump/115684 "2024-06-15T10:23:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xuekui\_wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xuekui_wang/32/30746_2.png) [@Xuekui\_wang](https://discourse.julialang.org/u/Xuekui_wang)\
**Post date:** [June 15, 2024, 10:23am UTC](https://discourse.julialang.org/t/how-to-save-algorithm-iteration-result-when-using-jump/115684/1 "2024-06-15T10:23:19Z")

</div>

When using Ipopt in JuMP，it will print these information on console, I want to know how to get these info, for example, save these data as a vector or dict.

thanks.

```julia
''
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
 110 1.4025308e+06 1.56e-05 2.04e-03 -8.6 7.59e-03 - 9.36e-01 1.00e+00h 1
 111 1.4025308e+06 3.82e-08 3.74e-07 -8.6 1.04e-02 - 1.00e+00 1.00e+00H 1
 112 1.4025308e+06 2.33e-06 1.56e-09 -8.6 2.96e-03 - 1.00e+00 1.00e+00h 1
 113 1.4025308e+06 1.93e-08 3.05e-10 -8.6 2.73e-04 - 1.00e+00 1.00e+00h 1
 114 1.4025308e+06 4.30e-12 1.96e-10 -8.6 2.39e-06 - 1.00e+00 1.00e+00h 1

Number of Iterations....: 114

                                   (scaled) (unscaled)
Objective...............: 1.0834426180323948e+04 1.4025308246576239e+06
Dual infeasibility......: 1.9596491290917102e-10 2.5367917629601793e-08
Constraint violation....: 1.4831469385967466e-12 4.2981174175338310e-12
Variable bound violation: 1.4965723238447026e-07 1.4965723238447026e-07
Complementarity.........: 2.5070278917458909e-09 3.2453808239846214e-07
Overall NLP error.......: 2.5070278917458909e-09 3.2453808239846214e-07
'''

```

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [June 15, 2024, 10:28am UTC](https://discourse.julialang.org/t/how-to-save-algorithm-iteration-result-when-using-jump/115684/2 "2024-06-15T10:28:11Z")

</div>

That information is printed by the solver you are using, not by JuMP. It’s only possible to access that information programmatically if the solver provides some mechanism to do so (I don’t think many do though). JuMP supports querying of solutions though: [Solutions · JuMP](https://jump.dev/JuMP.jl/stable/moi/manual/solutions/#manual_solutions)

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [June 15, 2024, 10:31am UTC](https://discourse.julialang.org/t/how-to-save-algorithm-iteration-result-when-using-jump/115684/3 "2024-06-15T10:31:29Z")

</div>

The JuMP.jl package just provides a high-level interface over MathOptInterface.jl. In case you don’t find the required functionality in the JuMP docs, I suggest descending to the level of MathOptInterface. Even so, using a solver-specific API might be necessary for accessing some of these values.

---

<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:** [June 15, 2024, 11:02am UTC](https://discourse.julialang.org/t/how-to-save-algorithm-iteration-result-when-using-jump/115684/4 "2024-06-15T11:02:57Z")

</div>

See

> **[GitHub - jump-dev/Ipopt.jl: A Julia interface to the Ipopt nonlinear solver](https://github.com/jump-dev/Ipopt.jl?tab=readme-ov-file#solver-specific-callbacks)**
>
> A Julia interface to the Ipopt nonlinear solver. Contribute to jump-dev/Ipopt.jl development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Xuekui\_wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xuekui_wang/32/30746_2.png) [@Xuekui\_wang](https://discourse.julialang.org/u/Xuekui_wang)\
**Post date:** [June 27, 2024, 12:24am UTC](https://discourse.julialang.org/t/how-to-save-algorithm-iteration-result-when-using-jump/115684/5 "2024-06-27T00:24:56Z")

</div>

Yes, thank you, JuMP is a interface, I need to know a solver how to provide these parameters.

---

<div class="post-metadata">

**Author:** ![Xuekui\_wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xuekui_wang/32/30746_2.png) [@Xuekui\_wang](https://discourse.julialang.org/u/Xuekui_wang)\
**Post date:** [June 27, 2024, 12:32am UTC](https://discourse.julialang.org/t/how-to-save-algorithm-iteration-result-when-using-jump/115684/6 "2024-06-27T00:32:48Z")

</div>

Yes, Thank you very muchu for your reply, I have known JuMP clearly according MathOptInterface.

---

<div class="post-metadata">

**Author:** ![Xuekui\_wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xuekui_wang/32/30746_2.png) [@Xuekui\_wang](https://discourse.julialang.org/u/Xuekui_wang)\
**Post date:** [June 27, 2024, 12:35am UTC](https://discourse.julialang.org/t/how-to-save-algorithm-iteration-result-when-using-jump/115684/7 "2024-06-27T00:35:53Z")

</div>

Thank you very much, dear odow, this example helped me.
