Hi,
I was wondering whether there is a smart solution for adding variables with “nonsquare” dimensions.
A minimal example:
using JuMP
testset=[("a","b"), ("c","d")]
indices=["a","b","c","d"]
m = Model()
v=@variable(m,
v[
i1 in indices,
i2 in indices;
(i1,i2) in testset]
)
print(v["a","b"])
Now I am looking for a more convenient way for adding the variable v just for the indices [“a”,“b”] and [“c”, “d”], e.g. something like that (what will raise an error)
v2=@variable(m,
v[(i1,i2)... for [i1,i2] in testset]
)