dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
Rastrigin Class Reference

Rastrigin Optimization function. More...

#include <Rastrigin.h>

Inheritance diagram for Rastrigin:
Problem< FloatSolution >

Public Member Functions

 Rastrigin (const int &numberOfVars)
 Construct a new Rastrigin with a dimension of numberOfVars. More...
 
 Rastrigin (const Rastrigin *ras)
 Construct a new Rastrigin object copying the information from the *ras pointer. More...
 
int getOptimizationDirection (int i) const override
 Get the Optimization Direction. Only available for one dimension (0) and it returns Minimize. More...
 
float getUpperLimit (int i) const override
 Get the upper limit of the Rastrigin function (5.12). More...
 
float getLowerLimit (int i) const override
 Get the lower limit of the Rastrigin function (-5.12). More...
 
string getName () const override
 Get the Name. More...
 
void evaluate (FloatSolution &solution) const override
 Evaluates an individual with the Rastrigin Function. More...
 
bool evaluateConstraints (FloatSolution &solution) const override
 Not implemented here. More...
 
FloatSolution createSolution () const override
 Creates a random solution with values in the range [-5.12, 5.12]. More...
 
FloatSolution createSolution (ParallelPRNG &engine) const override
 Creates a random solution with values in the range [-5.12, 5.12]. More...
 
void readData (const string &path) override
 Not implemented here. More...
 
- Public Member Functions inherited from Problem< FloatSolution >
 Problem ()
 Creates a new Problem with all parameters to zero. More...
 
 Problem (const int &numberOfVars, const int &numberOfObjectives, const int &nCons)
 Construct a new Problem with all the given parameters. More...
 
 Problem (const Problem *copy)
 
virtual void readData (const std::string &path)=0
 Method to read problem information from the given path. This method must be implemented in the subclasses. More...
 
virtual json to_json () const
 Creates a JSON object with the information of the Problem. More...
 
int getNumberOfVars () const
 Get the number of variables (dimension) of the problem. More...
 
void setNumberOfVars (int nVars)
 Sets the number of variables (dimension) of the problem. More...
 
int getNumberOfObjs () const
 Get the number of objectives of the problem. More...
 
void setNumberOfObjs (int nObjs)
 Sets the number of objectives to the problem. More...
 
int getNumberOfCons () const
 Get the number the constraint of the problem. More...
 
void setNumberOfCons (int nCons)
 Sets the number of constraint of the problem. More...
 

Additional Inherited Members

- Protected Attributes inherited from Problem< FloatSolution >
int numberOfVars
 
int numberOfObjs
 
int numberOfCons
 

Detailed Description

Rastrigin Optimization function.

Constructor & Destructor Documentation

◆ Rastrigin() [1/2]

Rastrigin::Rastrigin ( const int &  numberOfVars)
explicit

Construct a new Rastrigin with a dimension of numberOfVars.

Parameters
numberOfVars

◆ Rastrigin() [2/2]

Rastrigin::Rastrigin ( const Rastrigin ras)
explicit

Construct a new Rastrigin object copying the information from the *ras pointer.

Parameters
ras

Member Function Documentation

◆ createSolution() [1/2]

FloatSolution Rastrigin::createSolution ( ) const
overridevirtual

Creates a random solution with values in the range [-5.12, 5.12].

Returns
FloatSolution

Crea una solucion factible al problema Rastrigin

Returns

Implements Problem< FloatSolution >.

◆ createSolution() [2/2]

FloatSolution Rastrigin::createSolution ( ParallelPRNG &  engine) const
overridevirtual

Creates a random solution with values in the range [-5.12, 5.12].

Parameters
engine
Returns
FloatSolution

Implements Problem< FloatSolution >.

◆ evaluate()

void Rastrigin::evaluate ( FloatSolution solution) const
overridevirtual

Evaluates an individual with the Rastrigin Function.

Parameters
solution

Implements Problem< FloatSolution >.

◆ evaluateConstraints()

bool Rastrigin::evaluateConstraints ( FloatSolution solution) const
overridevirtual

Not implemented here.

Parameters
solution
Returns
true
false

Implements Problem< FloatSolution >.

◆ getLowerLimit()

float Rastrigin::getLowerLimit ( int  i) const
overridevirtual

Get the lower limit of the Rastrigin function (-5.12).

Parameters
i
Returns
float

Implements Problem< FloatSolution >.

◆ getName()

string Rastrigin::getName ( ) const
inlineoverridevirtual

Get the Name.

Returns
string

Implements Problem< FloatSolution >.

◆ getOptimizationDirection()

int Rastrigin::getOptimizationDirection ( int  i) const
overridevirtual

Get the Optimization Direction. Only available for one dimension (0) and it returns Minimize.

Parameters
i
Returns
int

Implements Problem< FloatSolution >.

◆ getUpperLimit()

float Rastrigin::getUpperLimit ( int  i) const
overridevirtual

Get the upper limit of the Rastrigin function (5.12).

Parameters
i
Returns
float

Implements Problem< FloatSolution >.

◆ readData()

void Rastrigin::readData ( const string &  path)
override

Not implemented here.

Parameters
path

The documentation for this class was generated from the following files: