Closed jd-lara closed 5 years ago
Shouldn’t it be x[i] inside the sum?
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 in 1: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 in 1:2) + k <= 0)
Also, I can't reproduce it all the time with smaller examples.
That is very weird. I will look into it, the debugger is good for tracking this kind of error.
Something broke after v0.1.0 that broke this case for creating constraints with Parameters
And throws a method error