Dynamic generation of constraints

Nope. JuMP doesn’t have a concept of base sets like in AMPL. The syntax @constraint(model, mycons[i in 1:2], x[i] >= 1) is just a convenient way of writing the for loop:

@constraintref mycons[1:2]
for i in 1:2 mycons[i] = @constraint(model, x[i] >= 1)
1 Like