MTK++ Latest version: 0.2.0

Public Member Functions | Protected Types | Protected Attributes | Friends
MTKpp::gaWorld Class Reference

Container for gaRegions. More...

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

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

List of all members.

Public Member Functions

 gaWorld (std::string name="world")
 gaWorld Constructor
virtual ~gaWorld ()
 gaWorld Destructor
gaRegionaddRegion ()
 Add gaRegion to the gaWorld.
void delRegion (gaRegion *reg)
 Delete gaRegion in the gaWorld.
gaRegiongetRegion (int n, bool id, bool index)
 Get gaRegion in the gaWorld.
gaRegiongetRegion (std::string name)
 Get gaRegion in the gaWorld.
std::vector< gaRegion * > getRegions ()
 Get gaRegions in the gaWorld.
int getNumRegions ()
 Get number of gaRegions in the gaWorld.
void setup (const int &chrPerInd, std::vector< int > genePerChr, std::vector< int > geneSizes, const std::string outputFile, const std::string restartFile, const std::string convergFile, const int outputLevel)
 Set up gaWorld.
gaOutputgetGaOutput ()
 Get gaOutput pointer.
void initialize ()
 Initialize gaWorld.
void rank ()
 Rank gaRegions.
void setName (std::string name)
 Set the gaWorld name.
std::string getName ()
 Get the gaWorld name.
int getChrPerInd ()
 Get the number of gaChromosomes per gaIndividual.
void setGenePerChr (std::vector< int > gPc)
 Set the number of gaGenes per gaChromosome.
std::vector< int > getGenePerChr ()
 Get the number of gaGenes per gaChromosome.
void setGeneSizes (std::vector< int > gS)
 Set the gaGenes sizes.
std::vector< int > getGeneSizes ()
 Get the gaGenes sizes.
std::string getOutputFileName ()
 Get the output file name.
std::string getRestartFileName ()
 Get the restart file name.
std::string getConvergFileName ()
 Get the convergence file name.
int getLevelOfOutput ()
 Get the level of output.
void setAuthor (std::string name)
 Set author.
std::vector< std::string > getAuthors ()
 Get authors.
void setStatus (int status)
 Set status.
int getStatus ()
 Get status.

Protected Types

typedef std::vector< gaRegion * >
::iterator 
regionIterator
 gaRegion iterator

Protected Attributes

std::vector< gaRegion * > itsRegionList
 gaRegion vector
gaRegionpGaRegion
 gaRegion pointer
gaOutputpGaOutput
 gaOutput pointer
std::string itsName
 gaWorld name
int chrPerInd
 number of gaChromosomes per gaIndividual
std::vector< int > genePerChr
 number of gaGenes per gaChromosome
std::vector< int > geneSizes
 gaGene sizes
std::string outputFile
 Output file name.
std::string restartFile
 Restart file name.
std::string convergFile
 Convergence file name.
int levelOfOutput
 Level of output to be produced.
std::vector< std::string > authors
 Energy function Authors.
int status
 Status of the program.
time_t startTime
 Start time.
time_t endTime
 End time.

Friends

class gaRegion
class gaOutput

Detailed Description

Container for gaRegions.

Author:
Martin Peters
Version:
0.1
Date:
2005

Member Typedef Documentation

typedef std::vector<gaRegion*>::iterator MTKpp::gaWorld::regionIterator [protected]

gaRegion iterator


Constructor & Destructor Documentation

MTKpp::gaWorld::gaWorld ( std::string  name = "world")
MTKpp::gaWorld::~gaWorld ( ) [virtual]

gaWorld Destructor

References pGaOutput.


Member Function Documentation

gaRegion * MTKpp::gaWorld::addRegion ( )

Add gaRegion to the gaWorld.

Returns:
gaRegion pointer

References gaRegion, itsRegionList, and pGaRegion.

void MTKpp::gaWorld::delRegion ( gaRegion reg)

Delete gaRegion in the gaWorld.

Parameters:
reggaRegion to be deleted

References itsRegionList.

gaRegion * MTKpp::gaWorld::getRegion ( int  n,
bool  id,
bool  index 
)

Get gaRegion in the gaWorld.

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

NEED SOME ERROR HANDLING HERE

References MTKpp::gaRegion::getId(), itsRegionList, and pGaRegion.

gaRegion * MTKpp::gaWorld::getRegion ( std::string  name)

Get gaRegion in the gaWorld.

Parameters:
namename of gaRegion
Returns:
gaRegion pointer

References MTKpp::gaRegion::getName(), itsRegionList, and pGaRegion.

std::vector< gaRegion * > MTKpp::gaWorld::getRegions ( )

Get gaRegions in the gaWorld.

Returns:
vector of gaRegion pointers

References itsRegionList.

Referenced by MTKpp::gaOutput::prtOptions(), MTKpp::gaOutput::prtWorld(), and MTKpp::gaOutput::writeConvergence().

int MTKpp::gaWorld::getNumRegions ( )

Get number of gaRegions in the gaWorld.

Returns:
number of gaRegions

References itsRegionList.

void MTKpp::gaWorld::setup ( const int &  chrPerInd,
std::vector< int >  genePerChr,
std::vector< int >  geneSizes,
const std::string  outputFile,
const std::string  restartFile,
const std::string  convergFile,
const int  outputLevel 
)

Set up gaWorld.

Parameters:
chrPerIndnumber of gaChromosome per gaIndividual
genePerChrnumber of gaGenes per gaChromosomes
geneSizessize of each gaGene
outputFileOutput File Name
restartFileRestart File Name
convergFileConvergence File Name
outputLevelOutput verbosity control, levels include:
  1. 1 (default)
  2. 2
  3. 3

