line_search.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_CORE_OPTIMIZERS_LINE_SEARCH_LINE_SEARCH_HPP
13 #define MLPACK_CORE_OPTIMIZERS_LINE_SEARCH_LINE_SEARCH_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace optimization {
19 
31 {
32  public:
33  LineSearch(const size_t maxIterations = 100000,
34  const double tolerance = 1e-5) :
35  maxIterations(maxIterations), tolerance(tolerance)
36  {/* Do nothing */ }
37 
50  template<typename FunctionType>
51  double Optimize(FunctionType& function, const arma::mat& x1, arma::mat& x2);
52 
54  size_t MaxIterations() const { return maxIterations; }
56  size_t& MaxIterations() { return maxIterations; }
57 
59  double Tolerance() const { return tolerance; }
61  double& Tolerance() { return tolerance; }
62 
63  private:
65  size_t maxIterations;
66 
68  double tolerance;
69 
80  template<typename FunctionType>
81  double Derivative(FunctionType& function,
82  const arma::mat& x0,
83  const arma::mat& deltaX,
84  const double gamma);
85 }; // class LineSearch
86 } // namespace optimization
87 } // namespace mlpack
88 
89 #include "line_search_impl.hpp"
90 
91 #endif
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Tolerance() const
Get the tolerance for termination.
Definition: line_search.hpp:59
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 ...
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).
Definition: line_search.hpp:56
LineSearch(const size_t maxIterations=100000, const double tolerance=1e-5)
Definition: line_search.hpp:33
double & Tolerance()
Modify the tolerance for termination.
Definition: line_search.hpp:61
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
Definition: line_search.hpp:54
Find the minimum of a function along the line between two points.
Definition: line_search.hpp:30