scaled_sphere.h
Go to the documentation of this file.
1 
40 #ifndef HIGH_PRECISION_PSO_FUNCTION_SCALED_SPHERE_H_
41 #define HIGH_PRECISION_PSO_FUNCTION_SCALED_SPHERE_H_
42 
43 #include "function/function.h"
44 
45 namespace highprecisionpso {
46 
50 class ScaledSphere: public Function {
51 public:
57  ScaledSphere(double max_scale);
61  ~ScaledSphere();
69  mpf_t* Eval(const std::vector<mpf_t*> & pos);
70  std::string GetName();
79  mpf_t* DistanceTo1DLocalOptimum(const std::vector<mpf_t*> & pos, int d);
80 
81 private:
82  const double max_scale_;
83  std::vector<mpf_t*> scales_cached_;
84  unsigned int scales_cached_precision_;
85 };
86 
91 public:
96 };
97 
102 public:
108  ScaledHadamardRotatedSphere(double max_scale);
120  mpf_t* Eval(const std::vector<mpf_t*> & pos);
121  std::string GetName();
136  mpf_t* DistanceTo1DLocalOptimum(const std::vector<mpf_t*> & pos, int d);
137 
138 private:
139  void InitMatrixCached(const std::vector<mpf_t*> & pos);
140  const double max_scale_;
141  std::vector<std::vector<mpf_t* > > matrix_cached_;
142  unsigned int matrix_cached_precision_;
143 };
144 
149 public:
154 };
155 
159 class ScaledSphereRand: public Function {
160 public:
166  ScaledSphereRand(std::vector<std::string> rng_description);
170  ~ScaledSphereRand();
180  mpf_t* Eval(const std::vector<mpf_t*> & pos);
181  std::string GetName();
190  mpf_t* DistanceTo1DLocalOptimum(const std::vector<mpf_t*> & pos, int d);
191 
192 private:
193  const std::vector<std::string> rng_description_;
194  std::vector<mpf_t*> scales_cached_;
195  unsigned int scales_cached_precision_;
196 };
197 
198 } // namespace highprecisionpso
199 
200 #endif /* HIGH_PRECISION_PSO_FUNCTION_SCALED_SPHERE_H_ */
This file contains abstract classes for function generation.
std::string GetName()
Returns a string representation of this object.
This class represents a scaled and rotated version of the well known sphere function with fixed scale...
Definition: scaled_sphere.h:148
This class represents a scaled version of the well known sphere function with fixed scale 106...
Definition: scaled_sphere.h:90
mpf_t * Eval(const std::vector< mpf_t * > &pos)
Returns the evaluation of the scaled sphere function evaluated at the given position.
ScaledSphere(double max_scale)
The constructor, where the scale can be specified.
This class represents a scaled and rotated version of the well known sphere function.
Definition: scaled_sphere.h:101
This class represents a randomly scaled version of the well known sphere function.
Definition: scaled_sphere.h:159
This class represents a scaled version of the well known sphere function.
Definition: scaled_sphere.h:50
This class is an abstract class. It supplies the interface for objective functions.
Definition: function.h:74
mpf_t * DistanceTo1DLocalOptimum(const std::vector< mpf_t * > &pos, int d)
Calculates for a position and a dimension the next local optimum if only the value of the position in...
base namespace for this project.
Definition: absorption.h:45
~ScaledSphere()
The destructor.