A bug about JuMP.jl

I was wondering whether there exist bugs of calling for "value(function, expr) ". My codes are like this:

M = Model()
@variable(M, x)
@variable(M, y)
@NLconstraint(M, con, x + x*y^2 - 3 >= 0)
t = all_constraints(M; include_variable_in_set_constraints = true)
D = Dict(x => 1)
value(x β†’ get(D,x,x), t[1])
An error is thrown that

1 Like

get(D,x,x) will return 1 if x is model[:x] and will return x if x is model[:y]. That’s an issue since this is a variable instead of a number. get(D, x, 0) will work since 0 is a number. Note sure if 0 is appropriate though, it depends on what you want to do

1 Like