MTK++ Latest version: 0.2.0

Public Member Functions | Protected Types | Protected Attributes
MTKpp::gaChromosome Class Reference

Container for gaGenes. More...

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

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

List of all members.

Public Member Functions

 gaChromosome (gaIndividual *parent=0)
 gaChromosome Constructor
 gaChromosome (gaChromosome *rhs)
 gaChromosome Copy Constructor
virtual ~gaChromosome ()
 gaIndividual Destructor
gaGeneaddGene ()
 Add gaGene to the gaChromosome.
gaGeneaddGene (gaGene *rhs)
 Add gaGene to the gaChromosome.
void delGene (gaGene *gen)
 Delete gaGene from gaChromosome.
void setGene (int n, bool id, bool index, gaChromosome *rhs)
 Set gaGene in gaChromosome.
gaGenegetGene (int n, bool id, bool index)
 Get gaGene from gaChromosome.
void mutateGene (int n, bool id, bool index)
 Mutate gaGene.
void averageGene (int n, bool id, bool index, gaChromosome *rhs)
 Average gaGene.
void initialize ()
 Initialize gaChromosome.
double getAbsValue ()
 Get the absolute value of all the gaGenes summed up.
bool compare (gaChromosome *rhs)
 Compate two gaChromosomes.
void setId (int id)
 Set id of gaChromosome.
int getId ()
 Get id of gaChromosome.
void setName (std::string name)
 Set name of gaChromosome.
std::string getName ()
 Get name of gaChromosome.
gaIndividualgetParent ()
 Get gaIndividual which gaChromosome is a member of.
int getNumGenes ()
 Get number of genes in gaChromosome.
std::vector< double > getGeneticInformation ()
 Get genetic information of the gaChromosome.

Protected Types

typedef std::vector< gaGene * >
::iterator 
geneIterator
 gaGene iterator

Protected Attributes

std::vector< gaGene * > itsGeneList
 gaGene vector
gaIndividualpParent
 gaIndividual pointer
gaGenepGaGene
 gaGene pointer
int itsId
 gaChromosome id
std::string itsName
 gaChromosome name

Detailed Description

Container for gaGenes.

Author:
Martin Peters
Version:
0.1
Date:
2005

Member Typedef Documentation

typedef std::vector<gaGene*>::iterator MTKpp::gaChromosome::geneIterator [protected]

gaGene iterator


Constructor & Destructor Documentation

MTKpp::gaChromosome::gaChromosome ( gaIndividual parent = 0)

gaChromosome Constructor

Parameters:
parentgaIndividual pointer
MTKpp::gaChromosome::gaChromosome ( gaChromosome rhs)
MTKpp::gaChromosome::~gaChromosome ( ) [virtual]

gaIndividual Destructor


Member Function Documentation

gaGene * MTKpp::gaChromosome::addGene ( )

Add gaGene to the gaChromosome.

Returns:
gaGene pointer

References itsGeneList, pGaGene, and MTKpp::gaGene::setId().

Referenced by gaChromosome().

gaGene * MTKpp::gaChromosome::addGene ( gaGene rhs)

Add gaGene to the gaChromosome.

Parameters:
rhsgaGene pointer
Returns:
gaGene pointer

References itsGeneList, pGaGene, and MTKpp::gaGene::setId().

void MTKpp::gaChromosome::delGene ( gaGene gen)

Delete gaGene from gaChromosome.

Parameters:
gengaGene pointer

References itsGeneList.

void MTKpp::gaChromosome::setGene ( int  n,
bool  id,
bool  index,
gaChromosome rhs 
)

Set gaGene in gaChromosome.

Parameters:
nnumber of gaGene either id or index
idbool return by id
indexbool return by index
rhsgaChromosome pointer

References getGene(), MTKpp::gaGene::getId(), itsGeneList, pGaGene, and MTKpp::gaGene::setGene().

