Can not Run nonlinear optimization example using Ipopt

I am new to Julia and recently try to learn to do optimization using JuMP.
I use the Quadratically constrained programs example in JuMP document website.

using JuMP
import Ipopt
import Test

function example_qcp(; verbose = true)
model = Model(Ipopt.Optimizer)
@variable(model, x)
@variable(model, y >= 0)
@variable(model, z >= 0)
@objective(model, Max, x)
@constraint(model, x + y + z == 1)
@constraint(model, x * x + y * y - z * z <= 0)
@constraint(model, x * x - y * z <= 0)
if verbose
println("Objective value: ", objective_value(model))
println("x = ", value(x))
println("y = ", value(y))
Test.@test termination_status(model) == LOCALLY_SOLVED
Test.@test primal_status(model) == FEASIBLE_POINT
Test.@test objective_value(model) ≈ 0.32699 atol = 1e-5
Test.@test value(x) ≈ 0.32699 atol = 1e-5
Test.@test value(y) ≈ 0.25707 atol = 1e-5

When I run it in Jupyterlab, it says run out of memory, and I also tried vscode, it keeps
running without any answer.
How can I fix this problem to solve the optimization?

Cannot reproduce (see below), the first run of the model takes a few seconds because of precompilation, while the second run solves in 0.01 seconds, with 2kb memory allocated so it seems unlikely that this small problem would run out of memory?

Are you on the latest versions of Julia and all packages?

julia> example_qcp()

This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Eclipse Public License (EPL).
         For more information visit

Max x
Subject to
 x + y + z == 1.0
 x² + y² - z² <= 0.0
 x² - z*y <= 0.0
 y >= 0.0
 z >= 0.0
Objective value: 0.32699283491387243
x = 0.32699283491387243
y = 0.2570658388068964

(jl_JTiMl3) pkg> st
      Status `...\Temp\jl_JTiMl3\Project.toml`
  [b6b21f68] Ipopt v0.9.1
  [4076af6c] JuMP v0.22.2

julia> versioninfo()
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)

Thanks for the reply.
I am using Julia 1.7.1, JuMP v0.21.10, Ipopt v0.6.3.

julia> versioninfo()
Julia Version 1.7.1
Commit ac5cc99908 (2021-12-22 19:35 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core™ i7-9750H CPU @ 2.60GHz
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake).

I installed the Ipopt solver directly using add Ipopt.
Is it because the solver I installed is old, I saw you are
using Ipopt v0.9.1?

I have updated JuMP and Ipopt packages.
It’s Ok now. Before I installed several other packages
which limits them to update to the latest version.
I have obtained the solutions:
Obj value: 0.32699283491387243 x= 0.32699283491387243 y= 0.2570658388068964

1 Like