rosenbrock_wood_function.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_CORE_OPTIMIZERS_PROBLEMS_ROSENBROCK_WOOD_FUNCTION_HPP
14 #define MLPACK_CORE_OPTIMIZERS_PROBLEMS_ROSENBROCK_WOOD_FUNCTION_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 
20 
21 namespace mlpack {
22 namespace optimization {
23 namespace test {
24 
31 {
32  public:
35 
40  void Shuffle();
41 
43  size_t NumFunctions() const { return 1; }
44 
46  const arma::mat& GetInitialPoint() const { return initialPoint; }
47 
48  /*
49  * Evaluate a function for a particular batch-size.
50  *
51  * @param coordinates The function coordinates.
52  * @param begin The first function.
53  * @param batchSize Number of points to process.
54  */
55  double Evaluate(const arma::mat& coordinates,
56  const size_t begin,
57  const size_t batchSize) const;
58 
59  /*
60  * Evaluate a function with the given coordinates.
61  *
62  * @param coordinates The function coordinates.
63  */
64  double Evaluate(const arma::mat& coordinates) const;
65 
66  /*
67  * Evaluate the gradient of a function for a particular batch-size.
68  *
69  * @param coordinates The function coordinates.
70  * @param begin The first function.
71  * @param gradient The function gradient.
72  * @param batchSize Number of points to process.
73  */
74  void Gradient(const arma::mat& coordinates,
75  const size_t begin,
76  arma::mat& gradient,
77  const size_t batchSize) const;
78 
79  /*
80  * Evaluate the gradient of a function with the given coordinates.
81  *
82  * @param coordinates The function coordinates.
83  * @param gradient The function gradient.
84  */
85  void Gradient(const arma::mat& coordinates, arma::mat& gradient) const;
86 
87  private:
89  arma::mat initialPoint;
90 
93 
95  WoodFunction wf;
96 };
97 
98 } // namespace test
99 } // namespace optimization
100 } // namespace mlpack
101 
102 #endif // MLPACK_CORE_OPTIMIZERS_PROBLEMS_ROSENBROCK_WOOD_FUNCTION_HPP
The Generalized Rosenbrock function in n dimensions, defined by f(x) = sum_i^{n - 1} (f(i)(x)) f_i(x)...
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
const arma::mat & GetInitialPoint() const
Get the starting point.
The Wood function, defined by f(x) = f1(x) + f2(x) + f3(x) + f4(x) + f5(x) + f6(x) f1(x) = 100 (x2 - ...
The Generalized Rosenbrock function in 4 dimensions with the Wood Function in four dimensions...
double Evaluate(const arma::mat &coordinates, const size_t begin, const size_t batchSize) const
RosenbrockWoodFunction()
Initialize the RosenbrockWoodFunction.
void Gradient(const arma::mat &coordinates, const size_t begin, arma::mat &gradient, const size_t batchSize) const
size_t NumFunctions() const
Return 1 (the number of functions).
void Shuffle()
Shuffle the order of function visitation.