MachineIntelligenceCore:NeuralNets
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
ArtificialLandscapesTests.hpp
Go to the documentation of this file.
1 
26 #ifndef ARTIFICIALLANDSCAPESTESTS_HPP_
27 #define ARTIFICIALLANDSCAPESTESTS_HPP_
28 
29 #include <gtest/gtest.h>
30 #include <cmath>
31 
32 // Redefine word "public" so every class field/method will be accessible for tests.
33 #define private public
35 
36 
41 class Sphere1DLandscape : public ::testing::Test {
42 public:
43  // Constructor. Sets layer size.
45  x = MAKE_MATRIX_PTR(double, 1, 1);
46  }
47 
48  // Sets values
49  virtual void SetUp() {
50  (*x)[0] = 20.0;
51  }
52 
53 private:
56 
58  double eps = 1e-5;
59 
60  // Variables.
61  mic::types::MatrixPtr<double> x;
62 };
63 
68 class Sphere20DLandscape : public ::testing::Test {
69 public:
70  // Constructor. Sets layer size.
72  x = MAKE_MATRIX_PTR(double, 20, 1);
73  }
74 
75  // Sets values
76  virtual void SetUp() {
77  for (size_t i=0; i<20; i++)
78  (*x)[i] = i;
79  }
80 
81 private:
84 
86  double eps = 1e-5;
87 
88  // Variables.
89  mic::types::MatrixPtr<double> x;
90 };
91 
92 
97 class Beale2DLandscape : public ::testing::Test {
98 public:
99  // Constructor. Sets layer size.
101  x = MAKE_MATRIX_PTR(double, 2, 1);
102  }
103 
104  // Sets values
105  virtual void SetUp() {
106  (*x)[0] = 0.0;
107  (*x)[1] = 0.0;
108  }
109 
110 
111 private:
114 
116  double eps = 1e-5;
117 
118  // Variables.
119  mic::types::MatrixPtr<double> x;
120 };
121 
122 
123 
128 class Rosenbrock2DLandscape : public ::testing::Test {
129 public:
130  // Constructor. Sets layer size.
132  x = MAKE_MATRIX_PTR(double, 2, 1);
133  }
134 
135  // Sets values
136  virtual void SetUp() {
137  (*x)[0] = 10.0;
138  (*x)[1] = 4.0;
139  }
140 
141 private:
144 
146  double eps = 1e-5;
147 
148  // Variables.
149  mic::types::MatrixPtr<double> x;
150 };
151 
152 
153 
154 #endif /* ARTIFICIALLANDSCAPESTESTS_HPP_ */
mic::types::MatrixPtr< double > x
mic::types::MatrixPtr< double > x
mic::neural_nets::optimization::artificial_landscapes::Beale2DFunction< double > fun
Beale's function 2d.
Test fixture - artificial landscape - sphere function 20D (square function).
mic::neural_nets::optimization::artificial_landscapes::SphereFunction< double > fun
Sphere function 1d.
Test fixture - artificial landscape - Rosenbrock function 2D.
Test fixture - artificial landscape - sphere function 1D (square function).
mic::neural_nets::optimization::artificial_landscapes::SphereFunction< double > fun
Sphere function 1d.
Test fixture - artificial landscape - Beale's function 2D.
mic::neural_nets::optimization::artificial_landscapes::Rosenbrock2DFunction< double > fun
Rosenbrock function 2d.
mic::types::MatrixPtr< double > x
mic::types::MatrixPtr< double > x