13 #ifndef MLPACK_CORE_OPTIMIZERS_LBFGS_LBFGS_HPP
14 #define MLPACK_CORE_OPTIMIZERS_LBFGS_LBFGS_HPP
20 namespace optimization {
55 L_BFGS(
const size_t numBasis = 10,
56 const size_t maxIterations = 10000,
57 const double armijoConstant = 1e-4,
58 const double wolfe = 0.9,
59 const double minGradientNorm = 1e-6,
60 const double factr = 1e-15,
61 const size_t maxLineSearchTrials = 50,
62 const double minStep = 1e-20,
63 const double maxStep = 1e20);
86 template<
typename FunctionType>
87 double Optimize(FunctionType&
function, arma::mat& iterate);
105 double Wolfe()
const {
return wolfe; }
115 double Factr()
const {
return factr; }
138 size_t maxIterations;
140 double armijoConstant;
144 double minGradientNorm;
148 size_t maxLineSearchTrials;
161 double ChooseScalingFactor(
const size_t iterationNum,
162 const arma::mat& gradient,
164 const arma::cube& y);
179 template<
typename FunctionType>
181 double& functionValue,
184 arma::mat& newIterateTmp,
185 const arma::mat& searchDirection);
195 void SearchDirection(
const arma::mat& gradient,
196 const size_t iterationNum,
197 const double scalingFactor,
200 arma::mat& searchDirection);
213 void UpdateBasisSet(
const size_t iterationNum,
214 const arma::mat& iterate,
215 const arma::mat& oldIterate,
216 const arma::mat& gradient,
217 const arma::mat& oldGradient,
225 #include "lbfgs_impl.hpp"
227 #endif // MLPACK_CORE_OPTIMIZERS_LBFGS_LBFGS_HPP
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t MaxLineSearchTrials() const
Get the maximum number of line search trials.
double & MinStep()
Modify the minimum line search step size.
size_t MaxIterations() const
Get the maximum number of iterations.
size_t & MaxIterations()
Modify the maximum number of iterations.
size_t & MaxLineSearchTrials()
Modify the maximum number of line search trials.
double & MaxStep()
Modify the maximum line search step size.
double & ArmijoConstant()
Modify the Armijo condition constant.
double & Factr()
Modify the factr value.
double ArmijoConstant() const
Get the Armijo condition constant.
size_t & NumBasis()
Modify the memory size.
double MinStep() const
Return the minimum line search step size.
double Factr() const
Get the factr value.
double & Wolfe()
Modify the Wolfe parameter.
L_BFGS(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.
double MinGradientNorm() const
Get the minimum gradient norm.
double & MinGradientNorm()
Modify the minimum gradient norm.
size_t NumBasis() const
Get the memory size.
const std::pair< arma::mat, double > & MinPointIterate() const
Return the point where the lowest function value has been found.
double Optimize(FunctionType &function, arma::mat &iterate)
Use L-BFGS to optimize the given function, starting at the given iterate point and finding the minimu...
double MaxStep() const
Return the maximum line search step size.
double Wolfe() const
Get the Wolfe parameter.
The generic L-BFGS optimizer, which uses a back-tracking line search algorithm to minimize a function...
Find the minimum of a function along the line between two points.