Search code examples
dictionaryjuliajulia-jump

Why is my program searching for this key?


I have a program written in julia, and I cannot figure out why I am getting a key error. The relevant portion of the code is shown below:

try
    println("THIS IS s[ [j, k] ]: ", s [ [j, k] ])
catch e 
    println("THIS IS s: ", s)
    println("THIS IS j: ", j)
    println("THIS IS k: ", k)
    println("THIS IS [j, k]: ", [j, k])

And I get the following output, which given that I am using try-catch means that it found an error:

enter image description here

Without doing a try-catch structure, it gives me the following error:

enter image description here

I do not understand why it would try to use "macross_base" as a key even to search for within s when the key we give is [j, k] which is [["macross_base", 50400], "Oversized_Equipment"]. Any clarification would be much appreciated.


Solution

  • This is a bug in JuMP: https://github.com/jump-dev/JuMP.jl/issues/3279.

    As a work-around, don't create Vector{Any}.

    Create tuples as the keys instead:

    key = (("macros", 1), "Outsized_Equipment")