Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slicing with caching and multiple indices #47

Open
trulsf opened this issue Jan 14, 2025 · 1 comment
Open

Slicing with caching and multiple indices #47

trulsf opened this issue Jan 14, 2025 · 1 comment

Comments

@trulsf
Copy link
Member

trulsf commented Jan 14, 2025

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.

@trulsf
Copy link
Member Author

trulsf commented Jan 14, 2025

There is also an issue with slicing on all indices, that currently fails due to the pattern being mapped to a cache index of 0. It should preferably just return all elements without any caching, or maybe have an offset of one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant