I came across @constraintref macro which was available in older versions of JuMP to generate constraints in a loop. This was removed in latest releases. How could I perform the same functionality in the latest version of JuMP as in the MWE below?

using JuMP
model = Model()
data = [10,11,10,19,15]
@variable(model,x[i=1:5]>=0)
@variable(model,10<=y[i=1:5]<=20)
@constraintref rconstraints[1:10]
for j = 1:5
rconstraints[j] = @constraint(m, y[j]<=data[j])
rconstraints[j+5] = @constraint(m, y[j]<=sum(x[i] for i in j:5))
end

One way could be to define rconstraints as a vector of type Any, but I am not sure what is the correct type to use here.

We removed it. You can create your own data structures, you don’t have to rely on the ones JuMP provides.

using JuMP
model = Model()
data = [10,11,10,19,15]
@variable(model,x[i=1:5]>=0)
@variable(model,10<=y[i=1:5]<=20)
# Option 1 (easiest, probably preferred option)
r_1 = @constraint(model, [j=1:5], y[j] <= data[j])
r_2 = @constraint(model, [j=1:5], y[j] <= sum(x[i] for i in j:5))
rconstraints = vcat(r_1, r_2)
# Option 2 (still an abstract type. Can have issues if one constraint is <= and another >=)
rconstraints = Vector{ConstraintRef}(undef, 10)
for j = 1:5
rconstraints[j] = @constraint(model, y[j] <= data[j])
rconstraints[j+5] = @constraint(model, y[j] <= sum(x[i] for i in j:5))
end