I want to initialize a variable that is indexed by sets of strings to a dictionary with keys that are tuples of those same sets
A = ["cat","dog"]
R = ["E" , "W"]
X0 = Dict(
("cat","E") => 1.1,
("cat","W") => 1.2,
("dog","E") => 1.3,
("dog","W") => 1.4
)
m1 = Model()
@variable(m1, X[A,R], start = X0)
Gives: ERROR: Unable to use Dict...
as the start value of a variable because it is not convertable to type ::Float64
.
If I convert to an array …
nA = length(A)
nR = length(R)
X00 = zeros(2,2)
for i in 1:nA
for j in 1:nR
X00[i,j] = X0[A[i],R[j]]
end
end
@variable(m1, X[A,R], start = X00)
@variable(m1, X[A,R], start = X00[i,j] for i in 1:nA for j in 1:nR)
Gives: ERROR: Passing arrays as variable starts without indexing them is not supported.
And : ERROR: Unrecognized positional arguments…
respectively.
Any thoughts on the best way to do this?