jump-dev / Ipopt.jl

A Julia interface to the Ipopt nonlinear solver
https://github.com/coin-or/ipopt
Other
149 stars 58 forks source link

Get number of iterations after optimization #388

Closed ojwoodford closed 9 months ago

ojwoodford commented 9 months ago

It would be great to have a way to retrieve the number of iterations that Ipopt performed during an optimization. This can be useful to understand whether a particular cost function is either slow to evaluate or slow to converge. It can also be used to have a more fine-grained comparison between optimizers.

odow commented 9 months ago

This is not implemented because Ipopt does not provide a nice way of accessing after a solve.

The recommended alternative is to write a solver-specific callback: https://github.com/jump-dev/Ipopt.jl#solver-specific-callbacks

I don't know if the iteration could is a reasonable comparison between solvers. Ipopt may use multiple functions evaluations per iteration.

To debug a solve, you generally need to look at the log and see how the barrier is progressing. It isn't as simple as a metric like iterations/second.

Is this so you can compare with NNLS?

ojwoodford commented 9 months ago

Is this so you can compare with NNLS?

So I can compare with other solvers on non-linear least squares problems, yes.

I can see the number of iterations in the log. It's pretty comparable with other methods. It's always useful to see how much work a particular solver is able to do per "iteration", whatever that happens to mean in the context of a particular solver.

odow commented 9 months ago

See https://github.com/jump-dev/Ipopt.jl/pull/389