MTK++ Latest version: 0.2.0

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

Container for gaIndividuals. More...

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

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

List of all members.

Public Member Functions

 gaPopulation (gaRegion *parent=0)
 gaPopulation Constructor
virtual ~gaPopulation ()
 gaRegion Destructor
gaIndividualaddIndividual ()
 Add gaIndividual to gaPopulation.
gaIndividualaddIndividual (gaIndividual *ind)
 Add gaIndividual to gaPopulation.
void delIndividual (gaIndividual *ind)
 Delete gaIndividual from gaPopulation.
gaIndividualgetIndividual (int number, bool id, bool index)
 Get gaIndividual from gaPopulation.
gaIndividualgetIndividual (std::string name)
 Get gaIndividual from gaPopulation.
std::vector< gaIndividual * > getIndividuals ()
 Get gaIndividual list from gaPopulation.
gaIndividualgetLastAdded ()
 Get last gaIndividual to be added to gaPopulation.
void setup (const int &maxInds)
 Setup gaPopulation.
void initialize ()
 Initialize gaPopulation.
void getAbsValues ()
 Get absolute values for all gaIndividuals in gaPopulation.
void rank ()
 Rank all gaIndividuals in gaPopulation.
void setId (int id)
 Set id for gaPopulation.
int getId ()
 Get id of gaPopulation.
void setName (std::string name)
 Set name for gaPopulation.
std::string getName ()
 Get name of gaPopulation.
gaRegiongetParent ()
 Get gaRegion which gaPopulation is a member of.
int getNumIndividuals ()
 Get number of gaIndividuals in gaPopulation.
gaIndividualgetBestIndividual (int &i)
 Get best gaIndividual in gaPopulation in terms of fitness.

Protected Types

typedef std::vector
< gaIndividual * >::iterator 
individualIterator
 gaIndividual pointer

Protected Attributes

std::vector< gaIndividual * > itsIndividualList
 gaIndividual list
gaRegionpParent
 gaRegion pointer
gaIndividualpGaIndividual
 gaIndividual pointer
gaIndividualbestIndividual
 gaIndividual pointer
int itsId
 gaPopulation id
std::string itsName
 gaPopulation name

Detailed Description

Container for gaIndividuals.

Author:
Martin Peters
Version:
0.1
Date:
2005

Member Typedef Documentation

typedef std::vector<gaIndividual*>::iterator MTKpp::gaPopulation::individualIterator [protected]

gaIndividual pointer


Constructor & Destructor Documentation

MTKpp::gaPopulation::gaPopulation ( gaRegion parent = 0)

gaPopulation Constructor

Parameters:
parentgaRegion pointer
MTKpp::gaPopulation::~gaPopulation ( ) [virtual]

gaRegion Destructor


Member Function Documentation

gaIndividual * MTKpp::gaPopulation::addIndividual ( )
gaIndividual * MTKpp::gaPopulation::addIndividual ( gaIndividual ind)

Add gaIndividual to gaPopulation.

Parameters:
indgaIndividual pointer
Returns:
gaIndividual pointer

References itsIndividualList, pGaIndividual, and MTKpp::gaIndividual::setId().

void MTKpp::gaPopulation::delIndividual ( gaIndividual ind)

Delete gaIndividual from gaPopulation.

Parameters:
indgaIndividual to be deleted
Returns:
gaIndividual pointer

References itsIndividualList.

Referenced by MTKpp::gaOperators::removeRedundant().

gaIndividual * MTKpp::gaPopulation::getIndividual ( int  number,
bool  id,
bool  index 
)
gaIndividual * MTKpp::gaPopulation::getIndividual ( std::string  name)

Get gaIndividual from gaPopulation.

Parameters:
namegaIndividual name
Returns:
gaIndividual pointer

References MTKpp::gaIndividual::getName(), itsIndividualList, and pGaIndividual.

std::vector< gaIndividual * > MTKpp::gaPopulation::getIndividuals ( )
gaIndividual * MTKpp::gaPopulation::getLastAdded ( )

Get last gaIndividual to be added to gaPopulation.

Returns:
gaIndividual pointer

References itsIndividualList.

Referenced by MTKpp::gaOperators::mutate().

void MTKpp::gaPopulation::setup ( const int &  maxInds)

Setup gaPopulation.

Parameters:
maxIndsMaximum number of gaIndividuals
void MTKpp::gaPopulation::initialize ( )
void MTKpp::gaPopulation::getAbsValues ( )

Get absolute values for all gaIndividuals in gaPopulation.

References MTKpp::gaIndividual::getAbsValue(), getIndividual(), getNumIndividuals(), and pGaIndividual.

Referenced by MTKpp::gaOperators::removeRedundant().

void MTKpp::gaPopulation::rank ( )
void MTKpp::gaPopulation::setId ( int  id)

Set id for gaPopulation.

Parameters:
idgaPopulation id

References itsId.

Referenced by MTKpp::gaRegion::addPopulation().

int MTKpp::gaPopulation::getId ( )

Get id of gaPopulation.

Returns:
id of gaPopulation

References itsId.

Referenced by MTKpp::gaRegion::getPopulation(), and MTKpp::gaOutput::prtWorld().

void MTKpp::gaPopulation::setName ( std::string  name)

Set name for gaPopulation.

Parameters:
namegaPopulation name

References itsName.

Referenced by MTKpp::gaRegion::addPopulation().

std::string MTKpp::gaPopulation::getName ( )
gaRegion * MTKpp::gaPopulation::getParent ( )

Get gaRegion which gaPopulation is a member of.

Returns:
gaRegion pointer

References pParent.

Referenced by MTKpp::gaGene::gaGene().

int MTKpp::gaPopulation::getNumIndividuals ( )
gaIndividual * MTKpp::gaPopulation::getBestIndividual ( int &  i)

Get best gaIndividual in gaPopulation in terms of fitness.

Parameters:
iindex of best gaIndividual
Returns:
gaIndividual pointer

References bestIndividual, MTKpp::gaRegion::funcDir, MTKpp::gaIndividual::getFitness(), itsIndividualList, pGaIndividual, and pParent.

Referenced by MTKpp::gaOperators::keep().


Member Data Documentation

gaIndividual pointer

Referenced by getBestIndividual(), and initialize().

int MTKpp::gaPopulation::itsId [protected]

gaPopulation id

Referenced by getId(), and setId().

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

gaPopulation name

Referenced by getName(), initialize(), 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