EvolvingObjects
|
Wraps a scalar fitness values such as a double or int, with the option of maximizing (using less<ScalarType>) or minimizing (using greater<ScalarType>) More...
#include <eoScalarFitness.h>
Public Member Functions | |
eoScalarFitness (const eoScalarFitness &other) | |
eoScalarFitness (const ScalarType &v) | |
eoScalarFitness & | operator= (const eoScalarFitness &other) |
eoScalarFitness & | operator= (const ScalarType &v) |
operator ScalarType (void) const | |
Conversion operator: it permits to use a fitness instance as its scalar type, if needed. | |
bool | operator< (const eoScalarFitness &other) const |
Comparison, using less by default. | |
bool | operator< (const ScalarType &other) const |
Comparison, using less by default. | |
bool | operator> (const eoScalarFitness< ScalarType, Compare > &y) const |
bool | operator<= (const eoScalarFitness< ScalarType, Compare > &y) const |
bool | operator>= (const eoScalarFitness< ScalarType, Compare > &y) const |
Private Attributes | |
ScalarType | value |
Wraps a scalar fitness values such as a double or int, with the option of maximizing (using less<ScalarType>) or minimizing (using greater<ScalarType>)
It overrides operator<() to use the Compare template argument. Thus, if you need to compare if an indiv1 is "better" than an indiv2, you can use: if( indiv1 > indiv2 ) { // indiv1 is better } else { // indiv2 is better }
Suitable constructors and assignments and casts are defined to work with this quantity as if it were a ScalarType.
Definition at line 52 of file eoScalarFitness.h.
eoScalarFitness< ScalarType, Compare >::operator ScalarType | ( | void | ) | const [inline] |
Conversion operator: it permits to use a fitness instance as its scalar type, if needed.
For example, this is possible: eoScalarFitness<double,std::less<double> > fit; double val = 1.0; fit = val; val = fit;
Definition at line 72 of file eoScalarFitness.h.