dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
Rastrigin.h
Go to the documentation of this file.
1 
11 #ifndef DIGNEA_RASTRIGIN_H
12 #define DIGNEA_RASTRIGIN_H
13 
14 #include <dignea/core/Problem.h>
15 #include <dignea/types/SolutionTypes.h>
16 #include <dignea/utilities/random/PseudoRandom.h>
17 
18 #include <vector>
19 
24 class Rastrigin : public Problem<FloatSolution> {
25  public:
26  Rastrigin() = default;
27 
28  ~Rastrigin() override = default;
34  explicit Rastrigin(const int &numberOfVars);
41  explicit Rastrigin(const Rastrigin *ras);
49  int getOptimizationDirection(int i) const override;
56  float getUpperLimit(int i) const override;
63  float getLowerLimit(int i) const override;
69  string getName() const override { return "Rastrigin"; }
75  void evaluate(FloatSolution &solution) const override;
83  bool evaluateConstraints(FloatSolution &solution) const override;
89  FloatSolution createSolution() const override;
96  FloatSolution createSolution(ParallelPRNG &engine) const override;
102  void readData(const string &path) override;
103 };
104 
105 #endif // DIGNEA_RASTRIGIN_H
Class to represent a Problem in the tool. It includes the basic information for a problem a few metho...
Definition: Problem.h:29
int numberOfVars
Definition: Problem.h:155
Rastrigin Optimization function.
Definition: Rastrigin.h:24
float getLowerLimit(int i) const override
Get the lower limit of the Rastrigin function (-5.12).
Definition: Rastrigin.cpp:44
float getUpperLimit(int i) const override
Get the upper limit of the Rastrigin function (5.12).
Definition: Rastrigin.cpp:52
int getOptimizationDirection(int i) const override
Get the Optimization Direction. Only available for one dimension (0) and it returns Minimize.
Definition: Rastrigin.cpp:60
void readData(const string &path) override
Not implemented here.
Definition: Rastrigin.cpp:69
bool evaluateConstraints(FloatSolution &solution) const override
Not implemented here.
Definition: Rastrigin.cpp:74
FloatSolution createSolution() const override
Creates a random solution with values in the range [-5.12, 5.12].
Definition: Rastrigin.cpp:32
string getName() const override
Get the Name.
Definition: Rastrigin.h:69
void evaluate(FloatSolution &solution) const override
Evaluates an individual with the Rastrigin Function.
Definition: Rastrigin.cpp:17
Class to represent a solution to the optimization problems in the tool.
Definition: Solution.h:25