BoundsError: attempt to access 2×2 Array{Int64,2} at index [1, 3]
using JuMP, Cbc
Model1 = Model(with_optimizer(Cbc.Optimizer))
t = 4
w = 2
T = 1:t
W = 1:w
WH = [2489 1447; 11073 5414]
@variable(Model1,wr[W,T], lower_bound=0)
@variable(Model1,wo[W,T], lower_bound=0)
for w = 1:2,t= 1:4
n = @constraint(Model1,wr[w,t]+wo[w,t]==WH[w,t])
println(n)
end
WH is a 2x2 matrix, but in the for loop you are trying to access element WH[1, 3] (with w =1, t = 3) . You need either a 2x4 matrix for WH or declare the constraints in such a way that fits with the size of WH.