Referenced by MTKpp::gaIndividual::setGene().

gaGene * MTKpp::gaChromosome::getGene ( int  n,
bool  id,
bool  index 
)

Get gaGene from gaChromosome.

Parameters:
nnumber of gaGene either id or index
idbool return by id
indexbool return by index
Returns:
gaGene pointer

References MTKpp::gaGene::getId(), itsGeneList, and pGaGene.

Referenced by averageGene(), compare(), gaChromosome(), MTKpp::gaOutput::prtWorld(), and setGene().

void MTKpp::gaChromosome::mutateGene ( int  n,
bool  id,
bool  index 
)

Mutate gaGene.

Parameters:
nnumber of gaGene either id or index
idbool return by id
indexbool return by index

References MTKpp::gaGene::getId(), itsGeneList, MTKpp::gaGene::mutate(), and pGaGene.

Referenced by MTKpp::gaIndividual::mutateGene().

void MTKpp::gaChromosome::averageGene ( int  n,
bool  id,
bool  index,
gaChromosome rhs 
)

Average gaGene.

Parameters:
nnumber of gaGene either id or index
idbool return by id
indexbool return by index
rhsgaChromosome pointer

References MTKpp::gaGene::average(), getGene(), MTKpp::gaGene::getId(), itsGeneList, and pGaGene.

Referenced by MTKpp::gaIndividual::averageGene().

void MTKpp::gaChromosome::initialize ( )
double MTKpp::gaChromosome::getAbsValue ( )

Get the absolute value of all the gaGenes summed up.

Returns:
Absolute value

References MTKpp::gaGene::getAbsValue(), itsGeneList, and pGaGene.

Referenced by MTKpp::gaIndividual::getAbsValue().

bool MTKpp::gaChromosome::compare ( gaChromosome rhs)

Compate two gaChromosomes.

Parameters:
rhsother gaChromosome
Returns:
true/false

References MTKpp::gaGene::compare(), getGene(), MTKpp::gaGene::getId(), itsGeneList, and pGaGene.

void MTKpp::gaChromosome::setId ( int  id)

Set id of gaChromosome.

Parameters:
idgaChromosome id

References itsId.

Referenced by MTKpp::gaIndividual::addChromosome().

int MTKpp::gaChromosome::getId ( )
void MTKpp::gaChromosome::setName ( std::string  name)

Set name of gaChromosome.

Parameters:
namegaChromosome name

References itsName.

std::string MTKpp::gaChromosome::getName ( )

Get name of gaChromosome.

Returns:
gaChromosome name

References itsName.

Referenced by MTKpp::gaOutput::prtWorld().

gaIndividual * MTKpp::gaChromosome::getParent ( )

Get gaIndividual which gaChromosome is a member of.

Returns:
gaIndividual pointer

References pParent.

Referenced by gaChromosome(), and MTKpp::gaGene::gaGene().

int MTKpp::gaChromosome::getNumGenes ( )

Get number of genes in gaChromosome.

Returns:
number of genes in gaChromosome

References itsGeneList.

Referenced by gaChromosome(), MTKpp::gaGene::gaGene(), and MTKpp::gaOutput::prtWorld().

std::vector< double > MTKpp::gaChromosome::getGeneticInformation ( )

Get genetic information of the gaChromosome.

Returns:
genetic info

References MTKpp::gaGene::getGeneticInformation(), itsGeneList, and pGaGene.

Referenced by MTKpp::gaIndividual::getGeneticInformation().


Member Data Documentation

std::vector<gaGene*> MTKpp::gaChromosome::itsGeneList [protected]

gaIndividual pointer

Referenced by gaChromosome(), and getParent().

int MTKpp::gaChromosome::itsId [protected]

gaChromosome id

Referenced by gaChromosome(), getId(), and setId().

std::string MTKpp::gaChromosome::itsName [protected]

gaChromosome name

Referenced by getName(), and setName().


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