From your previous post, it looks like W
is an array, which you indexed like W[i]
.
So it doesn’t mean anything, mathematically, to sum \sum\limits_{j \in W}^p x_j. Perhaps you just meant \sum\limits_{j \in W_p} x_j?
If so, the JuMP equivalent is:
@constraint(model, c2, sum(x[j] for j in W[p]) <= p)
.
It’s easier to help if you read Please read: make it easier to help you and can provide a reproducible example.