Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run against MOI.Test suite #152

Open
blegat opened this issue Aug 13, 2020 · 1 comment
Open

Run against MOI.Test suite #152

blegat opened this issue Aug 13, 2020 · 1 comment

Comments

@blegat
Copy link
Contributor

blegat commented Aug 13, 2020

We should add a test/MOI_wrapper.jl file following http://jump.dev/MathOptInterface.jl/dev/apimanual/#Testing-guideline-1

@odow
Copy link
Collaborator

odow commented Mar 15, 2022

This was a massive failure. It fails immediately:

julia> alpine = MOI.OptimizerWithAttributes(
           Alpine.Optimizer,
           "nlp_solver" => IPOPT,
           "mip_solver" => CBC,
       )
MathOptInterface.OptimizerWithAttributes(Alpine.Optimizer, Pair{MathOptInterface.AbstractOptimizerAttribute, Any}[MathOptInterface.RawOptimizerAttribute("nlp_solver") => MathOptInterface.OptimizerWithAttributes(Ipopt.Optimizer, Pair{MathOptInterface.AbstractOptimizerAttribute, Any}[MathOptInterface.Silent() => true, MathOptInterface.RawOptimizerAttribute("sb") => "yes", MathOptInterface.RawOptimizerAttribute("max_iter") => 9999]), MathOptInterface.RawOptimizerAttribute("mip_solver") => MathOptInterface.OptimizerWithAttributes(Cbc.Optimizer, Pair{MathOptInterface.AbstractOptimizerAttribute, Any}[MathOptInterface.Silent() => true])])

julia> model = MOI.Utilities.CachingOptimizer(
           MOI.Utilities.UniversalFallback(MOI.Utilities.Model{Float64}()),
           MOI.instantiate(alpine; with_bridge_type = Float64),
       )
MOIU.CachingOptimizer{MOIB.LazyBridgeOptimizer{Alpine.Optimizer}, MOIU.UniversalFallback{MOIU.Model{Float64}}}
in state EMPTY_OPTIMIZER
in mode AUTOMATIC
with model cache MOIU.UniversalFallback{MOIU.Model{Float64}}
  fallback for MOIU.Model{Float64}
with optimizer MOIB.LazyBridgeOptimizer{Alpine.Optimizer}
  with 0 variable bridges
  with 0 constraint bridges
  with 0 objective bridges
  with inner model Alpine.Optimizer

julia> MOI.Test.runtests(
           model,
           MOI.Test.Config(),
           exclude = String[],
       )

