Ow, okay. I see.
I was trying to do an example smaller and I identify that error.
The error is that I use some equations like that:
![]()
DELTA is my variable. When DELTA==0, the denominator become zero.
Trying to write an example closer to my code, it would be something like
using DataFrames, XLSX, JuMP, Ipopt, Juniper
optimizer = Juniper.Optimizer
nl_solver = optimizer_with_attributes(Ipopt.Optimizer, “print_level” => 0)
model = Model(optimizer_with_attributes(optimizer, “nl_solver”=>nl_solver))
@variable(model, DELTA[1:5], Bin)
FLOW = [321,123,34,646,324]
DN = [150, 170, 200, 400, 250]
ALPHA =
for i in 1:5
alpha = @NLexpression(model,((FLOW[i]DELTA[i])/1000)/(3.14159265359((DN[i]*DELTA[i])/2000)^2))
push!(ALPHA, alpha)
end
@NLconstraint(model, DELTA[2]==0)
@NLconstraint(model, DELTA[5]==0)
@NLobjective(model, Min, sum(ALPHA[i] for i in 1:5))
optim = optimize!(model)
If run just the base code, without the JuMP arguments, it appears the NaN.

Do you know a way I can fix that? I cannot change the equations.