EO(3)

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

SYNOPSIS

#include <EO.h>

Inherits eoObject, and eoPersistent.

  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
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.\ Calls base class, just in case that one had something to do.
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.

Definition at line 81 of file EO.h.

Referenced by EO< PyFitness >::fitness(), eoOneMaxEvalFunc< EOT >::operator()(), eoOneFifthMutation< EOT >::operator()(), eoEvalFuncPtr< EOT, FitT, FunctionArg >::operator()(), eoEvalFuncCounter< EOT >::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 eoVector< FitT, bool >::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 eoEsFull< Fit >, eoEsSimple< Fit >, eoEsStdev< Fit >, eoReal< FitT >, eoBit< FitT >, eoParseTree< FType, Node >, eoString< fitnessT >, and eoOneMax< 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 eoVector< FitT, GeneType >, eoEsFull< Fit >, eoEsSimple< Fit >, eoEsStdev< Fit >, eoBit< FitT >, eoParseTree< FType, Node >, eoExternalEO< Fit, External >, eoVector< Fit, double >, eoVector< FitT, double >, and eoVector< FitT, bool >.

Definition at line 105 of file EO.h.

Referenced by eoVector< FitT, bool >::readFrom(), eoPop< Dummy >::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 eoVector< FitT, GeneType >, eoEsFull< Fit >, eoEsSimple< Fit >, eoEsStdev< Fit >, eoBit< FitT >, eoParseTree< FType, Node >, eoExternalEO< Fit, External >, eoString< fitnessT >, Dummy, Dummy, Dummy, Dummy, eoVector< Fit, double >, eoVector< FitT, double >, and eoVector< FitT, bool >.

Definition at line 129 of file EO.h.

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

Author

Generated automatically by Doxygen for EO from the source code.