#include <EO.h>
Public Types | |
typedef F | Fitness |
typedef Traits | fitness_traits |
typedef Traits::storage_type | storage_type |
typedef Traits::performance_type | performance_type |
typedef Traits::worth_type | worth_type |
Public Member Functions | |
EO () | |
Default constructor. | |
virtual | ~EO () |
Virtual dtor. | |
const Fitness & | fitness () const |
Return fitness value. | |
Fitness & | fitnessReference () |
Get fitness as reference, useful when fitness is set in a multi-stage way, e.g., MOFitness gets performance information, is subsequently ranked. | |
void | invalidate () |
void | fitness (const Fitness &_fitness) |
Set fitness. | |
bool | invalid () const |
Return true If fitness value is invalid, false otherwise. | |
bool | operator< (const EO &_eo2) const |
Returns true if. | |
bool | operator> (const EO &_eo2) const |
void | fitness (performance_type perf) |
void | performance (performance_type perf) |
performance_type | performance (void) const |
void | worth (worth_type worth) |
worth_type | worth (void) const |
worth_type | fitness (void) const |
void | invalidate (void) |
void | invalidate_worth (void) |
bool | operator< (const EO< Fitness, Traits > &other) const |
bool | operator> (const EO< Fitness, Traits > &other) const |
virtual std::string | className () const |
Methods inherited from eoObject. | |
virtual void | readFrom (std::istream &_is) |
Read object. | |
virtual void | printOn (std::ostream &_os) const |
Write object. | |
Private Attributes | |
Fitness | repFitness |
bool | invalidFitness |
bool | valid_performance |
bool | valid_worth |
storage_type | rep_fitness |
EOs have only got a fitness, which at the same time needs to be only an object with the operation less than (<) defined. Fitness says how good is the object; evolution or change of these objects is left to the genetic operators. A fitness less than another means a worse fitness, in whatever the context; thus, fitness is always maximized; although it can be minimized with a proper definition of the < operator. The fitness object must have, besides an void ctor, a copy ctor.
Definition at line 44 of file EO.h.
void EO< F >::fitness | ( | const Fitness & | _fitness | ) | [inline] |
Set fitness.
At the same time, validates it.
_fitness | New fitness value. |
Reimplemented in PO< eoScalarFitness >.
bool EO< F >::invalid | ( | ) | const [inline] |
Return true If fitness value is invalid, false otherwise.
Reimplemented in PO< F >, and PO< eoScalarFitness >.
Definition at line 84 of file EO.h.
Referenced by EO< PyFitness >::fitness(), EO< PyFitness >::fitnessReference(), eoOneMaxEvalFunc< EOT >::operator()(), eoOneFifthMutation< EOT >::operator()(), eoEvalFuncPtr< EOT, FitT, FunctionArg >::operator()(), and EO< PyFitness >::printOn().
Returns true if.
Definition at line 89 of file EO.h.
Referenced by eoVector< eoScalarFitness, int >::operator<().
virtual std::string EO< F >::className | ( | void | ) | const [inline, virtual] |
Methods inherited from eoObject.
Return the class id.
Implements eoObject.
Reimplemented in eoBitParticle< FitT >, eoInt< FitT >, eoRealParticle< FitT >, eoEsFull< Fit >, eoEsSimple< Fit >, eoEsStdev< Fit >, eoReal< FitT >, eoBit< FitT >, eoString< fitnessT >, PO< F >, eoOneMax< FitT >, eoBit< eoScalarFitness >, and PO< eoScalarFitness >.
virtual void EO< F >::readFrom | ( | std::istream & | _is | ) | [inline, virtual] |
Read object.
\ Calls base class, just in case that one had something to do. The read and print methods should be compatible and have the same format. In principle, format is "plain": they just print a number
_is | a std::istream. |
runtime_std::exception | If a valid object can't be read. |
Implements eoPersistent.
Reimplemented in eoVector< FitT, GeneType >, eoEsFull< Fit >, eoEsSimple< Fit >, eoEsStdev< Fit >, eoBit< FitT >, eoExternalEO< Fit, External >, PO< F >, eoVector< Fit, double >, eoVector< eoScalarFitness, bool >, eoVector< eoScalarFitness, double >, eoVector< eoScalarFitness, int >, eoBit< eoScalarFitness >, and PO< eoScalarFitness >.
Definition at line 108 of file EO.h.
Referenced by eoVector< eoScalarFitness, int >::readFrom(), eoParseTree< FType, Node >::readFrom(), eoOneMax< FitT >::readFrom(), eoExternalEO< Fit, External >::readFrom(), and eoBit< eoScalarFitness >::readFrom().
virtual void EO< F >::printOn | ( | std::ostream & | _os | ) | const [inline, virtual] |
Write object.
Called printOn since it prints the object _on_ a stream.
_os | A std::ostream. |
Implements eoPrintable.
Reimplemented in eoVector< FitT, GeneType >, eoVectorParticle< FitT, PositionType, VelocityType >, eoEsFull< Fit >, eoEsSimple< Fit >, eoEsStdev< Fit >, eoBit< FitT >, eoExternalEO< Fit, External >, eoString< fitnessT >, PO< F >, Dummy, Dummy, Dummy, Dummy, eoVector< Fit, double >, eoVector< eoScalarFitness, bool >, eoVector< eoScalarFitness, double >, eoVector< eoScalarFitness, int >, eoVectorParticle< eoScalarFitness, double, double >, eoVectorParticle< eoScalarFitness, bool, double >, eoBit< eoScalarFitness >, and PO< eoScalarFitness >.
Definition at line 132 of file EO.h.
Referenced by Dummy::printOn(), eoVector< eoScalarFitness, int >::printOn(), eoString< fitnessT >::printOn(), eoParseTree< FType, Node >::printOn(), eoOneMax< FitT >::printOn(), eoExternalEO< Fit, External >::printOn(), and eoBit< eoScalarFitness >::printOn().