In file src/EO.h:

template <class fitnessT> class EO

Base class for chromosomes-like things in EO, it's a very basic class, which does not require anything but a fitness and an ID

Public Methods

EO( const string& _ID = "" )
Default ctor
EO( const EO& _eob )
Copy Ctor
virtual fitnessT fitness()
Fitness things: reads fitness
virtual void fitness( const fitnessT &_fitness )
Fitness things: writes fitness and sets the validFitness flag to true
const string& ID()
read the ID, which is supposed to be an unique identification for each chromosome
bool operator < ( const EO& _eo )
Used to rank the objects
const EO& operator= ( const EO& _eob )
Assignment operator
bool validFitness( )
Checks if the fitness is valid, that is, if it's been already assigned
virtual ~EO()
Virtual dtor.

Public

InvalidFitness: an exception defined for EOs
class InvalidFitness: public UException
This exception should be thrown when a chromosome has not been evaluated, and thus, the fitness is not valid
InvalidFitness()
Constructor

Protected Methods

void ID( const string& _id )
Write ID

Documentation

Base class for chromosomes-like things in EO, it's a very basic class, which does not require anything but a fitness and an ID.
It basically provides an interface for evolving objects, and is maybe the cornerstone of the EO framerowk. Just do multiple-inheritance from your object and EOBase, and most, if not all, of the population-level functions will be available.
To subclass, you have to instantiate the template, and override whatever function you like. You shouldn't, though. The assignment operator will have to be redefined, too.

EO( const string& _ID = "" )
Default ctor. To be able to instantate this, the fitness class must have a ctor that takes 0 as argument.
Parameters:
_ID - A theoretically unique ID.

EO( const EO& _eob )
Copy Ctor

const EO& operator= ( const EO& _eob )
Assignment operator

virtual ~EO()
Virtual dtor.

InvalidFitness: an exception defined for EOs

class InvalidFitness: public UException
This exception should be thrown when a chromosome has not been evaluated, and thus, the fitness is not valid

InvalidFitness()
Constructor

virtual fitnessT fitness()
Fitness things: reads fitness
Throws:
InvalidFitness if fitness has not been evaluated

virtual void fitness( const fitnessT &_fitness )
Fitness things: writes fitness and sets the validFitness flag to true. Passed by value, so the fitness must have a copy ctor
Parameters:
_fitness - new value of the fitness

bool operator < ( const EO& _eo )
Used to rank the objects. Just calls the < operator in the fitness object
Returns:
true if the current object is "less" than the other
Parameters:
_eo - another EO to compare

bool validFitness( )
Checks if the fitness is valid, that is, if it's been already assigned. Returns false otherwise.
Returns:
true if the fitness is valid, false otherwise

const string& ID()
read the ID, which is supposed to be an unique identification for each chromosome. It should be set only at birth
Returns:
s the internal ID as a const string

void ID( const string& _id )
Write ID. It's in the protected interface, only subclasses should be allowed to set it.
Parameters:
_id - new ID.


This class has no child classes.
Author:
Geneura Team

alphabetic index hierarchy of classes


BinOp
The EO framework has been created by  GeNeura team
and can be downloaded from ftp://geneura.ugr.es/pub/eo
Search EO documentation

generated by doc++