Skip to content

Random Error: Unsupported feature Hess #1735

@lseman

Description

@lseman

Hello,

I'm writing a code that have a user-defined gradient function, and solving it with Ipopt.
The problem is that I need to run the file multiple times before it finally works.
Most of the time it just gives me the error:

ERROR: LoadError: Unsupported feature Hess

But when it randomly works, it works as expected.

This behavior can be reproduced by using the sample code in the NLP README page:

using JuMP, Ipopt

model = Model(with_optimizer(Ipopt.Optimizer))

my_square(x) = x^2
my_square_prime(x) = 2x
my_square_prime_prime(x) = 2

my_f(x, y) = (x - 1)^2 + (y - 2)^2
function ∇f(g, x, y)
    g[1] = 2 * (x - 1)
    g[2] = 2 * (y - 2)
end

JuMP.register(model, :my_f, 2, my_f, ∇f)
JuMP.register(model, :my_square, 1, my_square, my_square_prime,
              my_square_prime_prime)

@variable(model, x[1:2] >= 0.5)
@NLobjective(model, Min, my_f(x[1], my_square(x[2])))
JuMP.optimize!.(model);
objetivo = JuMP.objective_value.(model)
print(objetivo)

Metadata

Metadata

Assignees

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