bukin_function.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_CORE_OPTIMIZERS_PROBLEMS_BUKIN_FUNCTION_HPP
13 #define MLPACK_CORE_OPTIMIZERS_PROBLEMS_BUKIN_FUNCTION_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace optimization {
19 namespace test {
20 
45 {
46  public:
47  /*
48  * Initialize the BukinFunction.
49  *
50  * @param epsilon Coefficient to avoid division by zero (numerical stability).
51  */
52  BukinFunction(const double epsilon = 1e-8);
53 
58  void Shuffle();
59 
61  size_t NumFunctions() const { return 1; }
62 
64  arma::mat GetInitialPoint() const { return arma::mat("-10; -2.0"); }
65 
66  /*
67  * Evaluate a function for a particular batch-size.
68  *
69  * @param coordinates The function coordinates.
70  * @param begin The first function.
71  * @param batchSize Number of points to process.
72  */
73  double Evaluate(const arma::mat& coordinates,
74  const size_t begin,
75  const size_t batchSize) const;
76 
77  /*
78  * Evaluate a function with the given coordinates.
79  *
80  * @param coordinates The function coordinates.
81  */
82  double Evaluate(const arma::mat& coordinates) const;
83 
84  /*
85  * Evaluate the gradient of a function for a particular batch-size.
86  *
87  * @param coordinates The function coordinates.
88  * @param begin The first function.
89  * @param gradient The function gradient.
90  * @param batchSize Number of points to process.
91  */
92  void Gradient(const arma::mat& coordinates,
93  const size_t begin,
94  arma::mat& gradient,
95  const size_t batchSize) const;
96 
97  /*
98  * Evaluate the gradient of a function with the given coordinates.
99  *
100  * @param coordinates The function coordinates.
101  * @param gradient The function gradient.
102  */
103  void Gradient(const arma::mat& coordinates, arma::mat& gradient);
104 
106  double Epsilon() const { return epsilon; }
108  double& Epsilon() { return epsilon; }
109 
110  private:
112  double epsilon;
113 };
114 
115 } // namespace test
116 } // namespace optimization
117 } // namespace mlpack
118 
119 #endif // MLPACK_CORE_OPTIMIZERS_PROBLEMS_BUKIN_FUNCTION_HPP
double Evaluate(const arma::mat &coordinates, const size_t begin, const size_t batchSize) const
.hpp
Definition: add_to_po.hpp:21
BukinFunction(const double epsilon=1e-8)
The core includes that mlpack expects; standard C++ includes and Armadillo.
The Bukin function, defined by.
double Epsilon() const
Get the value used for numerical stability.
void Shuffle()
Shuffle the order of function visitation.
size_t NumFunctions() const
Return 1 (the number of functions).
double & Epsilon()
Modify the value used for numerical stability.
void Gradient(const arma::mat &coordinates, const size_t begin, arma::mat &gradient, const size_t batchSize) const
arma::mat GetInitialPoint() const
Get the starting point.