MTK++ Latest version: 0.2.0

Public Member Functions | Protected Member Functions | Protected Attributes
MTKpp::gaCrossOver Class Reference

Performs recombination of gaChromosomes. More...

#include <mtkpp/src/GA/gaCrossOver.h>

Collaboration diagram for MTKpp::gaCrossOver:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 gaCrossOver (gaOutput *out, std::vector< int > genePerChr, int nChild=1, std::string crossover="random-locus", int chrPerInd=1)
 gaCrossOver Constructor
virtual ~gaCrossOver ()
 gaCrossOver Destructor
bool reproduce (gaIndividual *ind1, gaIndividual *ind2, gaPopulation *pop, std::string name)
 Main function of gaCrossOver.

Protected Member Functions

bool __singleGene (gaIndividual *newInd, gaIndividual *parent)
 Single gene crossover per chromosome.
bool __multipleGene (gaIndividual *newInd, gaIndividual *parent)
 Multiple gene crossover per chromosome.
bool __randomLocus (gaIndividual *newInd, gaIndividual *parent)
 Random locus crossover per chromosome.

Protected Attributes

gaOutputpGaOutput
 gaOperator pointer
int nChild
 Number of offspring produced by each pair of parents.
std::string crossover
 Type of crossover to be carried out.
int chrPerInd
 Number of gaChromsomes per gaIndividual.
std::vector< int > genePerChr
 Number of gaGenes per gaChromsome.

Detailed Description

Performs recombination of gaChromosomes.

Author:
Martin Peters
Version:
0.1
Date:
2005

Constructor & Destructor Documentation

MTKpp::gaCrossOver::gaCrossOver ( gaOutput out,
std::vector< int >  genePerChr,
int  nChild = 1,
std::string  crossover = "random-locus",
int  chrPerInd = 1 
)

gaCrossOver Constructor

Parameters:
outgaOutput pointer
nChildnumber of gaIndividuals to be produced by averaging
crossoverType of crossover procedure employed
chrPerIndNumber of gaChromosomes per gaIndividual
genePerChrNumber of gaGenes per gaChromosome

References chrPerInd, crossover, genePerChr, nChild, and pGaOutput.

MTKpp::gaCrossOver::~gaCrossOver ( ) [virtual]

gaCrossOver Destructor


Member Function Documentation

bool MTKpp::gaCrossOver::reproduce ( gaIndividual ind1,
gaIndividual ind2,
gaPopulation pop,
std::string  name 
)
bool MTKpp::gaCrossOver::__singleGene ( gaIndividual newInd,
gaIndividual parent 
) [protected]

Single gene crossover per chromosome.

Parameters:
newIndFirst gaIndividual
parentSecond gaIndividual
         {} == Individual
         || == chromosome
         [] == gene

         ind1: {|[aaaa][cccc]||[ffff][tttt]|}
                                             --> {|[aaaa][dddd]||[hhhh][tttt]|}
         ind2: {|[bbbb][dddd]||[hhhh][jjjj]|}

References chrPerInd, genePerChr, MTKpp::ranNumBetweenZeroAndOne(), and MTKpp::gaIndividual::setGene().

Referenced by reproduce().

bool MTKpp::gaCrossOver::__multipleGene ( gaIndividual newInd,
gaIndividual parent 
) [protected]

Multiple gene crossover per chromosome.

Parameters:
newIndFirst gaIndividual
parentSecond gaIndividual
         {} == Individual
         || == chromosome
         [] == gene

        ind1: {|[aa][bb][cc]||[dd][ee][ff]|}
                                            --> {|[aa][bb][xx]||[gg][ee][ii]|}
        ind2: {|[zz][yy][xx]||[gg][hh][ii]|}

References chrPerInd, genePerChr, MTKpp::ranNumBetweenZeroAndOne(), and MTKpp::gaIndividual::setGene().

Referenced by reproduce().

bool MTKpp::gaCrossOver::__randomLocus ( gaIndividual newInd,
gaIndividual parent 
) [protected]

Random locus crossover per chromosome.

Parameters:
newIndFirst gaIndividual
parentSecond gaIndividual
         {} == Individual
         || == chromosome
         [] == gene

                    |                  |
        ind1: {|[aa]|[bb][cc]||[dd][ee]|[ff]|}
                    |                  |      --> {|[aa][yy][xx]||[dd][ee][ii]}
        ind2: {|[zz]|[yy][xx]||[gg][hh]|[ii]|}
                    |                  |

References chrPerInd, genePerChr, MTKpp::ranNumBetweenZeroAndOne(), and MTKpp::gaIndividual::setGene().

Referenced by reproduce().


Member Data Documentation

gaOperator pointer

Referenced by gaCrossOver().

int MTKpp::gaCrossOver::nChild [protected]

Number of offspring produced by each pair of parents.

Referenced by gaCrossOver(), and reproduce().

std::string MTKpp::gaCrossOver::crossover [protected]

Type of crossover to be carried out.

Referenced by gaCrossOver(), and reproduce().

Number of gaChromsomes per gaIndividual.

Referenced by __multipleGene(), __randomLocus(), __singleGene(), and gaCrossOver().

std::vector<int> MTKpp::gaCrossOver::genePerChr [protected]

Number of gaGenes per gaChromsome.

Referenced by __multipleGene(), __randomLocus(), __singleGene(), and gaCrossOver().


The documentation for this class was generated from the following files:

Generated on Fri Dec 23 2011 09:28:55 for MTK++ by Doxygen 1.7.5.1