-
-
Notifications
You must be signed in to change notification settings - Fork 401
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
Added type info in NL error message #1872
Conversation
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.
Great! Can you add some test cases please?
Here is an example
https://github.com/JuliaOpt/JuMP.jl/blob/1ee0e0284e3873bad20537362f3f567a7caa0f8a/test/nlp.jl#L569-L584
src/parse_nlp.jl
Outdated
function _parse_NL_expr_runtime(m::Model, x::GenericAffExpr, tape, parent, values) | ||
error("Unexpected affine expression $x in nonlinear expression. " * | ||
"Affine expressions (e.g., created using @expression) and " * | ||
"nonlinear expression cannot be mixed.") |
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.
Nit: nonlinear expressions
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.
Agreed... fixed.
test/nlp.jl
Outdated
"Affine expressions (e.g., created using @expression) and " * | ||
"nonlinear expressions cannot be mixed." | ||
) | ||
@test_throws expected_exception @NLexpression(m, A) |
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.
m
should be model
(also below)
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.
Fixed in both places
Thanks! |
* Added type info in NL error message * Fix typo (twice) * Add tests for errors when using Aff/Quadx in NLexpressions * Fix typo
Type checking for parsing nonlinear expression was missng the GenericAffExpr case. Also added type information to the catch-all error.