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