# 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]*(1.12+0.13167*x[8]-0.00667* (x[8])^2)+x[4] == 0.0)
@NLconstraint(m, e3, -0.001*x[4]*x[9]*x[6]/(98-x[6])+x[3] == 0.0)

###Original constraints
##@NLconstraint(m, e4, -(1.098*x[8]-0.038* (x[8])^2)-0.325*x[6]+x[7] == 57.425)
##@NLconstraint(m, e5, -(x[2]+x[5])/x[1]+x[8] == 0.0)

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

# Define linear constraints
@constraint(m, e2, -x[1]+1.22*x[4]-x[5] == 0.0)
@constraint(m, e6, x[9]+0.222*x[10] == 35.82)
@constraint(m, e7, -3*x[7]+x[10] == -133.0)

# Define nonlinear objective
@NLobjective(m, Max, 0.063*x[4]*x[7] - 5.04*x[1] - 0.035*x[2] - 10*x[3] - 3.36*x[5])

# 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"`