Generic Fitness. More...
#include <rga.h>
Inheritance diagram for RFitness< cVal, Max >:
Collaboration diagram for RFitness< cVal, Max >:
Public Member Functions | |
RFitness (void) | |
RFitness & | operator= (const RFitness &f) |
RFitness & | operator= (const cVal value) |
bool | operator== (const RFitness &f) const |
bool | operator!= (const RFitness &f) const |
bool | operator> (const RFitness &f) const |
bool | operator< (const RFitness &f) const |
bool | ToMaximize (void) const |
bool | ToMinimize (void) const |
Public Attributes | |
cVal | Value |
Detailed Description
template<class cVal, bool Max>
singleton R::RFitness< cVal, Max >
Generic Fitness.
This class represents a fitness for a specific problem. the cVal parameter is used to specify the nature of the fitness, and the max parameter is used to indicate if the fitness is to maximized or minimized.
- Parameters
-
cVal The type of information contained in the fitness. Max If true, the fitness is to maximized.
This example implements a fitness that is represented by a integer value and that has to be minimized.
Constructor & Destructor Documentation
RFitness | ( | void | ) |
Construct the fitness. The value is set to 0, so if cVal is an object, an assignment operator with 0 has to be implemented.
Member Function Documentation
Assignment operator.
- Parameters
-
f The fitness used for the assignment.
- Returns
- The function returns (*this).
RFitness& operator= | ( | const cVal | value | ) |
Assignment operator.
- Parameters
-
value The value used for the assignment.
- Returns
- The function returns (*this).
bool operator== | ( | const RFitness< cVal, Max > & | f | ) | const |
The equal operator.
- Parameters
-
f The fitness used for the comparison.
- Returns
- The function returns true if the value of the two fitness are equal.
bool operator!= | ( | const RFitness< cVal, Max > & | f | ) | const |
The different operator.
- Parameters
-
f The fitness used for the comparison.
- Returns
- The function returns true if the value of the two fitness are different.
bool operator> | ( | const RFitness< cVal, Max > & | f | ) | const |
The greater operator.
- Parameters
-
f The fitness used for the comparison.
- Returns
- The function returns true if the value of the fitness is greater than the value of f.
bool operator< | ( | const RFitness< cVal, Max > & | f | ) | const |
The less-than operator.
- Parameters
-
f The fitness used for the comparison.
- Returns
- The function returns true if the value of the fitness is less than the value of f.
bool ToMaximize | ( | void | ) | const |
Returns true if the fitness is to maximize.
bool ToMinimize | ( | void | ) | const |
Returns true if the fitness is to minimize.
Member Data Documentation
cVal Value |
The value of the fitness.