mlpack  git-master
LineSearch Class Reference

Find the minimum of a function along the line between two points. More...

Public Member Functions

 LineSearch (const size_t maxIterations=100000, const double tolerance=1e-5)
 
size_t MaxIterations () const
 Get the maximum number of iterations (0 indicates no limit). More...

 
size_t & MaxIterations ()
 Modify the maximum number of iterations (0 indicates no limit). More...

 
template
<
typename
FunctionType
>
double Optimize (FunctionType &function, const arma::mat &x1, arma::mat &x2)
 Line search to minimize function between two points with Secant method, that is, to find the zero of Derivative(gamma), where gamma is in [0,1]. More...

 
double Tolerance () const
 Get the tolerance for termination. More...

 
double & Tolerance ()
 Modify the tolerance for termination. More...

 

Detailed Description

Find the minimum of a function along the line between two points.

The solver uses the secant method to find the zero of the derivative of the function along the search line.

If the function is convex, the derivative of the function along the search line will be nondecreasing, so the minimum always exists. If the function is strongly convex, the derivative of the function along the search line will be strictly increasing, so the minimum is unique.

Definition at line 30 of file line_search.hpp.

Constructor & Destructor Documentation

◆ LineSearch()

LineSearch ( const size_t  maxIterations = 100000,
const double  tolerance = 1e-5 
)
inline

Definition at line 33 of file line_search.hpp.

References LineSearch::Optimize().

Member Function Documentation

◆ MaxIterations() [1/2]

size_t MaxIterations ( ) const
inline

Get the maximum number of iterations (0 indicates no limit).

Definition at line 54 of file line_search.hpp.

◆ MaxIterations() [2/2]

size_t& MaxIterations ( )
inline

Modify the maximum number of iterations (0 indicates no limit).

Definition at line 56 of file line_search.hpp.

◆ Optimize()

double Optimize ( FunctionType &  function,
const arma::mat &  x1,
arma::mat &  x2 
)

Line search to minimize function between two points with Secant method, that is, to find the zero of Derivative(gamma), where gamma is in [0,1].

The function is assumed to be convex here, otherwise might not converge.

Parameters
functionfunction to be minimized.
x1Input one end point.
x2Input the other end point, also used as output, to store the coordinate of the optimal solution.
Returns
Minimum solution function value.

Referenced by LineSearch::LineSearch(), and UpdateLineSearch::Update().

◆ Tolerance() [1/2]

double Tolerance ( ) const
inline

Get the tolerance for termination.

Definition at line 59 of file line_search.hpp.

◆ Tolerance() [2/2]

double& Tolerance ( )
inline

Modify the tolerance for termination.

Definition at line 61 of file line_search.hpp.


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