Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members

Population Class Reference

This class represents a population of individuals. More...

#include <Population.h>

List of all members.

Public Member Functions

 Population (int populationSize, int maximumPopulationSize, Random *random, MultiobjectiveProblem *problem)
 Constructor.

 ~Population (void)
 Destructor.

int getPopulationSize () const
 Gets the size of the population.

int getMaximumPopulationSize () const
 Gets the maximum size of the population.

IndividualgetIth (int index) const
 Gets the i-th individual of the population.

void setIth (int index, Individual *ind)
 Sets the i-th individual of the population.

void deleteIth (int index)
 Gets the i-th individual of the population.

void addIndividual (Individual *individual)
 Sets the fitness of the i-th individual.

void setFitness (int index, double *fitness)
 Sets the fitness of the i-th individual.

void printFitness (char *fileName)
 Prints the fitness of the individuals in the population.

void printGenotype (char *fileName)
 Prints the genotype of the individuals in the population.


Protected Attributes

int populationSize_
 The number of individuals.

int maximumPopulationSize_
 The maximun number of individuals.

Individual ** population_
 The vector of individuals.

Randomrandom_
 Random number management.

MultiobjectiveProblemproblem_
 Problem to solve.


Detailed Description

The population size can be dynamic: individuals can be deleted, and new individuals can be added. The number of elements is bounded.

Definition at line 23 of file Population.h.


Constructor & Destructor Documentation

Population::Population int  populationSize,
int  maximumPopulationSize,
Random random,
MultiobjectiveProblem problem
 

Parameters:
populationSize The size of the population
chromosomeLength The length of the individual chromosomes
numberOfFunctions The number of objective functions
Constructor of the class

Definition at line 19 of file Population.cpp.

References maximumPopulationSize_, population_, populationSize_, problem_, and random_.

Population::~Population void   ) 
 

Destructor of the class

Definition at line 44 of file Population.cpp.


Member Function Documentation

void Population::addIndividual Individual individual  ) 
 

Parameters:
index The position of the individual
fitness The individual fitness

Definition at line 111 of file Population.cpp.

References maximumPopulationSize_, population_, and populationSize_.

Referenced by Paes::addToArchive(), and Paes::archiveSolution().

void Population::deleteIth int  index  ) 
 

Parameters:
index The index of the individual
Returns:
The i-th individual

Definition at line 129 of file Population.cpp.

References population_, and populationSize_.

Referenced by Paes::archiveSolution().

Individual * Population::getIth int  index  )  const
 

Parameters:
index The index of the individual
Returns:
The i-th individual

Definition at line 69 of file Population.cpp.

References population_.

Referenced by Paes::archiveSolution(), Paes::compareToArchive(), printFitness(), printGenotype(), and AdaptiveGrid::updateGridLocations().

int Population::getMaximumPopulationSize  )  const
 

Returns:
The maximum size of the population

Definition at line 60 of file Population.cpp.

References maximumPopulationSize_.

int Population::getPopulationSize  )  const
 

Returns:
The size of the population

Definition at line 51 of file Population.cpp.

References populationSize_.

Referenced by Paes::archiveSolution(), Paes::compareToArchive(), printFitness(), printGenotype(), Paes::start(), and AdaptiveGrid::updateGridLocations().

void Population::printFitness char *  fileName  ) 
 

Parameters:
fileName The name of the ouput file

Definition at line 148 of file Population.cpp.

References Individual::getFitness(), getIth(), getPopulationSize(), MultiobjectiveProblem::numberOfFunctions_, and problem_.

Referenced by Paes::printToFiles().

void Population::printGenotype char *  fileName  ) 
 

Parameters:
fileName The name of the ouput file

Definition at line 169 of file Population.cpp.

References Individual::chromosome_, Chromosome::gene_, getIth(), getPopulationSize(), MultiobjectiveProblem::numberOfVariables_, problem_, and Gene::writeGenotype().

Referenced by Paes::printToFiles().

void Population::setFitness int  index,
double *  fitness
 

Parameters:
index The position of the individual
fitness The individual fitness

Definition at line 101 of file Population.cpp.

References population_, and Individual::setFitness().

void Population::setIth int  index,
Individual individual
 

Parameters:
index The index of the individual
individual The individual to assign

Definition at line 85 of file Population.cpp.

References population_.


Member Data Documentation

int Population::maximumPopulationSize_ [protected]
 

Definition at line 26 of file Population.h.

Referenced by addIndividual(), getMaximumPopulationSize(), and Population().

Individual** Population::population_ [protected]
 

Definition at line 27 of file Population.h.

Referenced by addIndividual(), deleteIth(), getIth(), Population(), setFitness(), and setIth().

int Population::populationSize_ [protected]
 

Definition at line 25 of file Population.h.

Referenced by addIndividual(), deleteIth(), getPopulationSize(), and Population().

MultiobjectiveProblem* Population::problem_ [protected]
 

Definition at line 30 of file Population.h.

Referenced by Population(), printFitness(), and printGenotype().

Random* Population::random_ [protected]
 

Definition at line 28 of file Population.h.

Referenced by Population().


The documentation for this class was generated from the following files:
Generated on Wed Feb 11 10:38:04 2004 for Paes by doxygen 1.3.3