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
Something broke after v0.1.0 that broke this case for creating constraints with Parameters
m =ModelWithParams()
k =add_parameter(m, 10)
x =@variable(m, x[1:2])
@constraint(m, k +sum(x[i] for i in1:2) <=0)
And throws a method error
MethodError: no method matching length(::ParameterRef)
Closest candidates are:length(!Matched::Core.SimpleVector) at essentials.jl:561length(!Matched::Base.MethodList) at reflection.jl:801length(!Matched::Core.MethodTable) at reflection.jl:875
The text was updated successfully, but these errors were encountered:
I added it and get inconsistent behavior, I resorted to putting the parameters in the RHS of the constraint. It seems to be that sometimes the @constraint macro will try to fold the parameter with the rest of the terms in the sum.
Sometimes this type of construction will fail
m =ModelWithParams()
k =add_parameter(m, 10)
x =@variable(m, x[1:2])
@constraint(m, k +sum(x[i] for i in1:2) <=0)
But this one will work
m =ModelWithParams()
k =add_parameter(m, 10)
x =@variable(m, x[1:2])
@constraint(m, sum(x[i] for i in1:2) + k <=0)
Also, I can't reproduce it all the time with smaller examples.
Something broke after v0.1.0 that broke this case for creating constraints with Parameters
And throws a method error
The text was updated successfully, but these errors were encountered: