Callback function in IPOP for catching inner iterations

Hi, I am currently using a callback function to get the number of inner iterations.
Firstly, I have this: set_optimizer_attributes(model, “mu_target” => μ, “mu_init” => μ);
Where μ is updated outside of IPOPT ( I have my reasons for doing so) However, I am calling the callback function like this,

iters = []
function my_callback(
            alg_mod::Cint,
            iter_count::Cint,
            obj_value::Float64,
            inf_pr::Float64,
            inf_du::Float64,
            mu::Float64,
            d_norm::Float64,
            regularization_size::Float64,
            alpha_du::Float64,
            alpha_pr::Float64,
            ls_trials::Cint)

            append!(iters, iter_count)
            [...]

After IPOPT has successfully found the solution for my specific barrier parameter, I want to know the number of iterations IPOPT used. As I set the barrier parameter myself there will be no “outer” iterations. I believe that I should get the number of iterations by taking: j += last(iters). However, when I debug my way into the iters vector I see this,
iterations
where the purple color represent the element in the vector. I expected that length(iters) -1 = last(iters) (-1 because the iteration starts at 0 which is the initial value and therefore not counted as an iteration) Why is this not the case?

I’ve moved this question to the “Optimization (Mathematical)” section.

It’s hard to say anything without a reproducible example. We’re not doing anything special in Ipopt.jl, so the behavior you’re seeing is what is coming from the Ipopt algorithm.

x-ref Increasing the barrier parameter manuelly, IPOPT - #2 by odow