How to get value of a Dict() after optimization in Julia 1.1.0

I’m using JuMP to solve an optimization problem using Julia 1.1.0. I expressed my variable in dictionary form so I can see which variable gets picked. When I do the optimization on my Mac, I’m able to see the result using getvalue() command after the optimization finishes, as shown below
49%20PM
However, when I perform the optimization on Windows, first I have to use JuMP.value(), because getvalue() is deprecated, but then it wouldn’t let me check the value of the dictionary form variable. The error message is shown in the image below


Does anyone know how to get around this?

Use Julia’s broadcast syntax

JuMP.value.(f1)

See the JuMP docs Query Solutions · JuMP

2 Likes

To be clear, those variables aren’t stored in a Dict, but in a JuMP.Containers.DenseAxisArray, which is why broadcasting makes sense in this case (it wouldn’t if it were truly a Dict).

3 Likes

Thank you!!

I see! Thank you!