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

no method matching supports_default_copy_to #93

Closed rileybadenbroek closed 4 years ago

rileybadenbroek commented 4 years ago

I get the following error when following the installation instructions:

julia> using JuMP, AmplNLWriter

julia> m = Model(with_optimizer(AmplNLSolver, "bonmin"))
ERROR: MethodError: no method matching supports_default_copy_to(::AmplNLSolver, ::Bool)
Closest candidates are:
  supports_default_copy_to(::MathOptInterface.Utilities.AbstractModel, ::Bool) at C:\Users\U1251476\.julia\packages\MathOptInterface\C1XBe\src\Utilities\model.jl:693
  supports_default_copy_to(::MathOptInterface.Utilities.MockOptimizer, ::Bool) at C:\Users\U1251476\.julia\packages\MathOptInterface\C1XBe\src\Utilities\mockoptimizer.jl:521
  supports_default_copy_to(::MathOptInterface.Utilities.CachingOptimizer, ::Bool) at C:\Users\U1251476\.julia\packages\MathOptInterface\C1XBe\src\Utilities\cachingoptimizer.jl:165
  ...
Stacktrace:
 [1] #set_optimizer#77(::Bool, ::typeof(set_optimizer), ::Model, ::OptimizerFactory) at C:\Users\U1251476\.julia\packages\JuMP\MsUSY\src\optimizer_interface.jl:43
 [2] #Model#7 at .\none:0 [inlined]
 [3] Model(::OptimizerFactory) at C:\Users\U1251476\.julia\packages\JuMP\MsUSY\src\JuMP.jl:193
 [4] top-level scope at none:0

I am using JuMP v0.20.1 and AmplNLWriter v0.5.0 on Julia 1.2.0. Do you have any suggestions on how to solve this issue?

odow commented 4 years ago

Oops, that's a typo in the docs. You need:

Model(with_optimizer(AmplNLWriter.Optimizer, "bonmin"))
rileybadenbroek commented 4 years ago

That solved it, thanks for your help!