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

Containers can't index when key is Vector{Any} #3279

Closed
odow opened this issue Mar 10, 2023 · 0 comments · Fixed by #3280
Closed

Containers can't index when key is Vector{Any} #3279

odow opened this issue Mar 10, 2023 · 0 comments · Fixed by #3280
Labels
Category: Containers Related to the Containers submodule Type: Bug

Comments

@odow
Copy link
Member

odow commented Mar 10, 2023

Reported on SO: https://stackoverflow.com/questions/75692147/why-is-my-program-searching-for-this-key

julia> using JuMP

julia> key = Any[Any["macros", 1], "Outsized_Equipment"]
2-element Vector{Any}:
 Any["macros", 1]
 "Outsized_Equipment"

julia> K = Any[key]
1-element Vector{Any}:
 Any[Any["macros", 1], "Outsized_Equipment"]

julia> model = Model();

julia> @variable(model, x[K])
1-dimensional DenseAxisArray{VariableRef,1,...} with index sets:
    Dimension 1, Any[Any[Any["macros", 1], "Outsized_Equipment"]]
And data, a 1-element Vector{VariableRef}:
 x[Any[Any["macros", 1], "Outsized_Equipment"]]

julia> x[key]
ERROR: KeyError: key "macros" not found
Stacktrace:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Containers Related to the Containers submodule Type: Bug
Development

Successfully merging a pull request may close this issue.

1 participant