Developer documentation
Version 3.0.3-105-gd3941f44
MR::Math::QuadraticLineSearch< ValueType > Class Template Reference

Computes the minimum of a 1D function using a quadratic line search. More...

#include "math/quadratic_line_search.h"

Detailed Description

template<typename ValueType>
class MR::Math::QuadraticLineSearch< ValueType >

Computes the minimum of a 1D function using a quadratic line search.

This functor operates on a cost function class that must define a operator() const method. The method must take a single ValueType argument x and return the cost of the function at x.

This line search is fast for functions that are smooth and convex. Functions that do not obey these criteria may not converge.

The min_bound and max_bound arguments define values that are used to initialise the search. If these bounds do not bracket the minimum, then the search will return NaN. Furthermore, if the relevant function is not sufficiently smooth, and the search begins to diverge before finding a local minimum to within the specified tolerance, then the search will also return NaN.

This effect can be cancelled by calling:

set_exit_if_outside_bounds (false);

That way, if the estimated minimum is outside the current bracketed area, the search area will be widened accordingly, and the process repeated until a local minimum is found to within the specified tolerance. Beware however; there is no guarantee that the search will converge in all cases, so be conscious of the nature of your data.

Typical usage:

CostFunction cost_function();
QuadraticLineSearch<double> line_search (-1.0, 1.0);
line_search.set_tolerance (0.01);
line_search.set_message ("optimising");
const double optimal_value = line_search (cost_function);

Definition at line 72 of file quadratic_line_search.h.

The documentation for this class was generated from the following file: