You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We could either add a type-restriction to _process_NL_expr and have a fallback with an informative error message, or we could probably relax the type-restrictions, and see what happens. It probably means relaxing this as well to AbstractVariableRef:
This has indeed come up with InfiniteOpt.jl as I've looked into how to enable NLP expressions (see infiniteopt/InfiniteOpt.jl#16). At one point, I did make a version of _parse_NL_expr_runtime that could work with InfiniteModels and my variable types, however I ran into a number of other problems further down the NLP pipeline.
Thus, I came to the conclusion that the JuMP NLP interface in its current form is essentially non-extendable for use with AbstractModels and AbstractVariableRefs without a significant rewrite such as what is proposed in jump-dev/MathOptInterface.jl#846. Since this is a long way out, I am actually looking into developing a native NLP expression tree abstraction to InfiniteOpt.jl to enable NLP expressions/constraints.
For what it is worth, my recommendation here would be to add a meaningful fallback method and reserve any additional effort for use toward jump-dev/MathOptInterface.jl#846 once the time comes to work on it.
_process_NL_expr
gets called from the@NL
macros, and doesn't have any type requirements:JuMP.jl/src/parse_nlp.jl
Line 233 in 1e6b5d8
but it eventually calls a
_process_NL_expr_runtime
which are restricted to::Model
.JuMP.jl/src/parse_nlp.jl
Line 181 in 1e6b5d8
Thus, someone (e.g., BilevelJuMP, x-ref: joaquimg/BilevelJuMP.jl#57) using this machinery with an
<:AbstractModel
encounters a MethodError:https://discourse.julialang.org/t/methoderror-no-method-matching-parse-nl-expr-runtime-bilevel-problem/51681
We could either add a type-restriction to
_process_NL_expr
and have a fallback with an informative error message, or we could probably relax the type-restrictions, and see what happens. It probably means relaxing this as well toAbstractVariableRef
:JuMP.jl/src/parse_nlp.jl
Lines 187 to 188 in 1e6b5d8
cc @pulsipher who might be messing with this stuff
The text was updated successfully, but these errors were encountered: