Skip to content

Numerical Error in Nonlinear Test #2550

Closed
@DimitriAlston

Description

@DimitriAlston

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions