# AmplNLWriter.jl with Ipopt from Ipopt.jl

**URL:** <https://discourse.julialang.org/t/amplnlwriter-jl-with-ipopt-from-ipopt-jl/49038>\
**Category:** Optimization (Mathematical)\
**Created:** [October 26, 2020, 12:17pm UTC](https://discourse.julialang.org/t/amplnlwriter-jl-with-ipopt-from-ipopt-jl/49038 "2020-10-26T12:17:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [October 26, 2020, 12:17pm UTC](https://discourse.julialang.org/t/amplnlwriter-jl-with-ipopt-from-ipopt-jl/49038/1 "2020-10-26T12:17:44Z")

</div>

I am trying to use Ipopt, as “shipped” with `Ipopt.jl`, using `AmplNLWriter.jl`.

The way indicated in the [AmplNLWriter.jl readme](https://github.com/jump-dev/AmplNLWriter.jl/blob/master/README.md), `myModel = Model(() -> AmplNLWriter.Optimizer(Ipopt.amplexe))`, returns me a `MethodError`.

However `AmplNLWriter.jl.Optimizer()` accepts directly the solver path. Is there a way to get the path to Ipopt from Ipopt.jl and pass it to `AmplNLWriter.jl.Optimizer()` as a string ?

Package versions:

- Julia 1.5.0
- JuMP v0.21.4
- Ipopt v0.6.3
- AmplNLWriter v0.6.0

---

<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:** [October 26, 2020, 8:57pm UTC](https://discourse.julialang.org/t/amplnlwriter-jl-with-ipopt-from-ipopt-jl/49038/2 "2020-10-26T20:57:37Z")

</div>

Updated the readme: [https://github.com/jump-dev/AmplNLWriter.jl/pull/113](https://github.com/jump-dev/AmplNLWriter.jl/pull/113)

~~It should read `AmplNLWriter.Optimizer(Ipopt.amplexe_path)`.~~

Download Ipopt from [here](https://ampl.com/products/solvers/open-source/) and use that as the path.

There is one option to use `Ipopt.jl`, but it requires wrapping the entire JuMP model and optimization step in `Ipopt.amplexe`, so something like:

```nohighlight
Ipopt.amplexe() do path
    model = Model(() -> AmplNLWriter.Optimizer(path))
    @variable(model, x)
    @NLobjective(model, Min, x^2)
    optimize!(model)
end

```

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [October 27, 2020, 8:42am UTC](https://discourse.julialang.org/t/amplnlwriter-jl-with-ipopt-from-ipopt-jl/49038/3 "2020-10-27T08:42:40Z")

</div>

Thank you. I do actually have Ipopt with HSL locally installed and noticed that out of some hundred optimisations sometimes with Ipopt from Ipopt.jl it couldn’t find the optimal solution, while with AmplNLWriter.jl it always did, and I wondered if it was the different Ipopt/linear solver or the different autodiff method, and it ended up it is the second: by wrapping everything in Ipopt from Ipopt.jl, interfaced trough AmplNLWriter.jl I solved the problem, i.e. it always find the (local) optimal solution, thanks.
