How to define constraints on a collection of vectors separately?

I guess you want something like

A = [
    [[13, 48,99] , [71, 58, 99]],
    [[91, 59, 22], [94, 86, 22], [71, 58, 22], [19,55,22]],
    [[41, 79, 12], [23, 16, 12], [53, 28, 12]],
]
B = [99, 22, 12]

# The set of all unique indices in A
S = unique(vcat(A...))

model = Model()
@variable(model, x[S])
@constraint(model, [b in B], sum(x[j] for j in S if j[end] == b) >= 2)

# or

model = Model()
@variable(model, x[S])
@constraint(model, [i in 1:length(B)], sum(x[j] for j in A[i]) >= 2)
1 Like