In my code, I mostly use SparseAxisArray as an equivalent for dictionaries, except that it’s returned by JuMP. Thus, I’m trying to use
keys on a SparseAxisArray, but it’s not behaving as expected, returning a DenseAxisArrayKeys. Actually, the most annoying part in this is when I’m using the
idx in keys(container), which always yields false, even though the index is valid for the container.
eachindex is not really a solution, as it returns a series of CartesianIndex, which I’m not using (I prefer indexing with concrete things that make sense for my optimisation problem, such as an edge in a graph). Using the
container.data field is neither clean nor working; I have to use the original container I used to define the variable (which is sometimes problematic, as it must then get passed around in my code along with JuMP’s container, even though JuMP’s container is supposed to have this information somewhere).
Is there a design decision I missed or a quality-of-life improvement needed?