Skip to content

Slicing with caching and multiple indices #47

@trulsf

Description

@trulsf

There is a problem with slicing when caching is activated, having three or more indices and slicing on two of them.
The following is a MWE

I = Set(["A", "B", "C", "D"]) 
K = Set(1:1000)

m = Model()
@variable(m, y[I, I, K] >= 0, container = IndexedVarArray)
for _ in 1:1000
    i, j, k = rand(I), rand(I), rand(1:1000)
    unsafe_insertvar!(y, i, j, k)
end

SparseVariables.select(y, :, :, 1000)

Changing the return value of _dropslices_gen to return :(tuple($(exs[end])...)) seems to fix the problem, but may not be the best fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions