# Error (optimize! not defined) using JuMP optimizing routines

**URL:** <https://discourse.julialang.org/t/error-optimize-not-defined-using-jump-optimizing-routines/65975>\
**Category:** Optimization (Mathematical)\
**Created:** [August 7, 2021, 2:33am UTC](https://discourse.julialang.org/t/error-optimize-not-defined-using-jump-optimizing-routines/65975 "2021-08-07T02:33:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter-Jolly](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/peter-jolly/32/19371_2.png) [@Peter-Jolly](https://discourse.julialang.org/u/Peter-Jolly)\
**Post date:** [August 7, 2021, 2:33am UTC](https://discourse.julialang.org/t/error-optimize-not-defined-using-jump-optimizing-routines/65975/1 "2021-08-07T02:33:51Z")

</div>

Hi,

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

```julia
import Pkg
Pkg.add("JuMP")
Pkg.add("GLPK")

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)
print(model)
optimize!(model)
@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
Stacktrace:
 [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

julia> 

```

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [August 8, 2021, 4:00am UTC](https://discourse.julialang.org/t/error-optimize-not-defined-using-jump-optimizing-routines/65975/2 "2021-08-08T04:00:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Peter-Jolly](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/peter-jolly/32/19371_2.png) [@Peter-Jolly](https://discourse.julialang.org/u/Peter-Jolly)\
**Post date:** [August 8, 2021, 4:30am UTC](https://discourse.julialang.org/t/error-optimize-not-defined-using-jump-optimizing-routines/65975/3 "2021-08-08T04:30:11Z")

</div>

Thanks. Resolved
