genetiK::Individual Class Reference
[Common GenetiK framework]

Individual: generic Individual. More...

#include <Individual.h>

Inheritance diagram for genetiK::Individual:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Individual (void)
 default void constructor
 Individual (const Individual &individual)
 default copy constructor
virtual ~Individual (void)
 default destructor
virtual double fitness ()=0
 abstract fitness function
virtual Individualcopy () const =0
 abstract copy function
virtual int mutate (const double mutationProbability)=0
 abstract mutation
virtual int crossOver (Individual *i, Individual **child1, Individual **child2)=0
 abstract crossover
virtual std::string toString () const
 creates a string representing the individual
virtual bool operator< (Individual &i2)
 compares fitness between individuals

Detailed Description

Individual: generic Individual.

Generic individual to be used with evolutionary algorithms. It is extended by ga::Individual and gp::Individual to provide specific functions oriented towards Genetic Algorithms and Genetic Programming, respectively.

See also:
IndividualFactory


Constructor & Destructor Documentation

genetiK::Individual::Individual void   ) 
 

default void constructor

Does nothing

genetiK::Individual::Individual const Individual individual  ) 
 

default copy constructor

Does nothing

genetiK::Individual::~Individual void   )  [virtual]
 

default destructor

Does nothing (class is abstract)

Reimplemented in genetiK::ga::Individual, genetiK::gp::Individual, and genetiK::gp::st::Individual.


Member Function Documentation

virtual Individual* genetiK::Individual::copy  )  const [pure virtual]
 

abstract copy function

This function must be extended by sublcasses to perform copy.

Returns:
a copy of the individual
See also:
Individual(const Individual& individual)

Implemented in genetiK::ga::Individual, genetiK::gp::Individual, and genetiK::gp::st::Individual.

virtual int genetiK::Individual::crossOver Individual i,
Individual **  child1,
Individual **  child2
[pure virtual]
 

abstract crossover

Performs crossover between this and individual i, saving the resulting children in child1 and child2. Subclasses must override this method to perform actual crossover

Parameters:
i the partner to use to perform crossover.
child1 first child.
child2 second child.
Returns:
0 if the operation was successful
See also:
mutate(double mutationProbabilty)

Implemented in genetiK::ga::Individual, genetiK::gp::Individual, and genetiK::gp::st::Individual.

virtual double genetiK::Individual::fitness  )  [pure virtual]
 

abstract fitness function

This function must be extended by sublcasses to calculate the fitness of the individual.

Returns:
the fitness of the current individual

Implemented in genetiK::ga::Individual, genetiK::gp::Individual, and genetiK::gp::st::Individual.

virtual int genetiK::Individual::mutate const double  mutationProbability  )  [pure virtual]
 

abstract mutation

Must be overridden in subclasses to perform actual mutation.

Parameters:
mutationProbability the probability that mutation occurs
Returns:
0 if the operation was successful
See also:
crossOver

Implemented in genetiK::ga::Individual, genetiK::gp::Individual, and genetiK::gp::st::Individual.

virtual bool genetiK::Individual::operator< Individual i2  )  [inline, virtual]
 

compares fitness between individuals

Defines an total order relation among Individuals using their fitness.

Parameters:
i2 the individual to use in the comparison
Returns:
true if this Individual has a fitness that is less than i2's one
See also:
fitness()

string genetiK::Individual::toString  )  const [virtual]
 

creates a string representing the individual

Subclasses must override this method to output an appropriate representation of the Individual.

Returns:
a string representation of the individual

Reimplemented in genetiK::ga::Individual, and genetiK::gp::Individual.


The documentation for this class was generated from the following files:
Generated on Thu Feb 23 12:21:55 2006 for GenetiK by  doxygen 1.4.6