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 PO< F > 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.
Fitness fitness () const
 Return fitness value.
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
 EO ()
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
 Return the class id.
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>
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.


Constructor & Destructor Documentation

template<class F>
EO< F >::EO (  )  [inline]

Default constructor.

Fitness must have a ctor which takes 0 as a value; we can not use void ctors here since default types like float have no void initializer. VC++ allows it, but gcc does not

Definition at line 54 of file EO.h.


Member Function Documentation

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

Set fitness.

At the same time, validates it.

Parameters:
_fitness New fitness value.

Definition at line 72 of file EO.h.

template<class F>
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< FitT >.

Definition at line 81 of file EO.h.

Referenced by EO< PyFitness >::fitness(), RoyalRoad< EOT >::operator()(), eoOneMaxEvalFunc< EOT >::operator()(), eoOneFifthMutation< EOT >::operator()(), eoEvalFuncPtr< EOT, FitT, FunctionArg >::operator()(), eoEvalFuncCounter< Dummy >::operator()(), and EO< PyFitness >::printOn().

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

Returns true if.

Returns:
true if the fitness is higher

Definition at line 86 of file EO.h.

Referenced by PyEO::operator<().

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

Return the class id.

Returns:
the class name as a std::string

Implements eoObject.

Reimplemented in Chrom, eoVirus< FitT >, eoEsFull< Fit >, eoEsSimple< Fit >, eoEsStdev< Fit >, eoReal< FitT >, eoRealParticle< FitT >, eoBit< FitT >, eoString< fitnessT >, PO< F >, eoOneMax< FitT >, and PO< FitT >.

Definition at line 95 of file EO.h.

template<class F>
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 EoSym< Fitness >, eoVirus< FitT >, eoVector< FitT, GeneType >, eoEsFull< Fit >, eoEsSimple< Fit >, eoEsStdev< Fit >, eoBit< FitT >, eoExternalEO< Fit, External >, PO< F >, eoVector< Fit, double >, eoVector< FitT, double >, eoVector< FitT, bool >, and PO< FitT >.

Definition at line 105 of file EO.h.

Referenced by eoVector< FitT, bool >::readFrom(), EoSym< Fitness >::readFrom(), eoParseTree< FType, Node >::readFrom(), eoOneMax< FitT >::readFrom(), eoExternalEO< Fit, External >::readFrom(), and eoBit< FitT >::readFrom().

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

Write object.

Called printOn since it prints the object _on_ a stream.

Parameters:
_os A std::ostream.

Implements eoPrintable.

Reimplemented in EoSym< Fitness >, eoVirus< FitT >, eoVector< FitT, GeneType >, eoEsFull< Fit >, eoEsSimple< Fit >, eoEsStdev< Fit >, eoBit< FitT >, eoExternalEO< Fit, External >, eoString< fitnessT >, PO< F >, Dummy, Dummy, Dummy, Dummy, eoVector< Fit, double >, eoVector< FitT, double >, eoVector< FitT, bool >, and PO< FitT >.

Definition at line 129 of file EO.h.

Referenced by Dummy::printOn(), eoVirus< FitT >::printOn(), eoVector< FitT, bool >::printOn(), EoSym< Fitness >::printOn(), eoString< fitnessT >::printOn(), eoParseTree< FType, Node >::printOn(), eoOneMax< FitT >::printOn(), eoExternalEO< Fit, External >::printOn(), and eoBit< FitT >::printOn().


The documentation for this class was generated from the following files:
Generated on Thu Apr 19 11:02:30 2007 for EO by  doxygen 1.4.7