References chrPerInd, convergFile, genePerChr, geneSizes, levelOfOutput, MTKpp::gaOutput::openOutputFile(), outputFile, pGaOutput, restartFile, and MTKpp::gaOutput::writeError().

gaOutput * MTKpp::gaWorld::getGaOutput ( )

Get gaOutput pointer.

Returns:
gaOutput pointer

References pGaOutput.

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

void MTKpp::gaWorld::initialize ( )
void MTKpp::gaWorld::rank ( )

Rank gaRegions.

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

Set the gaWorld name.

Parameters:
namegaWorld name

References itsName.

std::string MTKpp::gaWorld::getName ( )

Get the gaWorld name.

Returns:
gaWorld name

References itsName.

Referenced by MTKpp::gaOutput::prtOptions(), and MTKpp::gaOutput::prtWorld().

int MTKpp::gaWorld::getChrPerInd ( )

Get the number of gaChromosomes per gaIndividual.

Returns:
number of gaChromosomes per gaIndividual

References chrPerInd.

Referenced by MTKpp::gaGene::initialize(), MTKpp::gaGene::mutate(), MTKpp::gaOutput::prtOptions(), and MTKpp::gaOperators::setup().

void MTKpp::gaWorld::setGenePerChr ( std::vector< int >  gPc)

Set the number of gaGenes per gaChromosome.

Parameters:
gPcnumber of gaGenes per gaChromosome

References genePerChr.

std::vector< int > MTKpp::gaWorld::getGenePerChr ( )

Get the number of gaGenes per gaChromosome.

Returns:
number of gaGenes per gaChromosome

References genePerChr.

Referenced by MTKpp::gaGene::initialize(), MTKpp::gaGene::mutate(), and MTKpp::gaOperators::setup().

void MTKpp::gaWorld::setGeneSizes ( std::vector< int >  gS)

Set the gaGenes sizes.

Parameters:
gSgaGene sizes

References geneSizes.

std::vector< int > MTKpp::gaWorld::getGeneSizes ( )

Get the gaGenes sizes.

Returns:
gaGene sizes

References geneSizes.

std::string MTKpp::gaWorld::getOutputFileName ( )

Get the output file name.

Returns:
output file name

References outputFile.

Referenced by MTKpp::gaOutput::openOutputFile(), and MTKpp::gaOutput::prtOptions().

std::string MTKpp::gaWorld::getRestartFileName ( )

Get the restart file name.

Returns:
restart file name

References restartFile.

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

std::string MTKpp::gaWorld::getConvergFileName ( )

Get the convergence file name.

Returns:
convergence file name

References convergFile.

Referenced by MTKpp::gaOutput::prtOptions(), and MTKpp::gaOutput::writeConvergence().

int MTKpp::gaWorld::getLevelOfOutput ( )

Get the level of output.

Returns:
level of output

References levelOfOutput.

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

void MTKpp::gaWorld::setAuthor ( std::string  name)

Set author.

Parameters:
nameName and email address of author
         example: "john doe (johndoe@ga.com)"

References authors.

Referenced by gaWorld().

std::vector< std::string > MTKpp::gaWorld::getAuthors ( )

Get authors.

Returns:
vector of author names

References authors.

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

void MTKpp::gaWorld::setStatus ( int  status)

Set status.

Parameters:
status
  1. 0 ok
  2. 1 warnings
  3. 2 error

References status.

Referenced by MTKpp::gaOutput::prtError(), and MTKpp::gaOutput::prtWarning().

int MTKpp::gaWorld::getStatus ( )

Get status.

Returns:
status
  1. 0 ok
  2. 1 warnings
  3. 2 error

References status.


Friends And Related Function Documentation

friend class gaRegion [friend]

Referenced by addRegion().

friend class gaOutput [friend]

Referenced by gaWorld().


Member Data Documentation

std::vector<gaRegion*> MTKpp::gaWorld::itsRegionList [protected]

gaRegion pointer

Referenced by addRegion(), gaWorld(), getRegion(), and initialize().

gaOutput pointer

Referenced by gaWorld(), getGaOutput(), setup(), and ~gaWorld().

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

gaWorld name

Referenced by gaWorld(), getName(), and setName().

int MTKpp::gaWorld::chrPerInd [protected]
std::vector<int> MTKpp::gaWorld::genePerChr [protected]
std::vector<int> MTKpp::gaWorld::geneSizes [protected]
std::string MTKpp::gaWorld::outputFile [protected]

Output file name.

Referenced by gaWorld(), getOutputFileName(), and setup().

std::string MTKpp::gaWorld::restartFile [protected]

Restart file name.

Referenced by gaWorld(), getRestartFileName(), and setup().

std::string MTKpp::gaWorld::convergFile [protected]

Convergence file name.

Referenced by gaWorld(), getConvergFileName(), and setup().

Level of output to be produced.

Referenced by gaWorld(), getLevelOfOutput(), and setup().

std::vector<std::string> MTKpp::gaWorld::authors [protected]

Energy function Authors.

Referenced by getAuthors(), and setAuthor().

int MTKpp::gaWorld::status [protected]

Status of the program.

  1. 0 ok
  2. 1 warnings
  3. 2 error

Referenced by gaWorld(), getStatus(), and setStatus().

time_t MTKpp::gaWorld::startTime [protected]

Start time.

Referenced by gaWorld().

time_t MTKpp::gaWorld::endTime [protected]

End time.

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


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