Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numerical Error in Nonlinear Test #2550

Closed
DimitriAlston opened this issue Oct 7, 2024 · 1 comment · Fixed by #2551
Closed

Numerical Error in Nonlinear Test #2550

DimitriAlston opened this issue Oct 7, 2024 · 1 comment · Fixed by #2551

Comments

@DimitriAlston
Copy link

I believe there may be an issue here:

x1 in Interval(-2.001, 9.999)
x2 in Interval(-2.001, 9.999)
x3 in Interval(-2.001, 9.999)
x4 in Interval(-2.001, 9.999)
x5 in Interval(-2.001, 9.999)
x6 in Interval(-2.001, 9.999)
x7 in Interval(-2.001, 9.999)
x8 in Interval(-2.001, 9.999)
x9 in Interval(-2.001, 9.999)
x10 in Interval(-2.001, 9.999)

The interval on each x should be Interval(2.001, 9.999) instead of Interval(-2.001, 9.999) for log(x - 2) to be defined.

Here's an example using Ipopt,

using JuMP, Ipopt
model = Model(Ipopt.Optimizer);

@variable(model, -2.001 <= x[1:10] <= 9.999);

f = log(x[1] - 2)^2 + log(10 - x[1])^2;
for i = 2:10
    f += log(x[i] - 2)^2 + log(10 - x[i])^2
end
f -= (x[1] * x[2] * x[3] * x[4] * x[5] * x[6] * x[7] * x[8] * x[9] * x[10])^0.2;

@objective(model, Min, f);

JuMP.optimize!(model)

which returns EXIT: Invalid number in NLP function or derivative detected.
If the variables are defined as @variable(model, 2.001 <= x[1:10] <= 9.999) instead, then the solution is found.

@odow
Copy link
Member

odow commented Oct 7, 2024

It does look like it should be +2.001 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants