JuMP with Ipopt - Error "The equality constraints contain an invalid number"

Hi there,

I am trying to solve the following system of nonlinear equations

      using JuMP, Ipopt
      c = Model(with_optimizer(Ipopt.Optimizer,max_cpu_time=500.0))
     @variable(c,x)
     @variable(c,y)
     @NLconstraint(c,(1/x)*(2+(0.5)/(x-y)-y^2) == 0) 
     @NLconstraint(c,(1/(x^2))*(-2*y -(0.5)*(y/(x-y))+(1/3)*y^3+0.5*log(x-y)) == 0)
     @NLconstraint(c, x >= y + 0.001) 
     optimize!(c) 

but I get an error message, “The equality constraints contain an invalid number”. I cannot understand what is being referred to.

Any hint would be most appreciated, thanks

x is allowed to be 0, so you have a divide by zero error with 1/x.

Ipopt assumes that your model is differentiable over the domain.

Hi there,

thanks for that. I did think about that: in fact, adding one more constraint

                    @NLconstraint(c, x >=  0.001) 

does not improve things much, what I am missing? Ipopt assumes the model is differentiable everywhere, but can this be relaxed via NL constraints?
Will read some more documentation.

Thanks again

See Some JuMP variables values are out of bounds

1 Like

Got it, working beatifully now, thanks a lot.

In fact, IPOPT assumes everything is differentiable everywhere, not just on the feasible set. It’s an infeasible method.