-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Allow MOI.ModelLike as the optimizer instead of MOI.AbstractOptimizer #3667
Conversation
Now
I didn't add the type because I don't know if this adds anything: julia> print(typeof(unsafe_backend(model)))
MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.VariablesContainer{Float64}, MathOptInterface.FileFormats.MPS.ModelFunctionConstraints{Float64}} I guess I could
|
julia> optimize!(model)
ERROR: Cannot call `optimize!` because the provided optimizer is not a subtype of `MOI.AbstractOptimizer`.
The optimizer is:
A Mathematical Programming System (MPS) model
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] optimize!(model::Model; ignore_optimize_hook::Bool, _differentiation_backend::MathOptInterface.Nonlinear.SparseReverseMode, kwargs::@Kwargs{})
@ JuMP ~/.julia/dev/JuMP/src/optimizer_interface.jl:449
[3] optimize!(model::Model)
@ JuMP ~/.julia/dev/JuMP/src/optimizer_interface.jl:409
[4] top-level scope
@ REPL[55]:1 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3667 +/- ##
==========================================
+ Coverage 98.29% 98.32% +0.03%
==========================================
Files 43 43
Lines 5676 5682 +6
==========================================
+ Hits 5579 5587 +8
+ Misses 97 95 -2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty reasonable. Are there any other consequences of this change?
I don't think so. All of the solvers are But here's a |
Closes jump-dev/MathOptInterface.jl#2417
The only downside is this:
It violates the MethodError principle because we're throwing an error deep in the stack.
Should we check whether the backend is an optimizer?