genetiK::EvolutionaryAlgorithm Class Reference
[Common GenetiK framework]

EvolutionaryAlgorithm: The main evolutionary algorithm. This class represents the main evolutionary algorithm. More...

#include <EvolutionaryAlgorithm.h>

Collaboration diagram for genetiK::EvolutionaryAlgorithm:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 EvolutionaryAlgorithm (const unsigned int populationSize, IndividualFactory *factory, StopCriterion *stopCriterion=NULL, SelectionMethod *selectionMethod=NULL, const double mutationProbability=0.01, const double crossOverProbability=0.7, const bool elitism=true)
virtual int run ()
virtual int generatePopulation ()
virtual int evolve ()
virtual PopulationgetPopulation () const

Protected Attributes

StopCriterionstopCriterion
 Specifies a criterion to stop the EvolutionaryAlgorithm.
Populationpopulation
 Contains the individuals generated by this Algorithm at the present generation.
IndividualFactoryindividualFactory
 The Factory that is used to create specific Invidual objects.
SelectionMethodselectionMethod
 Provides a scheme to select individuals for crossover and reproduction.
unsigned int populationSize
 The size of the Population of Individuals at each generation.
double crossOverProbabilty
 Probability to perform crossover for a couple of Individuals.
double mutationProbabilty
 Probability to perform mutation on an Individual.
bool elitism
 Specifies if the current EvolutionaryAlgorithm should be elitist.

Detailed Description

EvolutionaryAlgorithm: The main evolutionary algorithm. This class represents the main evolutionary algorithm.


Constructor & Destructor Documentation

genetiK::EvolutionaryAlgorithm::EvolutionaryAlgorithm const unsigned int  populationSize,
IndividualFactory factory,
StopCriterion stopCriterion = NULL,
SelectionMethod selectionMethod = NULL,
const double  mutationProbability = 0.01,
const double  crossOverProbability = 0.7,
const bool  elitism = true
 

Parameters:
populationSize size of the population
factory the individual factory, redefine yours to generate your own Individual.
stopCriterion this class decides the end of the algortihm.
selectionMethod the selection method, if you don't specify it, the default RouletteWheel will be used. The genetiK library has genetiK::RouletteWheel, genetiK::TournamentSelection and RankingSelection.
mutationProbability 0.01 by default.
crossOverProbability 0.7 by default.
elitism if this is true, the best individual of the current generation will be copied to the next one.
See also:
Version


Member Function Documentation

int genetiK::EvolutionaryAlgorithm::evolve  )  [virtual]
 

Usually this method is called by .run(), but if you want more control on the evolution, you can manually call this after generatePopulation()

Exceptions:
IllegalStateException An IllegalStateException is thrown if a call to evolve() is made without having previously called generatePopulation()
Returns:
return 0 if it's all ok.

int genetiK::EvolutionaryAlgorithm::generatePopulation  )  [virtual]
 

Usually this method is called by .run(), but if you want more control on the evolution, you can manually call this before evolve()

Returns:
return 0 if it's all ok.

virtual Population* genetiK::EvolutionaryAlgorithm::getPopulation  )  const [inline, virtual]
 

This method is used to access the population at current generation

Returns:
return the population itself.

int genetiK::EvolutionaryAlgorithm::run  )  [virtual]
 

Call this method to start the algorithm.

Returns:
return 0 if it's all ok.


Member Data Documentation

bool genetiK::EvolutionaryAlgorithm::elitism [protected]
 

Specifies if the current EvolutionaryAlgorithm should be elitist.

If elitism is applied, the best Individual in each generation alway survives, unmodified, in the next one.

IndividualFactory* genetiK::EvolutionaryAlgorithm::individualFactory [protected]
 

The Factory that is used to create specific Invidual objects.

This class should be user supplied to create the desired type of Inviduals.


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