AmplNLWriter.jl with Ipopt from Ipopt.jl

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

The way indicated in the AmplNLWriter.jl readme, 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

Updated the readme:

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

Download Ipopt from here 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:

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

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.