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

jump
#1

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?

#2

Use Julia’s broadcast syntax

JuMP.value.(f1)

See the JuMP docs http://www.juliaopt.org/JuMP.jl/v0.19/solutions/#Obtaining-solutions-1

2 Likes
#3

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
#4

Thank you!!

#5

I see! Thank you!