Error (optimize! not defined) using JuMP optimizing routines


I am trying out the examples in Julia documentation concerning JuMP. I get the same error no matter whether I use the linear or non linear examples(below is the linear example taken from the documentation: The error is “LoadError: UndefVarError: optimize! not defined”. Hoping someone can help. Thanks Peter

import Pkg

using JuMP
using GLPK
model = Model(GLPK.Optimizer)
@variable(model, x >= 0)
@variable(model, 0 <= y <= 3)
@objective(model, Min, 12x + 20y)
@constraint(model, c1, 6x + 8y >= 100)
@constraint(model, c2, 7x + 12y >= 120)
@show termination_status(model)
@show primal_status(model)
@show dual_status(model)
@show objective_value(model)
@show value(x)
@show value(y)
@show shadow_price(c1)
@show shadow_price(c2)
Precompiling project...
  3 dependencies successfully precompiled in 15 seconds (210 already precompiled)
Min 12 x + 20 y
Subject to
 c1 : 6 x + 8 y >= 100.0
 c2 : 7 x + 12 y >= 120.0
 x >= 0.0
 y >= 0.0
 y <= 3.0
ERROR: LoadError: UndefVarError: optimize! not defined
 [1] top-level scope
   @ c:\Users\peter\Documents\Julia_Code\MPC_Development\Linear_Optimization.jl:15
in expression starting at c:\Users\peter\Documents\Julia_Code\MPC_Development\Linear_Optimization.jl:15


What is Pkg.status()? It looks like you’ve installed an old version of jump somehow, so you should update your packages.

Thanks. Resolved

1 Like