Hello there,
I kindly need help with my code. The following is a piece of my model. The entire model is quite lengthy, so I do not wish to bore you with that. The error (stated immediately below) :
julia> for (key, value) in w
@constraint(m, (value*(sum(d[i,j]*x[i,j] for i=1:V, j=1:V )-29)/29) <= Q)
end
ERROR: BoundsError
Stacktrace:
[1] getindex(::Float64, ::Int64, ::Int64) at .\number.jl:43
[2] macro expansion at C:\Users\XX67\.julia\v0.6\JuMP\src\parseExpr_staged.jl:508 [inlined]
[3] macro expansion at C:\Users\XX67\.julia\v0.6\JuMP\src\macros.jl:493 [inlined]
[4] macro expansion at .\REPL[327]:2 [inlined]
[5] anonymous at .\<missing>:?
It appears to be coming from the portion of my code listed below. I shall, therefore, be very grateful for your assistance in what I am doing wrong. Thank you in advance for the help.
V = 5
d =
1 2 3 4 5
999 8 4 9 9
8 999 6 7 10
4 6 999 5 6
9 7 5 999 4
9 10 6 4 999
## define Variables:------------#
@variable(m, x[i=1:V,j=1:V], Bin) #decision binary variable
@variable(m, 0.0<=Q<=1.0) #mini_max variable
#3 Assign weights:________________________________#
w = Pair{Tuple{Int64,Int64},Float64}[]
for i=1:V , j=1:V
push!( w , (i,j) => i != j ? 0.00001 : 0.00003)
end
## define Objective function:---------------#
@objective(m, Min, Q) #variable for the min_max weighted percentage deviation from the target values for the goals.
## MOLP/MOMP Goal/target contraints:----
for (key, value) in w
@constraint(m, (value*(sum(d[i,j]*x[i,j] for i=1:V, j=1:V )-29)/29) <= Q)
end