rosenbrock_function.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_CORE_OPTIMIZERS_PROBLEMS_ROSENBROCK_FUNCTION_HPP
14 #define MLPACK_CORE_OPTIMIZERS_PROBLEMS_ROSENBROCK_FUNCTION_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 
18 namespace mlpack {
19 namespace optimization {
20 namespace test {
21 
47 {
48  public:
51 
56  void Shuffle();
57 
59  size_t NumFunctions() const { return 1; }
60 
62  arma::mat GetInitialPoint() const { return arma::mat("-1.2; 1"); }
63 
64  /*
65  * Evaluate a function for a particular batch-size.
66  *
67  * @param coordinates The function coordinates.
68  * @param begin The first function.
69  * @param batchSize Number of points to process.
70  */
71  double Evaluate(const arma::mat& coordinates,
72  const size_t begin,
73  const size_t batchSize) const;
74 
75  /*
76  * Evaluate a function with the given coordinates.
77  *
78  * @param coordinates The function coordinates.
79  */
80  double Evaluate(const arma::mat& coordinates) const;
81 
82  /*
83  * Evaluate the gradient of a function for a particular batch-size.
84  *
85  * @param coordinates The function coordinates.
86  * @param begin The first function.
87  * @param gradient The function gradient.
88  * @param batchSize Number of points to process.
89  */
90  void Gradient(const arma::mat& coordinates,
91  const size_t begin,
92  arma::mat& gradient,
93  const size_t batchSize) const;
94 
95  /*
96  * Evaluate the gradient of a function with the given coordinates.
97  *
98  * @param coordinates The function coordinates.
99  * @param gradient The function gradient.
100  */
101  void Gradient(const arma::mat& coordinates, arma::mat& gradient) const;
102 };
103 
104 } // namespace test
105 } // namespace optimization
106 } // namespace mlpack
107 
108 #endif // MLPACK_CORE_OPTIMIZERS_PROBLEMS_ROSENBROCK_FUNCTION_HPP
The Rosenbrock function, defined by:
arma::mat GetInitialPoint() const
Get the starting point.
size_t NumFunctions() const
Return 1 (the number of functions).
.hpp
Definition: add_to_po.hpp:21
void Shuffle()
Shuffle the order of function visitation.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Gradient(const arma::mat &coordinates, const size_t begin, arma::mat &gradient, const size_t batchSize) const
RosenbrockFunction()
Initialize the RosenbrockFunction.
double Evaluate(const arma::mat &coordinates, const size_t begin, const size_t batchSize) const