Optim.jl
Optim.jl copied to clipboard
Non-exclusive termination codes
I think the current design of termination codes is a bit unfortunate as it does not allow multiple termination codes to be active at the same time. While it is not too unlikely, that at convergence (or when optimization is aborted) multiple criteria (gradient norm, relative/absolute tolerances etc. or e.g. non-finite function value, non-finite gradient and non-finite Hessian) are satisfied, this is not represented by the termination code. The returned code purely depends on the order of the if-else branches in the implementation.
Instead of a simple enum type, I think it might be more appropriate to represent termination codes as bit flags (see e.g. https://github.com/jessymilare/FlagSets.jl).