How to save algorithm iteration result when using JuMP

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.


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

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


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.

1 Like



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

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

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

1 Like