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

JuMP v0.21 Support #98

Closed ccoffrin closed 4 years ago

ccoffrin commented 4 years ago

The following example,

using JuMP; using AmplNLWriter
solver = with_optimizer(AmplNLWriter.Optimizer, "foo")
m = Model(solver)

seems to result in the following error,

ERROR: The provided `optimizer_constructor` returned an object of type MathOptInterface.Utilities.UniversalFallback{AmplNLWriter.InnerModel{Float64}}. Expected a MathOptInterface.AbstractOptimizer.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] _instantiate_and_check(::JuMP.var"#7#10"{typeof(AmplNLWriter.Optimizer),Tuple{String}}) at ~/.julia/packages/MathOptInterface/DmQBj/src/instantiate.jl:58
 [3] #instantiate#35(::Type{Float64}, ::Bool, ::typeof(MathOptInterface.instantiate), ::Function) at ~/.julia/packages/MathOptInterface/DmQBj/src/instantiate.jl:107
 [4] (::MathOptInterface.var"#kw##instantiate")(::NamedTuple{(:with_bridge_type, :with_names),Tuple{DataType,Bool}}, ::typeof(MathOptInterface.instantiate), ::Function) at ./none:0
 [5] #set_optimizer#96(::Bool, ::typeof(set_optimizer), ::Model, ::Function) at ~/.julia/packages/JuMP/CZ8vV/src/optimizer_interface.jl:66
 [6] #Model#16 at ./none:0 [inlined]
 [7] Model(::Function) at ~/.julia/packages/JuMP/CZ8vV/src/JuMP.jl:233
 [8] top-level scope at REPL[6]:1

CC @odow @blegat @mlubin

odow commented 4 years ago

Duplicate of #97.

The fix is incoming in https://github.com/JuliaOpt/MathOptInterface.jl/pull/1031