JuMP problem with all_variables

Hi, I am trying to use all_variables but I get the following error message:

UndefVarError: all_variables not defined

Stacktrace:
[1] getproperty(::Module, ::Symbol) at ./sysimg.jl:13
[2] top-level scope at In[83]:1

The JuMP version I am using is JuMP v0.19.0+ #7c115a2 (https://github.com/JuliaOpt/JuMP.jl.git)

Thank you!

It looks like you might be on an (old) beta-release of JuMP. Run

] rm JuMP
] add JuMP

Once you’ve done that, the following should work.

using JuMP
model = Model()
@variable(model, x)

all_variables(model)

# output

1-element Array{VariableRef,1}:
 x

In future, please read Please read: make it easier to help you.

1 Like

Thank you, Oscar, it worked, and also thank you for the link to improve questions