Davor Josipovic
Davor Josipovic

Reputation: 5504

Correct way for excluding constraints based on index

Assume the following constraint:

@constraint(model, [i=1:5,j=1:5], a[i] <= b[j])

How do I exclude constraint where i == j from the above? This is simple to do in AMPL but I can't find any similar syntax in JuMP.

Upvotes: 1

Views: 81

Answers (1)

mlubin
mlubin

Reputation: 953

@constraint(model, [i=1:5, j=1:5; i != j], a[i] <= b[j])

Upvotes: 3

Related Questions