I'd like to define a binary variable x_ijk
where i in I
is an n-element Vector{Vector{Int64}}, k in K
is an n-element Vectors, and j in J
is a m-elemts vectors.
Always the length of K
is equal to the number of vectors in I
. How to index over each elements of the nth
vector in I
with the nth
elemnts in K
pairwise?
For Example:
I = [[2,6,5], [1,2,4,5,9]]
J = [1,2,3]
K = [4,5] # for a better explanation suppose K = [a,b]
How to have the variables with index every entries in every vectorI
?
What I'd like to have is like this:
# for a better explanation suppose K = [a,b]
# for each vector in I and associated elemnts in K having a variable
# for first pair (i.e. I=[2,6,5] ,K = a)
x[2,1,a], x[2,2,a], x[2,3,a], x[6,1,a], .... x[5,3,a] # in other words we cannot have x[2,1,b] or any other combination with `b`
# for second pair ( i.e. I=[1,2,4,5,9] ,K = b)
x[1,1,b], x[1,2,b],..., x[4,1,b], .... x[9,3,b]
My last try was unsuccsful too:
for idx in 1:length(K)
@variable(model, x[i in I[idx], j in J, k in K] >= 0, Bin)
end