# JuMP+EAGO+@NLexpressions gives numeric instability

I want to use EAGO.jl as an alternative solver to ipopt for nonlinear problems. I ran the example from the website (GitHub - PSORLab/EAGO.jl: A development environment for robust and global optimization) and it works fine. When I slightly rewrite the problem using `@NLexpressions`, the problem does not work anymore. Running `optimize!()` breaks Julia and gives me: This keeps going on and on, I have to force quit the editor. Any ideas what can be wrong are welcome.

The rewritten problem:

``````using JuMP, EAGO

m = Model(EAGO.Optimizer)

# Define bounded variables
xL = [10.0; 0.0; 0.0; 0.0; 0.0; 85.0; 90.0; 3.0; 1.2; 145.0]
xU = [2000.0; 16000.0; 120.0; 5000.0; 2000.0; 93.0; 95.0; 12.0; 4.0; 162.0]
@variable(m, xL[i] <= x[i=1:10] <= xU[i])

# Define nonlinear constraints
@NLconstraint(m, e1, -x*(1.12+0.13167*x-0.00667* (x)^2)+x == 0.0)
@NLconstraint(m, e3, -0.001*x*x*x/(98-x)+x == 0.0)

###Original constraints
##@NLconstraint(m, e4, -(1.098*x-0.038* (x)^2)-0.325*x+x == 57.425)
##@NLconstraint(m, e5, -(x+x)/x+x == 0.0)

###Rewritten constraints
@NLexpressions(m, begin
ex1, -(x+x)/x+x
ex2, -(1.098*x-0.038* (x)^2)-0.325*x+x
end)
@NLconstraint(m, e4, ex2 == 57.425)
@NLconstraint(m, e5, ex1 == 0.0)

# Define linear constraints
@constraint(m, e2, -x+1.22*x-x == 0.0)
@constraint(m, e6, x+0.222*x == 35.82)
@constraint(m, e7, -3*x+x == -133.0)

# Define nonlinear objective
@NLobjective(m, Max, 0.063*x*x - 5.04*x - 0.035*x - 10*x - 3.36*x)

# Solve the optimization problem
JuMP.optimize!(m)

``````

I should add that if I split the expressions into two separate `@NLexpression`, the problem persists, but if I do only one constraint as `@NLexpression` and the other as `@NLconstraint`, there are no issues.

That is probably an issue with the EAGO solver, you should consider opening an issue in the repo as recommended in the readme EAGO.jl - bug-reporting-support-and-feature-requests. Remember to cross-reference this post.

1 Like

Thank you, that’s probably the best approach. I tried other solvers (ipopt and percival) and ipopt works fine, whereas percival has similar issues as EAGO (but at least runs out of time, doesn’t break Julia). I guess it is a question of how solvers handle `@NLexpressions`.

Solvers don’t get to see `@NLexpression`. What was the issue with Percival?

The “numerical instability” issue is coming from GLPK. I’ve seen it frequently in cutting plane type problems.

Try a different solver: High-Performance Configuration · EAGO.jl: Easy Advanced Global Optimization

Switching to CPLEX didn’t help: Goes on and on again, until I force quit.

Percival runs out of time (the default is 30s) or iterations (the default is 2000). I increased both: the time to 600s and the iterations to 4000. It didn’t help:

And the final status for the increased parameters was `"Execution stats: maximum iteration"`