I have created a two dimensional variable using the following code.
fnew = Vector{Vector{VariableRef}}(undef, c)
eta = Vector{Vector{VariableRef}}(undef, c)
for i = 1:c
newlines = nm_new[i]
if newlines > 0
fnew[i] = [@variable(TNEP, base_name="fnew[$(i),$k]") for k = 1:newlines]
eta[i] = [@variable(TNEP, binary=true, base_name="η[$(i),$k]") for k = 1:newlines]
end
end
Now I want to make these two variables fnew and eta three dimensional. What’s the best way to do this.
I tried to do this in the following way. However, this results in error.
fnew = Vector{Vector{Vector{VariableRef}}}((undef, r))
eta = Vector{Vector{Vector{VariableRef}}}((undef, r))
for i in rows
newlines = nm_new[i]
if newlines > 0
fnew[i] = [ [@variable(JSTEP, base_name="fnew[$(i),$j,$k]") for j in 1:s] for k in 1:newlines ]
eta[i] = [ [@variable(JSTEP, binary=true, base_name="η[$(i),$j,$k]") for j in 1:s] for k in 1:newlines ]
end
end