Unsupported feature Hess with user-defined functions using JuMP and Alpine

I am trying to use a global solver Alpine in JuMP with user-registered functions. I am getting the same error as mentioned in this Github issue and here discourse post for the same error for Ipopt. The code that reproduces the error is the same as in the links:

using JuMP, Alpine

model = Model(Alpine.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)

Would this be a JuMP or Alpine issue? The same example works fine with Ipopt.

Edit. I jsut checked MadNLP (other nonlinear solver) and got the same error as with Alpine.

This is a bug in Alpine and MadNLP. When initializing their problem, they should check features_available to see what callbacks they can access. In this case, :Hess is not in features_available, so attempting to initialize it will return an unsupported feature.

using JuMP

model = Model()

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])))

julia> e = NLPEvaluator(model)
"A JuMP.NLPEvaluator"

julia> MOI.features_available(e)
4-element Vector{Symbol}:
 :Grad
 :Jac
 :JacVec
 :ExprGraph

I opened an issue for Alpine: https://github.com/lanl-ansi/Alpine.jl/issues/176

What was the error from MadNLP? It. looks like they should throw “Hessian information needed”, not the same error as Alpine.
https://github.com/MadNLP/MadNLP.jl/blob/86eba3dbd29885c0705c0a62028f5c716fa629f1/src/Interfaces/MOI_interface.jl#L1112-L1113

Thank you, that explains it.

And yes, I must have looked at the wrong error message for MadNLP, this is what I am getting:
image
I will open an issue with them pointing to your solution for Alpine.

@blob, thanks for pointing out the issue. I was wondering if this resolved the underlying issue of finding global optimal solutions of the original mathematical program?

Hi, @ccoffrin no, not really. I am running into other issues with Alpine, but they mostly boil down to the functions that are supported by Alpine/underlying solvers (I think so at least). I will open another topic with an MWE.