@odow, @dpo, @ChrisRackauckas, sorry for the ping, but I think I got some interesting results.
TL;DR: when operating under JuMP, IPOPT can detect that there was an evaluation error, while under OptimizationMOI and NLPModelsIpopt it cannot.
JuMP constructs a different optimization problem:
- JuMP has 1 less nonzero in inequality constraint Jacobian than the others.
- JuMP has 1 more nonzero in Lagrangian Hessian than the others.
However, IPOPT reports identical objective function values for Optimization, ADNLPModels and JuMP:
iter OptimizationMOI NLPModelsIpopt JuMP
0 1.8621407e+00 1.8621407e+00 1.8621407e+00
1 1.6724881e+00 1.6724881e+00 1.6724881e+00
2 1.5562440e+00 1.5562440e+00 1.5562440e+00
3 1.5191827e+00 1.5191827e+00 1.5191827e+00
4 1.5107919e+00 1.5107919e+00 1.5107919e+00
5 1.5046485e+00 1.5046485e+00 1.5046485e+00
6 1.5073755e+00 1.5073755e+00 1.5073755e+00
7 1.5089724e+00 1.5089724e+00 1.5089724e+00
8 1.5062711e+00 1.5062711e+00 1.5062711e+00
9 1.5072838e+00 1.5072838e+00 1.5072838e+00
10 ERROR ERROR 1.5066406e+00 Warning: SOC step rejected due to evaluation error
Exactly when OptimizationMOI and NLPModelsIpopt sort of… let the DomainError
through, JuMP seems to inform IPOPT about it. This is also seen in this comment: OptimizationMOI Ipopt violating inequality constraint - #19 by odow.
Thus, IPOPT indeed steps outside the feasible region, but it can recover from this situation and continue the optimization process.
Full reproducible code and its full output here: JuMP can use IPOPT to optimize a function, but OptimizationMOI.jl and NLPModelsIpopt.jl cannot · GitHub.
So looks like OptimizationMOI and NLPModelsIpopt should probably signal to IPOPT that there was an evaluation error? JuMP does it and this leads to a solution. Or, since JuMP builds its own representation of the optimization problem, maybe it passes this entire representation to IPOPT somehow.
The point is, when operating under JuMP, IPOPT can detect that there was an evaluation error, while under OptimizationMOI and NLPModelsIpopt it cannot. This could probably be fixed?