Count the number of evauations of the objective function

Hello, I am using JuMP with the Ipopt solver to optimize certain optimization problem. And I need to get the number of evaluations of the objective function. When I run my program I get some information such as:

Number of objective function evaluations             = 16
Number of objective gradient evaluations             = 9
Number of equality constraint evaluations            = 0
Number of inequality constraint evaluations          = 16
Number of equality constraint Jacobian evaluations   = 0
Number of inequality constraint Jacobian evaluations = 1
Number of Lagrangian Hessian evaluations             = 2
Total CPU secs in IPOPT (w/o function evaluations)   =     10.678
Total CPU secs in NLP function evaluations           =      3.843

But this information is given just as a text. I want to know if there is a way to ask for the Number of objective function evaluations

Thanks

No one knows anything about this???

Hi Ariel,

you can transform the problem into an NLPModel and then run Ipopt through NLPModelsIpopt.
The number of function evaluations is obtainable through neval_obj(nlp).
Short example:

using NLPModels, NLPModelsIpopt, NLPModelsJuMP

# Define your jump_model
nlp = MathOptNLPModel(jump_model)
output = ipopt(nlp)
neval_obj(nlp)

For more information, here are the docs of NLPModels, and in this video and the ones after, I create a solver and compare it against Ipopt, so some parts are useful.

2 Likes

I don’t think there is an easy way to get this from Ipopt and JuMP.