# JuMP - with\_optimizer method not working

**URL:** <https://discourse.julialang.org/t/jump-with-optimizer-method-not-working/17055>\
**Category:** General Usage\
**Created:** [November 1, 2018, 2:24pm UTC](https://discourse.julialang.org/t/jump-with-optimizer-method-not-working/17055 "2018-11-01T14:24:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Altaf\_Sultanji](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@Altaf\_Sultanji](https://discourse.julialang.org/u/Altaf_Sultanji)\
**Post date:** [November 1, 2018, 2:24pm UTC](https://discourse.julialang.org/t/jump-with-optimizer-method-not-working/17055/1 "2018-11-01T14:24:12Z")

</div>

Trying to run this very basic code as is from JuMP / examples in side Jupyter Notebook, but getting this “UndefVarError: with\_optimizer not defined” error. Any idea what is missing or going wrong ?

using JuMP, GLPK, LinearAlgebra

# Maximization problem

solver = GLPK.Optimizer  
m = Model(with\_optimizer(solver))

@variable(m, x[1:5], Bin)

profit = [5, 3, 2, 7, 4]  
weight = [2, 8, 4, 2, 5]  
capacity = 10

############################################  
UndefVarError: with\_optimizer not defined

Stacktrace:  
[1] top-level scope at In[4]:4

##########################################

Thanks.

---

<div class="post-metadata">

**Author:** ![oliver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oliver/32/19264_2.png) [@oliver](https://discourse.julialang.org/u/oliver)\
**Post date:** [November 1, 2018, 8:50pm UTC](https://discourse.julialang.org/t/jump-with-optimizer-method-not-working/17055/2 "2018-11-01T20:50:24Z")

</div>

What is the original link to the example?

---

<div class="post-metadata">

**Author:** ![mbesancon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbesancon/32/6528_2.png) [@mbesancon](https://discourse.julialang.org/u/mbesancon)\
**Post date:** [November 1, 2018, 10:01pm UTC](https://discourse.julialang.org/t/jump-with-optimizer-method-not-working/17055/3 "2018-11-01T22:01:12Z")

</div>

Check that you are using JuMP v0.19 (which is still in alpha-release) or JuMP master, `with_optimizer` is the new syntax for it and is not available in JuMP v0.18.
