I wonder why is the y
below so complicated, unlike x
.
julia> using JuMP
julia> model = Model();
julia> @variable(model, x[1:3]); x
3-element Vector{VariableRef}:
x[1]
x[2]
x[3]
julia> R = 1:3
1:3
julia> @variable(model, y[R]); y
1-dimensional DenseAxisArray{VariableRef,1,...} with index sets:
Dimension 1, 1:3
And data, a 3-element Vector{VariableRef}:
y[1]
y[2]
y[3]
julia> typeof(y)
JuMP.Containers.DenseAxisArray{VariableRef, 1, Tuple{UnitRange{Int64}}, Tuple{JuMP.Containers._AxisLookup{Tuple{Int64, Int64}}}}
Moreover, if I want an x
-like outcome for y
, what code should I write?
Maybe something like @variable(model, y[$R])
? (is there a correct style?)