-
-
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
Method error in value(::Function, ::Number) #3775
Comments
I understand the motivation, but this makes me go hmmmmmmmm. julia> using JuMP
julia> model = Model();
julia> @variable(model, x, start = 2);
julia> @expression(model, expr[i in 0:2], (1 + x)^i)
1-dimensional DenseAxisArray{Any,1,...} with index sets:
Dimension 1, 0:2
And data, a 3-element Vector{Any}:
1.0
x + 1
x² + 2 x + 1
julia> value.(start_value, expr)
ERROR: MethodError: no method matching value(::typeof(start_value), ::Float64) |
Yes, that feels like it should error. Do you have a suggested workaround? In my package I have essentially the code I suggested, which isn't the best. I'm also moderately embarrassed I didn't think to just put |
I'm thinking about this more and |
See #3776 I'm marking this as a bug fix, because we already had |
Demonstration of Issue
I am using the
value(::Function, ::jump_object)
version ofvalue
. However, if I put a number in the second coordinate, I get an error.Suggested Fix
Add a method on value of the form
Why am I getting this error?
I am creating expressions that potentially collapse to a number. I need to evaluate these expressions at a specific point, hence the error.
The text was updated successfully, but these errors were encountered: