Developer Documentation
Centre for Vision, Speech & Signal Processing
USER IN NAMESPACE AMMA TREE ROOT AMMA SEARCH AMMA HOME
 

  PUBLIC
GeneticAlgorithmC::GeneticAlgorithmC(UIntT,UIntT,UIntT,UIntT,RealT,RealT)
GeneticAlgorithmC::GeneticAlgorithmC(istream &)
GeneticAlgorithmC::GeneticAlgorithmC(const GeneticAlgorithmC &)
GeneticAlgorithmC::~GeneticAlgorithmC(void)
GeneticAlgorithmC::SetChromosomes(UIntT,UIntT,UIntT)
GeneticAlgorithmC::RandomPool(const IntSArray1dC &)
GeneticAlgorithmC::Generation(void)
GeneticAlgorithmC::GetBestGene(void) const
GeneticAlgorithmC::Save(ostream &) const
GeneticAlgorithmC::EvaluateFitness(const IntSArray1dC &)
GeneticAlgorithmC::Evaluation(void)
GeneticAlgorithmC::Selection(void)
GeneticAlgorithmC::Mutation(void)
GeneticAlgorithmC::Crossover(void)
GeneticAlgorithmC::Crossover(GeneC &,GeneC &)
GeneticAlgorithmC
 
Base class implementation of genetic algorithm.
 
include "amma/GeneticAlgorithm.hh"
User Level:Default
Library:Tools
Example:exBnd.cc
Section:Optimisation Numerical Methods.Optimisation
In Scope:std

Comments:
Genetic algorithm base class. Uses internal class GeneC to represent individual genes which consist conceptually of a number of chromosomes. All chromosomes have the same number of bits but the number of chromosomes can vary between a specified upper and lower limit.

The function EvaluateFitness must be overloaded in a derived class to provide actual functionality for the algorithm. This algorithm should be applicable in a variety of domains such as feature selection, numerical optimisation and combinatorial optimisation. For an example of its use for numerical optimisation see NumOptimiseGeneticC.

Derived Classes: Child Classes:
GeneC
Variables:
SArray1dC _pool;

UIntT _chromosomeSize;

UIntT _minChromosomes;

UIntT _maxChromosomes;

RealT _probMutation;

RealT _probCrossover;

Methods:
GeneticAlgorithmC(UIntT chromosomeSize,UIntT minChromosomes,UIntT maxChromosomes,UIntT poolSize = 21,RealT probMutation = 0.05,RealT probCrossover = 0.6)
Usual constructor
chromosomeSizenumber of bits per chromosome
minChromosomesminimum number of chromosomes in gene
maxChromosomesmaximum number of chromosomes in gene
poolSize number of genes to store during each generation
probMutation chance per gene of mutation occuring
probCrossover chance per gene pair of crossover occuring

GeneticAlgorithmC(istream & in)
Constructs from stream

GeneticAlgorithmC(const GeneticAlgorithmC & oth)
Copy constructor

~GeneticAlgorithmC()
Virtual destructor because EvaluateFitness virtual

void SetChromosomes(UIntT chromosomeSize,UIntT minChromosomes,UIntT maxChromosomes)
Sets chromosome characteristics as in constructor

void RandomPool(const IntSArray1dC & initialGene)
Generates a random pool of genes.
initialGenestarting point or elite gene from previous generation
Generates a pool containing random genes inserts the initialGene into the pool to ensure its survival.

void Generation()
Performs one generation of evolution
This involves evaluation, selection, mutation and crossover.

const IntSArray1dC GetBestGene() const
Returns the best gene as a bit string

void Save(ostream & out) const
Writes object to stream, cna be loaded using constructor

RealT EvaluateFitness(const IntSArray1dC & gene)
Determine fitness of the given gene bitstring
Must be overloaded in derived class to calculated fitness given a gene string

void Evaluation()
Performs evaluation of the gene pool

void Selection()
Creates next generation gene pool using selection process

void Mutation()
Performs mutation of the genes

void Crossover()
Performs crossover of the genes

void Crossover(GeneC & mum,GeneC & dad)
Performs crossover of a pair of genes


Programmer:Robert Crida, Documentation by CxxDoc: Tue Mar 20 10:49:27 2001