This is my model, I am working on building a mathematical model and would like to be able to represent the constraint like this: I[1] I[2] I[3] I[4] I[5] I[6] <=1500
using JuMP, GLPK
m = Model(with_optimizer(GLPK.Optimizer))
c=6
@variable(m,I[1:c],lower_bound=0)
Ii = transpose(I)
@constraint(m, Ii[1:c].<=1500)
Thanks for your help @odow , but the result of compiling the code you submitted is the same result as my code.
When I compile mine and your code, the answer I have is as follows:
6-element Array {ConstraintRef {Model, C, Shape} where Shape <: AbstractShape where C, 1}:
HE [1]-20 NR[1] <= 0.0
HE [2]-20 NR[2] <= 0.0
HE [3]-20 NR[3] <= 0.0
HE [4]-20 NR[4] <= 0.0
HE [5]-20 NR[5] <= 0.0
HE [6]-20 NR[6] <= 0.0
Since I would like to get this answer:
HE[1] <=20NR[1]
....##until you reach
HE[6] <=20NR[6]