I’m having a problem with SparsesAxisArray JuMP on Julia for Vscode.
When I use @variable with this condition below, it reproduces an error
using Gurobi, JuMP
model = Model(Gurobi.Optimizer)
n = 5
V = 1:n
V0= 1:n+1
@variable(model, x[i in V0, j in V; i != j], Bin) #this not work
Defines: JuMP.Containers.SparseAxisArray{VariableRef,2,Tuple{Int64,Int64}} with 25 entries:
but in the end, reproduces:
Internal Error: ERROR: MethodError: no method matching size(::JuMP.Containers.SparseAxisArray{VariableRef,2,Tuple{Int64,Int64}})
Closest candidates are:
size(::AbstractArray{T,N}, ::Any) where {T, N} at abstractarray.jl:38
size(::BitArray{1}) at bitarray.jl:99
size(::BitArray{1}, ::Integer) at bitarray.jl:103
I figured out that if i return to previous version 0.15.40 of Julia package on Vscode, this code works perfectly. Any suggestions?
I don’t understand where the error comes from. Why do you need to call size in your example ?
@pfitzseb We could implement size and axis for SparseAxisArray but that would require a little bit of bookkeeping and we have no convincing use case yet. Accessing it with the axis would not be a good idea anyway since it is sparse hence one should not go through the cartesian product of the axis.