update_linesearch.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_CORE_OPTIMIZERS_FW_UPDATE_LINESEARCH_HPP
14 #define MLPACK_CORE_OPTIMIZERS_FW_UPDATE_LINESEARCH_HPP
15 
16 #include <mlpack/prereqs.hpp>
18 
19 namespace mlpack {
20 namespace optimization {
21 
32 {
33  public:
40  UpdateLineSearch(const size_t maxIterations = 100000,
41  const double tolerance = 1e-5) :
42  tolerance(tolerance), maxIterations(maxIterations)
43  {/* Do nothing */}
44 
45 
69  template<typename FunctionType>
70  void Update(FunctionType& function,
71  const arma::mat& oldCoords,
72  const arma::mat& s,
73  arma::mat& newCoords,
74  const size_t /* numIter */)
75 
76  {
77  LineSearch solver(maxIterations, tolerance);
78 
79  newCoords = s;
80  solver.Optimize(function, oldCoords, newCoords);
81  }
82 
84  double Tolerance() const {return tolerance;}
86  double& Tolerance() {return tolerance;}
87 
89  size_t MaxIterations() const { return maxIterations; }
91  size_t& MaxIterations() { return maxIterations; }
92 
93  private:
95  double tolerance;
96 
98  size_t maxIterations;
99 }; // class UpdateLineSearch
100 
101 } // namespace optimization
102 } // namespace mlpack
103 
104 #endif
UpdateLineSearch(const size_t maxIterations=100000, const double tolerance=1e-5)
Construct the line search update rule.
.hpp
Definition: add_to_po.hpp:21
void Update(FunctionType &function, const arma::mat &oldCoords, const arma::mat &s, arma::mat &newCoords, const size_t)
Update rule for FrankWolfe, optimize with line search using secant method.
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Tolerance() const
Get the tolerance for termination.
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 ...
Use line search in the update step for FrankWolfe algorithm.
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
double & Tolerance()
Modify the tolerance for termination.
Find the minimum of a function along the line between two points.
Definition: line_search.hpp:30
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).