jump-dev / AmplNLWriter.jl

A Julia interface to AMPL-enabled solvers
http://ampl.com/products/solvers/all-solvers-for-ampl/
MIT License
67 stars 18 forks source link

Update Ipopt ampl path #113

Closed odow closed 4 years ago

odow commented 4 years ago

Closes #112

mlubin commented 4 years ago

Does this actually still work? I thought we dropped support for this in one of the recent changes to how the binaries are built.

odow commented 4 years ago

I guess you're right:

julia> using JuMP, AmplNLWriter, Ipopt

julia> model = Model(() -> AmplNLWriter.Optimizer(Ipopt.amplexe_path))
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: AmplNLWriter

julia> @variable(model, x)
x

julia> @NLobjective(model, Min, x^2)

julia> optimize!(model)
ERROR: Unable to open the solution file. The most likely cause of this
is the solver executable failing unexpectedly. Unfortunately we don't
have any other information about the solution or what went wrong.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] read_results at /Users/oscar/.julia/packages/AmplNLWriter/cqDNr/src/AmplNLWriter.jl:617 [inlined]
 [3] optimize!(::AmplNLWriter.AmplNLMathProgModel) at /Users/oscar/.julia/packages/AmplNLWriter/cqDNr/src/AmplNLWriter.jl:429
 [4] optimize!(::AmplNLWriter.AmplNLNonlinearModel) at /Users/oscar/.julia/packages/AmplNLWriter/cqDNr/src/AmplNLWriter.jl:824
 [5] optimize!(::AmplNLWriter.Model{Float64}) at /Users/oscar/.julia/packages/AmplNLWriter/cqDNr/src/MOI_wrapper.jl:400
 [6] optimize!(::MathOptInterface.Bridges.LazyBridgeOptimizer{AmplNLWriter.Model{Float64}}) at /Users/oscar/.julia/packages/MathOptInterface/k7UUH/src/Bridges/bridge_optimizer.jl:264
 [7] optimize!(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}) at /Users/oscar/.julia/packages/MathOptInterface/k7UUH/src/Utilities/cachingoptimizer.jl:215
 [8] optimize!(::Model, ::Nothing; bridge_constraints::Bool, ignore_optimize_hook::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/oscar/.julia/packages/JuMP/qhoVb/src/optimizer_interface.jl:130
 [9] optimize! at /Users/oscar/.julia/packages/JuMP/qhoVb/src/optimizer_interface.jl:106 [inlined] (repeats 2 times)
 [10] top-level scope at REPL[7]:1

Looks like it can't find binaries:

shell> /Users/oscar/.julia/artifacts/3fd2ae81f25cb51c29182a72a167f5cf0400ced8/bin/ipopt
dyld: Library not loaded: @rpath/libasl.dylib
  Referenced from: /Users/oscar/.julia/artifacts/3fd2ae81f25cb51c29182a72a167f5cf0400ced8/bin/ipopt
  Reason: image not found
odow commented 4 years ago

Ah. I remember what the syntax was:

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

But I think we decided this was too complicated.