I am having trouble passing a custom objective function to MOI. Here’s an example:
struct dumbEval <: MOI.AbstractNLPEvaluator end
e = dumbEval();
nlpBlockData = MOI.NLPBlockData([], e, true);
o = Ipopt.Optimizer();
x = MOI.add_variable(o);
MOI.set(o, MOI.NLPBlock(), nlpBlockData)
function MOI.initialize(e::dumbEval, requested_features::Vector{Symbol})
return nothing
end
function MOI.features_available(e::dumbEval)
return []
end
function MOI.eval_objective(e::dumbEval, x)
return 1.0
end
MOI.optimize!(o)
Ipopt evaluates the objective at 0.0, instead of 1.0. What am I doing wrong?
which I was assuming would just default to MIN…
I appreciate how much easier JuMP is to use, but I want (custom) Hessians of nonlinear, multivariate functions, which only seem to be possible through MOI directly.