mechmotum / cyipopt

Cython interface for the interior point optimzer IPOPT
Eclipse Public License 2.0
227 stars 54 forks source link

ENH: minimize_ipopt: add `callback` support` #230

Closed mdhaber closed 6 months ago

mdhaber commented 11 months ago

Adds support for callback to minimize_ipopt.

Currently, minimize supports two callback interfaces.

image

This adds support only for the first. The second is only retained in SciPy for backward compatibility.

Is there a way to gracefully terminate optimization? Ideally, when the callback function raises StopIteration, minimize_ipopt would terminate and return the current solution.

moorepants commented 11 months ago

Is there a way to gracefully terminate optimization? Ideally, when the callback function raises StopIteration, minimize_ipopt would terminate and return the current solution.

Maybe this new functionality could help with that: https://github.com/mechmotum/cyipopt/pull/215 ?

mdhaber commented 11 months ago

Maybe this new functionality could help

Hmm, maybe, but depending on when it's called, it sounds like it will cut the step size instead of terminating. Maybe there is another option to control that. I think I'll leave it for a follow-up though.