Skip to content

Add "xtol" and "ftol" stopping criteria for optimisers #1502

@MichaelClerx

Description

@MichaelClerx

Many implemented optimisers provide stopping criteria based on the difference between the last two parameter sets (abs(x[i] - x[i - 1]) or the last two function evaluations (abs(f[i] - f[i - 1])). When comparing methods from PINTS with other methods, it is useful to have something similar.

How do people define xtol and ftol?

Absolute versus relative

Occasionally, relative differences are used, e.g. abs(f[i] - f[i - 1]) / f[i].

Scalar xtol?

In nlopt, xtol can be a scalar, in matlab it looks like it needs to have size n_parameters.

AND vs OR

In scipy's Nelder-mead, xtol AND ftol must be met. Everywhere else they are independent stopping criteria https://stackoverflow.com/questions/43644797/what-is-xtol-for-in-minimizemethod-nelder-mead

Proposal

  1. Add xtol and ftol as separate, independent criteria (so OR, not AND)
  2. They will not be set by default, so users can enable them (or disable them) for methods and problems where they think this is appropriate
  3. Adding relative versions means doubling the workload, and dealing with the case where x or f has 0 at its optimum. The only benefit is that the user can write set_xtol(generic_tol) instead of set_xtol(abs_tol / sensible_scaling_value). I propose we do absolute only, leaving scaling to the user (who has the info needed for this decision)
  4. Similarly, allowing a scalar xtol is more implementation/documentation/tests/maintenance/room-for-bugs, all for the sake of a user writing set_xtol(tol) instead of set_xtol([tol] * n_parameters). So xtol always n_parameters, ftol always scalar.

Both matlab and scipy seem to be phasing out the "xtol"/"ftol" terminology (i.e. scipy is using xatol/ratol when relative, matlab is saying "StepTolerance"/"FunctionTolerance", so might follow that and

  1. Call the methods set_step_tolerance and set_function_tolerance. The current names are max_iterations, max_evaluations, max_unchanged_iterations, and threshold (stop if f < threshold). So could have set_step_tolerance and set_tolerance instead? Or set_min_step and set_min_change ?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions