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