guys,I wrote the code and got the following error: @constraint is not defined. What did I wrong. How to fix it? Thanks
@constraintref restrição[1:2]
for j=1:2
@constraint(m, restrição[j], sum(A[j,i]*x[i] for i=1:3) <= b[j])`
end
```
guys,I wrote the code and got the following error: @constraint is not defined. What did I wrong. How to fix it? Thanks
@constraintref restrição[1:2]
for j=1:2
@constraint(m, restrição[j], sum(A[j,i]*x[i] for i=1:3) <= b[j])`
end
```
You are using an old syntax that was valid in JuMP 0.18 (you can see the link for more details)
As of today you can just use an assignment operator instead of @constraintref
macro and your code could look like this:
using GLPK
m = Model(with_optimizer(GLPK.Optimizer))
@variable(m, x[1:5] >= 0)
myCons = Vector{ConstraintRef}(undef, 5)
for i = 1:5
myCons[i] = @constraint(m, x[i] >= i)
end