# Updating options in Ipopt

**URL:** <https://discourse.julialang.org/t/updating-options-in-ipopt/16013>\
**Category:** Optimization (Mathematical)\
**Created:** [October 8, 2018, 9:30am UTC](https://discourse.julialang.org/t/updating-options-in-ipopt/16013 "2018-10-08T09:30:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Post date:** [October 8, 2018, 9:30am UTC](https://discourse.julialang.org/t/updating-options-in-ipopt/16013/1 "2018-10-08T09:30:06Z")

</div>

Is it possible to easily update the options used in Ipopt?  
Trying to change the value of mu using the `:mu_init` option but it seems that Ipopt uses an immutable struct so I don’t have access. I used it in Julia v0.6 and it was a good speed up for the MINLP solver [Juniper.jl](https://github.com/lanl-ansi/Juniper.jl)

In general I think it should be maybe a function in MathProgBase/MOI to easily update options of each solver in a generalized way?  
FYI currently just updating to julia version 1.0 and not MOI (so it might be different there)

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [October 8, 2018, 8:14pm UTC](https://discourse.julialang.org/t/updating-options-in-ipopt/16013/2 "2018-10-08T20:14:59Z")

</div>

> [@Wikunia](#):
>
> I used it in Julia v0.6

Do you mean that it used to work in Julia 0.6 and doesn’t work anymore in 1.0?

> [@Wikunia](#):
>
> In general I think it should be maybe a function in MathProgBase/MOI to easily update options of each solver in a generalized way?

Definitely. This is easy to do in MOI (but not implemented yet). We’re not going to be making API changes to MathProgBase anymore.

---

<div class="post-metadata">

**Author:** ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Post date:** [October 9, 2018, 7:06am UTC](https://discourse.julialang.org/t/updating-options-in-ipopt/16013/3 "2018-10-09T07:06:09Z")

</div>

The structure of the options seemed to have changed quite a bit by having an iterator over pairs instead of a vector or something like this.  
Anyway actually I’m a little confused that it was possible before as I set it using  
`push!(m.nl_solver.options, (:mu_init, 1e-5))` or overwritting it if present.  
where `m.nl_solver.options` are the options of Ipopt but it was a `struct` back then as well and not a `mutuable struct`.  
In my understanding it should have raised an error before. 😕

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [October 10, 2018, 2:06am UTC](https://discourse.julialang.org/t/updating-options-in-ipopt/16013/4 "2018-10-10T02:06:10Z")

</div>

Immutability doesn’t prevent you from modifying an array that’s stored as a field in a struct.

Yes, the structure for the parameters changed unintentionally because the processing of keyword arguments changed. We’ll accept a PR that changes this structure back to a vector of tuples to make it easier to modify to restore the previous functionality.

---

<div class="post-metadata">

**Author:** ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Post date:** [October 24, 2018, 8:40am UTC](https://discourse.julialang.org/t/updating-options-in-ipopt/16013/5 "2018-10-24T08:40:17Z")

</div>

PR at: [store options as vector of tuples instead of Iterator of pairs by Wikunia · Pull Request #147 · jump-dev/Ipopt.jl · GitHub](https://github.com/JuliaOpt/Ipopt.jl/pull/147)  
This only changes it for MPB as you wrote that there will be another option in MOI later anyway.