Test Summary:                         | Pass  Total
test_add_constrained_variables_vector |    6      6
Test Summary:                |
test_attribute_NumberThreads | No tests
test_attribute_RawStatusString: Error During Test at /Users/oscar/.julia/packages/MathOptInterface/FHFUH/src/Test/Test.jl:208
  Got exception outside of a @test
  MethodError: no method matching initialize(::Nothing, ::Vector{Symbol})
  Closest candidates are:
    initialize(::MathOptInterface.Test.HS071, ::Vector{Symbol}) at /Users/oscar/.julia/packages/MathOptInterface/FHFUH/src/Test/test_nonlinear.jl:28
    initialize(::MathOptInterface.Test.FeasibilitySenseEvaluator, ::Vector{Symbol}) at /Users/oscar/.julia/packages/MathOptInterface/FHFUH/src/Test/test_nonlinear.jl:218
    initialize(::MathOptInterface.Test.InvalidEvaluator, ::Vector{Symbol}) at /Users/oscar/.julia/packages/MathOptInterface/FHFUH/src/Test/test_nonlinear.jl:1031
    ...
  Stacktrace:
    [1] load!(m::Alpine.Optimizer)
      @ Alpine ~/.julia/dev/Alpine/src/solver.jl:499
    [2] optimize!(m::Alpine.Optimizer)
      @ Alpine ~/.julia/dev/Alpine/src/algorithm.jl:17
    [3] optimize!
      @ ~/.julia/packages/MathOptInterface/FHFUH/src/Bridges/bridge_optimizer.jl:348 [inlined]
    [4] optimize!
      @ ~/.julia/packages/MathOptInterface/FHFUH/src/MathOptInterface.jl:81 [inlined]
    [5] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{Alpine.Optimizer}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}})
      @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/FHFUH/src/Utilities/cachingoptimizer.jl:313
    [6] test_attribute_RawStatusString(model::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{Alpine.Optimizer}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, config::MathOptInterface.Test.Config{Float64})
      @ MathOptInterface.Test ~/.julia/packages/MathOptInterface/FHFUH/src/Test/test_attribute.jl:44
    [7] macro expansion
      @ ~/.julia/packages/MathOptInterface/FHFUH/src/Test/Test.jl:214 [inlined]
    [8] macro expansion
      @ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
    [9] runtests(model::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{Alpine.Optimizer}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, config::MathOptInterface.Test.Config{Float64}; include::Vector{String}, exclude::Vector{String}, warn_unsupported::Bool, exclude_tests_after::VersionNumber)
      @ MathOptInterface.Test ~/.julia/packages/MathOptInterface/FHFUH/src/Test/Test.jl:209
   [10] top-level scope
      @ REPL[14]:1
   [11] eval
      @ ./boot.jl:360 [inlined]
   [12] eval_user_input(ast::Any, backend::REPL.REPLBackend)
      @ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:139
   [13] repl_backend_loop(backend::REPL.REPLBackend)
      @ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:200
   [14] start_repl_backend(backend::REPL.REPLBackend, consumer::Any)
      @ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:185
   [15] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool)
      @ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:317
   [16] run_repl(repl::REPL.AbstractREPL, consumer::Any)
      @ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:305
   [17] (::Base.var"#874#876"{Bool, Bool, Bool})(REPL::Module)
      @ Base ./client.jl:387
   [18] #invokelatest#2
      @ ./essentials.jl:708 [inlined]
   [19] invokelatest
      @ ./essentials.jl:706 [inlined]
   [20] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
      @ Base ./client.jl:372
   [21] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:302
   [22] _start()
      @ Base ./client.jl:485
Test Summary:                  | Error  Total
test_attribute_RawStatusString |     1      1
ERROR: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.

Because Alpine assumes the problem is nonlinear:

julia> using JuMP, Alpine, Cbc, Ipopt

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

julia> set_optimizer_attribute(model, "nlp_solver", Ipopt.Optimizer)

julia> set_optimizer_attribute(model, "mip_solver", Cbc.Optimizer)

julia> @variable(model, x >= 0)
x

julia> optimize!(model)
ERROR: MethodError: no method matching initialize(::Nothing, ::Vector{Symbol})
Closest candidates are:
  initialize(::MathOptInterface.Test.HS071, ::Vector{Symbol}) at /Users/oscar/.julia/packages/MathOptInterface/FHFUH/src/Test/test_nonlinear.jl:28
  initialize(::MathOptInterface.Test.FeasibilitySenseEvaluator, ::Vector{Symbol}) at /Users/oscar/.julia/packages/MathOptInterface/FHFUH/src/Test/test_nonlinear.jl:218
  initialize(::MathOptInterface.Test.InvalidEvaluator, ::Vector{Symbol}) at /Users/oscar/.julia/packages/MathOptInterface/FHFUH/src/Test/test_nonlinear.jl:1031
  ...
Stacktrace:
 [1] load!(m::Alpine.Optimizer)
   @ Alpine ~/.julia/dev/Alpine/src/solver.jl:499
 [2] optimize!(m::Alpine.Optimizer)
   @ Alpine ~/.julia/dev/Alpine/src/algorithm.jl:17
 [3] optimize!
   @ ~/.julia/packages/MathOptInterface/FHFUH/src/Bridges/bridge_optimizer.jl:348 [inlined]
 [4] optimize!
   @ ~/.julia/packages/MathOptInterface/FHFUH/src/MathOptInterface.jl:81 [inlined]
 [5] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{Alpine.Optimizer}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}})
   @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/FHFUH/src/Utilities/cachingoptimizer.jl:313
 [6] optimize!(model::Model; ignore_optimize_hook::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ JuMP ~/.julia/packages/JuMP/0STkJ/src/optimizer_interface.jl:161
 [7] optimize!(model::Model)
   @ JuMP ~/.julia/packages/JuMP/0STkJ/src/optimizer_interface.jl:143
 [8] top-level scope
   @ REPL[36]:1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants