mlpack  2.2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
L_BFGS< FunctionType > Class Template Reference

The generic L-BFGS optimizer, which uses a back-tracking line search algorithm to minimize a function. More...

Inheritance diagram for L_BFGS< FunctionType >:
Inheritance graph
[legend]

Public Member Functions

 L_BFGS (FunctionType &function, const size_t numBasis=10, const size_t maxIterations=10000, const double armijoConstant=1e-4, const double wolfe=0.9, const double minGradientNorm=1e-6, const double factr=1e-15, const size_t maxLineSearchTrials=50, const double minStep=1e-20, const double maxStep=1e20)
 Initialize the L-BFGS object. More...
 
double ArmijoConstant () const
 Get the Armijo condition constant. More...
 
double & ArmijoConstant ()
 Modify the Armijo condition constant. More...
 
double Factr () const
 Get the factr value. More...
 
double & Factr ()
 Modify the factr value. More...
 
const FunctionType & Function () const
 Return the function that is being optimized. More...
 
FunctionType & Function ()
 Modify the function that is being optimized. More...
 
size_t MaxIterations () const
 Get the maximum number of iterations. More...
 
size_t & MaxIterations ()
 Modify the maximum number of iterations. More...
 
size_t MaxLineSearchTrials () const
 Get the maximum number of line search trials. More...
 
size_t & MaxLineSearchTrials ()
 Modify the maximum number of line search trials. More...
 
double MaxStep () const
 Return the maximum line search step size. More...
 
double & MaxStep ()
 Modify the maximum line search step size. More...
 
double MinGradientNorm () const
 Get the minimum gradient norm. More...
 
double & MinGradientNorm ()
 Modify the minimum gradient norm. More...
 
const std::pair< arma::mat,
double > & 
MinPointIterate () const
 Return the point where the lowest function value has been found. More...
 
double MinStep () const
 Return the minimum line search step size. More...
 
double & MinStep ()
 Modify the minimum line search step size. More...
 
size_t NumBasis () const
 Get the memory size. More...
 
size_t & NumBasis ()
 Modify the memory size. More...
 
double Optimize (arma::mat &iterate)
 Use L-BFGS to optimize the given function, starting at the given iterate point and finding the minimum. More...
 
double Optimize (arma::mat &iterate, const size_t maxIterations)
 Use L-BFGS to optimize (minimize) the given function, starting at the given iterate point, and performing no more than the given maximum number of iterations (the class variable maxIterations is ignored for this run, but not modified). More...
 
double Wolfe () const
 Get the Wolfe parameter. More...
 
double & Wolfe ()
 Modify the Wolfe parameter. More...
 

Detailed Description

template<typename FunctionType>
class mlpack::optimization::L_BFGS< FunctionType >

The generic L-BFGS optimizer, which uses a back-tracking line search algorithm to minimize a function.

The parameters for the algorithm (number of memory points, maximum step size, and so forth) are all configurable via either the constructor or standalone modifier functions. A function which can be optimized by this class must implement the following methods:

Definition at line 34 of file lbfgs.hpp.

Constructor & Destructor Documentation

L_BFGS ( FunctionType &  function,
const size_t  numBasis = 10,
const size_t  maxIterations = 10000,
const double  armijoConstant = 1e-4,
const double  wolfe = 0.9,
const double  minGradientNorm = 1e-6,
const double  factr = 1e-15,
const size_t  maxLineSearchTrials = 50,
const double  minStep = 1e-20,
const double  maxStep = 1e20 
)

Initialize the L-BFGS object.

Store a reference to the function we will be optimizing and set the size of the memory for the algorithm. There are many parameters that can be set for the optimization, but default values are given for each of them.

Parameters
functionInstance of function to be optimized.
numBasisNumber of memory points to be stored (default 5).
maxIterationsMaximum number of iterations for the optimization (0 means no limit and may run indefinitely).
armijoConstantControls the accuracy of the line search routine for determining the Armijo condition.
wolfeParameter for detecting the Wolfe condition.
minGradientNormMinimum gradient norm required to continue the optimization.
maxLineSearchTrialsThe maximum number of trials for the line search (before giving up).
minStepThe minimum step of the line search.
maxStepThe maximum step of the line search.

Member Function Documentation

double ArmijoConstant ( ) const
inline

Get the Armijo condition constant.

Definition at line 119 of file lbfgs.hpp.

double& ArmijoConstant ( )
inline

Modify the Armijo condition constant.

Definition at line 121 of file lbfgs.hpp.

double Factr ( ) const
inline

Get the factr value.

Definition at line 134 of file lbfgs.hpp.

double& Factr ( )
inline

Modify the factr value.

Definition at line 136 of file lbfgs.hpp.

const FunctionType& Function ( ) const
inline

Return the function that is being optimized.

Definition at line 104 of file lbfgs.hpp.

FunctionType& Function ( )
inline

Modify the function that is being optimized.

Definition at line 106 of file lbfgs.hpp.

size_t MaxIterations ( ) const
inline

Get the maximum number of iterations.

Definition at line 114 of file lbfgs.hpp.

size_t& MaxIterations ( )
inline

Modify the maximum number of iterations.

Definition at line 116 of file lbfgs.hpp.

size_t MaxLineSearchTrials ( ) const
inline

Get the maximum number of line search trials.

Definition at line 139 of file lbfgs.hpp.

size_t& MaxLineSearchTrials ( )
inline

Modify the maximum number of line search trials.

Definition at line 141 of file lbfgs.hpp.

double MaxStep ( ) const
inline

Return the maximum line search step size.

Definition at line 149 of file lbfgs.hpp.

double& MaxStep ( )
inline

Modify the maximum line search step size.

Definition at line 151 of file lbfgs.hpp.

double MinGradientNorm ( ) const
inline

Get the minimum gradient norm.

Definition at line 129 of file lbfgs.hpp.

double& MinGradientNorm ( )
inline

Modify the minimum gradient norm.

Definition at line 131 of file lbfgs.hpp.

const std::pair<arma::mat, double>& MinPointIterate ( ) const

Return the point where the lowest function value has been found.

Returns
arma::vec representing the point and a double with the function value at that point.
double MinStep ( ) const
inline

Return the minimum line search step size.

Definition at line 144 of file lbfgs.hpp.

double& MinStep ( )
inline

Modify the minimum line search step size.

Definition at line 146 of file lbfgs.hpp.

size_t NumBasis ( ) const
inline

Get the memory size.

Definition at line 109 of file lbfgs.hpp.

size_t& NumBasis ( )
inline

Modify the memory size.

Definition at line 111 of file lbfgs.hpp.

double Optimize ( arma::mat &  iterate)

Use L-BFGS to optimize the given function, starting at the given iterate point and finding the minimum.

The maximum number of iterations is set in the constructor (or with MaxIterations()). Alternately, another overload is provided which takes a maximum number of iterations as a parameter. The given starting point will be modified to store the finishing point of the algorithm, and the final objective value is returned.

Parameters
iterateStarting point (will be modified).
Returns
Objective value of the final point.
double Optimize ( arma::mat &  iterate,
const size_t  maxIterations 
)

Use L-BFGS to optimize (minimize) the given function, starting at the given iterate point, and performing no more than the given maximum number of iterations (the class variable maxIterations is ignored for this run, but not modified).

The given starting point will be modified to store the finishing point of the algorithm, and the final objective value is returned.

Parameters
iterateStarting point (will be modified).
maxIterationsMaximum number of iterations (0 specifies no limit).
Returns
Objective value of the final point.
double Wolfe ( ) const
inline

Get the Wolfe parameter.

Definition at line 124 of file lbfgs.hpp.

double& Wolfe ( )
inline

Modify the Wolfe parameter.

Definition at line 126 of file lbfgs.hpp.


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