# Starter example in JuMP

**URL:** <https://discourse.julialang.org/t/starter-example-in-jump/75570>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [February 1, 2022, 11:08am UTC](https://discourse.julialang.org/t/starter-example-in-jump/75570 "2022-02-01T11:08:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonyhur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tonyhur/32/22732_2.png) [@tonyhur](https://discourse.julialang.org/u/tonyhur)\
**Post date:** [February 1, 2022, 11:08am UTC](https://discourse.julialang.org/t/starter-example-in-jump/75570/1 "2022-02-01T11:08:51Z")

</div>

I tested JuMP some times ago an everything went perfect. Now when I retry the small model at:

[https://jump.dev/JuMP.jl/stable/tutorials/getting\_started/getting\_started\_with\_JuMP/](https://jump.dev/JuMP.jl/stable/tutorials/getting_started/getting_started_with_JuMP/)  
I get an error

model = Model(GLPK.Optimizer)  
ERROR: MethodError: no method matching Model(::Type{GLPK.Optimizer})

I have Julia 1.5.3 and of course added the lib JuMP and GLPK to the model.  
I do not understand why this does not work anymore…  
Thanks for help  
Tony

---

<div class="post-metadata">

**Author:** ![lawless-m](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lawless-m/32/30869_2.png) [@lawless-m](https://discourse.julialang.org/u/lawless-m)\
**Post date:** [February 1, 2022, 12:16pm UTC](https://discourse.julialang.org/t/starter-example-in-jump/75570/2 "2022-02-01T12:16:19Z")

</div>

I can’t tell you what’s going wrong, but I can tell you that example works in my Julia 1.7.0

```julia
julia> using JuMP
julia> using GLPK

julia> model = Model(GLPK.Optimizer)
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: GLPK

julia> @variable(model, x >= 0)
x

julia> @variable(model, 0 <= y <= 3)
y

julia> @objective(model, Min, 12x + 20y)
12 x + 20 y

julia> @constraint(model, c1, 6x + 8y >= 100)
c1 : 6 x + 8 y ≥ 100.0

julia> @constraint(model, c2, 7x + 12y >= 120)
c2 : 7 x + 12 y ≥ 120.0

julia> print(model)
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

julia> optimize!(model)

julia> @show termination_status(model)
termination_status(model) = MathOptInterface.OPTIMAL
OPTIMAL::TerminationStatusCode = 1

```

some other basic tests

```julia
julia> using JuMP

julia> Model()
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: NO_OPTIMIZER
Solver name: No optimizer attached.

julia> using GLPK

julia> GLPK.Optimizer
GLPK.Optimizer

```

Beyond that, a bit more of your REPL and the error message might help

---

<div class="post-metadata">

**Author:** ![tonyhur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tonyhur/32/22732_2.png) [@tonyhur](https://discourse.julialang.org/u/tonyhur)\
**Post date:** [February 1, 2022, 1:20pm UTC](https://discourse.julialang.org/t/starter-example-in-jump/75570/3 "2022-02-01T13:20:20Z")

</div>

> [@lawless-m](#):
>
> ```julia
> y
> 
> ```

So then me question is, how to update Julia WITHOUT reinstalling all packages again (I updated them with Pkg.update()).  
I did not find a easy updating way in the Internet.  
Tony

---

<div class="post-metadata">

**Author:** ![lawless-m](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lawless-m/32/30869_2.png) [@lawless-m](https://discourse.julialang.org/u/lawless-m)\
**Post date:** [February 1, 2022, 1:56pm UTC](https://discourse.julialang.org/t/starter-example-in-jump/75570/4 "2022-02-01T13:56:58Z")

</div>

I don’t actually know if it is a version problem

Although 1.5.3 is no longer maintained.

Anyway, upgrading a whole Julia instance is not so simple as “upgrade”

There are quote a few discussions here on Discourse about it

e.g.

> [@Is there a simple Julia upgrade command?](https://discourse.julialang.org/t/is-there-a-simple-julia-upgrade-command/45691/24):
>
> Five minutes of efficiently doing exactly the right things translates to half an hour of googling and swearing, and reading the documentation of symlinks, and searching through the forum after half-remembered advice on package copying. I sometimes postpone updating for weeks or months because of this. Doing something Julia update, is an incredible improvement.

tbh. I use Projects so I am used to regularly installing a bunch of packages for each project as I use it, it’s not so bad

---

<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:** [February 1, 2022, 7:24pm UTC](https://discourse.julialang.org/t/starter-example-in-jump/75570/5 "2022-02-01T19:24:57Z")

</div>

You must have an old version installed.

Check:

```nohighlight
import Pkg
Pkg.status()

```

Then run `import Pkg; Pkg.update()`. The latest version of JuMP is v0.22.2.
