EO< F > Class Template Reference

EO is a base class for evolvable objects, that is, the subjects of evolution. More...

#include <EO.h>

Inheritance diagram for EO< F >:

eoObject eoPersistent eoPrintable eoOneMax< FitT > eoVector< FitT, GeneType > PO< F > eoBit< FitT > eoInt< FitT > eoReal< FitT > eoVectorParticle< FitT, PositionType, VelocityType > eoBitParticle< FitT > eoRealParticle< FitT >

List of all members.

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


Detailed Description

template<class F = double>
class EO< F >

EO is a base class for evolvable objects, that is, the subjects of evolution.

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.


Member Function Documentation

template<class F = double>
void EO< F >::fitness ( const Fitness &  _fitness  )  [inline]

Set fitness.

At the same time, validates it.

Parameters:
_fitness New fitness value.

Reimplemented in PO< eoScalarFitness >.

Definition at line 75 of file EO.h.

template<class F = double>
bool EO< F >::invalid (  )  const [inline]

Return true If fitness value is invalid, false otherwise.

Returns:
true If fitness is invalid.

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().

template<class F = double>
bool EO< F >::operator< ( const EO< F > &  _eo2  )  const [inline]

Returns true if.

Returns:
true if the fitness is higher

Definition at line 89 of file EO.h.

Referenced by eoVector< eoScalarFitness, int >::operator<().

template<class F = double>
virtual std::string EO< F >::className ( void   )  const [inline, virtual]

Methods inherited from eoObject.

Return the class id.

Returns:
the class name as a std::string

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 >.

Definition at line 98 of file EO.h.

template<class F = double>
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

Parameters:
_is a std::istream.
Exceptions:
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().

template<class F = double>
virtual void EO< F >::printOn ( std::ostream &  _os  )  const [inline, virtual]


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

Generated on Thu Jan 1 23:19:44 2009 for EvolvingObjects by  doxygen 1.5.5