I’d like to combine three thing; a Vector{Tuple{Int64, Int64}}
, Vector{Vector{Int64}}
, and a Vector{Int64}
under some condition to be able to create a new tuple; in other words; a Vector{Tuple{Int64, Int64, Int64}}
. And then define a variable x(i,j,k)
on them.
For example, if we have the following:
# A is the condition
A = [(1, 2), (1, 3),
(2, 1), (2, 7), (2, 8), (2, 4),
(3, 4), (3,5), (4,3) (4,2), (4,6),(4,9),
(5,6), (7,8), (7,10), (8,9), (8,10), (9,10)]
# These are thing that we want to combine them
B = [ 2,9]
C = [ [1,7,3,4], [4,10,1,2,6,7]]
D = [12,15]
We are interested in a tuples like (i,j,k)
which satisfy these conditions: i in B
, j in C
, k in D
and (i,j) in A
In the above case, therefore will result in the following:
[ # for k =12
[(2,1,12), (2,7,12), (2,4,12)] ,
# for k =15
[(9,10,15)]
]
I’ve trired to first filter out those combination of (i,j)
which are satisfy three condition of i in B && j in C && (i,j) in A
and then put them together with additional index over k in D
. But it throw an error every time.
Do you know of any better way?