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.