Population Class Reference
This class represents a population of individuals. More...
#include <Population.h>
Public Member Functions | |
| Population (string name, int initialPopulationSize, 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. | |
| Individual * | getIth (int index) const |
| Gets a reference to the i-th individual of the population. | |
| Individual * | getRandom () const |
| Gets a reference to a randomly chosen individual of the population. | |
| Individual * | extractIth (int index) |
| Extracts the i-th individual of the population. If it belongs to more than one population, its population counter is decremented. | |
| void | setIth (int index, Individual *ind) |
| Sets the i-th individual of the population. | |
| void | deleteIth (int index) |
| Deletes the i-th individual of the population if it belongs to one population. Otherwise, the population counter is decremented. | |
| void | addIndividual (Individual *individual) |
| Add a new individual to the population. | |
| void | setFitness (int index, double *fitness) |
| Sets the fitness of the i-th individual. | |
| void | removeAllIndividuals () |
| Deletes all the individuals of the population. | |
| void | reset () |
| Sets the number of individuals to 0. The individuals are not deleted. | |
| void | swap (int index1, int index2) |
| Interchanges the position of two individuals in the population. | |
| void | sortByFitness (int functionIdentifier) |
| Sort in ascending order by fitness value. | |
| void | sortByRankAndCrowding () |
| Sorting in ascending order by rank and crowding. | |
| void | sortByStrengthRawFitnessAndCrowding () |
| Sorting in ascending order by strength raw fitness and crowding. | |
| void | sortByStrengthFitness () |
| Sorting in ascending order by strength fitness. | |
| void | crowdingDistanceAssignment () |
| Calculates the crowding distance of the individuals. | |
| void | strengthAssignment () |
| Calculates the strength of the individuals according to the SPEA2 algorithm. | |
| void | strengthRawFitnessAssignment () |
| Calculates the raw fitness to the individuals according to their strength values. Requires the previous invocation of strengthAssignment(). | |
| void | maxiMinDistanceAssignment () |
| Calculates the maxiMin distance of the individuals to the population. After the method, the individuals are sorted in descending order by distance. | |
| 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. | |
| int | removeDominatedIndividuals () |
| Remove the dominated individuals in the population. | |
| Individual * | tournamentSelection () |
| Randomly selects two individuals and applies tournament selection to chose one of them. Dominanced is considered to decide the winner. | |
| Individual * | strengthAndCrowdingTournamentSelection () |
| Randomly selects two individuals and applies tournament selection to chose one of them. Strength raw fitness and crowding distance are considered to decide the winner. | |
| Individual * | crowdedComparison (Individual *, Individual *) |
| Crowded comparison operator according to the rank defined in NSGA-II. | |
| Individual * | rankingAndCrowdingTournamentSelection () |
| Randomly selects two individuals and applies tournament selection to chose one of them. Ranking and crowding distance are considered to decide the winner. | |
| bool | thereIsAnEqualFitnessIndividual (Individual *individual, int *position) |
| Finds whether there is an indivual in the population with the same fitness. | |
| bool | individualIsInPopulation (Individual *individual, int *position) |
| Finds whether there the individual is in the population. | |
| int | testIfIndividualDominates (Individual *individual) |
| Checks if the individual is dominated by any member of the population. | |
| void | clustering (int clusters, Population **centroids) |
| Apply a minimal spanning tree algorithm to perform a clustering of the individuals in the population. | |
| void | minimumDistanceToPopulation (Individual *individual) |
Public Attributes | |
| string | name_ |
| int | populationSize_ |
| int | maximumPopulationSize_ |
| Individual ** | population_ |
| Random * | random_ |
| MultiobjectiveProblem * | problem_ |
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 25 of file Population.h.
Constructor & Destructor Documentation
|
||||||||||||||||||||||||
|
Definition at line 21 of file Population.cpp. References maximumPopulationSize_, name_, population_, populationSize_, problem_, and random_. Referenced by clustering(), maxiMinDistanceAssignment(), and removeDominatedIndividuals(). |
|
|
Destructor of the class Definition at line 51 of file Population.cpp. References population_, and populationSize_. |
Member Function Documentation
|
|
Definition at line 167 of file Population.cpp. References maximumPopulationSize_, name_, population_, and populationSize_. Referenced by Ssmo::addImprovedIndividual(), AbYSS::addImprovedIndividual(), AbYSS::archiveSolution(), Ranking::copyFrontToPopulation(), maxiMinDistanceAssignment(), Ssmo2::referenceSetUpdate(), Ssmo1::referenceSetUpdate(), AbYSS::referenceSetUpdate(), removeDominatedIndividuals(), Ssmo2::removeIndividuals(), Ssmo1::removeIndividuals(), AbYSS::solutionCombination(), and AbYSS::start(). |
|
||||||||||||
|
Definition at line 797 of file Population.cpp. References RealGene::allele_, getIth(), MAX_REAL, name_, MultiobjectiveProblem::numberOfVariables_, Population(), populationSize_, problem_, and random_. Referenced by Ssmo2::referenceSetUpdate(). |
|
||||||||||||
|
Definition at line 594 of file Population.cpp. References Individual::distance_, and Individual::rank_. Referenced by rankingAndCrowdingTournamentSelection(). |
|
|
Definition at line 409 of file Population.cpp. References Individual::distance_, Individual::fitness_, getIth(), getPopulationSize(), MAX_REAL, name_, MultiobjectiveProblem::numberOfFunctions_, and problem_. Referenced by AbYSS::archiveSolution(), Ssmo1::referenceSetUpdate(), Ssmo2::removeDominatedIndividuals(), Ssmo1::removeDominatedIndividuals(), Ssmo2::removeIndividuals(), Ssmo1::removeIndividuals(), and AbYSS::removeIndividuals(). |
|
|
Definition at line 186 of file Population.cpp. References name_, Individual::numberOfPopulations_, population_, and populationSize_. Referenced by AbYSS::archiveSolution(), and removeAllIndividuals(). |
|
|
Definition at line 115 of file Population.cpp. References name_, Individual::numberOfPopulations_, population_, and populationSize_. Referenced by Ssmo2::referenceSetUpdate(), Ssmo1::referenceSetUpdate(), AbYSS::referenceSetUpdate(), removeDominatedIndividuals(), Ssmo2::removeIndividuals(), and Ssmo1::removeIndividuals(). |
|
|
Definition at line 79 of file Population.cpp. References name_, population_, and populationSize_. Referenced by AbYSS::archiveSolution(), K_Distance::calculateDistanceMatrix(), clustering(), crowdingDistanceAssignment(), Ssmo::distanceToPopulation(), AbYSS::distanceToPopulation(), maxiMinDistanceAssignment(), minimumDistanceToPopulation(), printFitness(), printGenotype(), rankingAndCrowdingTournamentSelection(), Ranking::rankPopulation(), Ssmo2::referenceSetUpdate(), Ssmo1::referenceSetUpdate(), AbYSS::referenceSetUpdate(), Nsga2::start(), strengthAndCrowdingTournamentSelection(), strengthRawFitnessAssignment(), Ssmo2::subsetGeneration(), Ssmo1::subsetGeneration(), AbYSS::subsetGeneration(), and tournamentSelection(). |
|
|
Definition at line 70 of file Population.cpp. References maximumPopulationSize_. |
|
|
|
Definition at line 95 of file Population.cpp. References name_, population_, populationSize_, random_, and Random::rnd(). |
|
||||||||||||
|
Definition at line 743 of file Population.cpp. References population_, and populationSize_. |
|
|
Definition at line 448 of file Population.cpp. References addIndividual(), Individual::distance_, getIth(), getPopulationSize(), MAX_REAL, MultiobjectiveProblem::numberOfFunctions_, Population(), and problem_. |
|
|
Definition at line 498 of file Population.cpp. References Individual::chromosome_, Individual::distance_, Chromosome::gene_, getIth(), getPopulationSize(), Gene::getRealAllele(), MultiobjectiveProblem::numberOfVariables_, and problem_. |
|
|
Definition at line 248 of file Population.cpp. References getIth(), getPopulationSize(), MultiobjectiveProblem::numberOfFunctions_, and problem_. Referenced by MoEA::printFunctionValuesToFile(). |
|
|
Definition at line 271 of file Population.cpp. References getIth(), getPopulationSize(), MultiobjectiveProblem::numberOfVariables_, and problem_. Referenced by MoEA::printVariablesToFile(). |
|
|
Definition at line 656 of file Population.cpp. References crowdedComparison(), getIth(), populationSize_, random_, and Random::rnd(). |
|
|
Definition at line 213 of file Population.cpp. References deleteIth(), and populationSize_. Referenced by removeDominatedIndividuals(), Ssmo2::removeIndividuals(), and Ssmo1::removeIndividuals(). |
|
|
Definition at line 613 of file Population.cpp. References addIndividual(), Ranking::copyFrontToPopulation(), extractIth(), getPopulationSize(), maximumPopulationSize_, Ranking::nonDominatedFront_, Population(), populationSize_, problem_, random_, Ranking::rankPopulation(), and removeAllIndividuals(). |
|
|
Definition at line 228 of file Population.cpp. References populationSize_. Referenced by Ranking::rankPopulation(). |
|
||||||||||||
|
Definition at line 158 of file Population.cpp. References population_, and Individual::setFitness(). |
|
||||||||||||
|
Definition at line 142 of file Population.cpp. References name_, population_, and populationSize_. |
|
|
Definition at line 325 of file Population.cpp. References MultiobjectiveProblem::numberOfFunctions_, population_, populationSize_, problem_, and swap(). Referenced by Ssmo::printToFiles(), Nsga2::printToFiles(), and AbYSS::printToFiles(). |
|
|
Definition at line 390 of file Population.cpp. References population_, populationSize_, and swap(). Referenced by Ssmo1::referenceSetUpdate(), Ssmo2::removeDominatedIndividuals(), Ssmo1::removeDominatedIndividuals(), Ssmo2::removeIndividuals(), Ssmo1::removeIndividuals(), and AbYSS::removeIndividuals(). |
|
|
Definition at line 373 of file Population.cpp. References population_, populationSize_, and swap(). Referenced by AbYSS::referenceSetUpdate(). |
|
|
Definition at line 351 of file Population.cpp. References population_, populationSize_, and swap(). |
|
|
Definition at line 296 of file Population.cpp. References Individual::distance_, getIth(), populationSize_, random_, Random::rnd(), and Individual::strengthRawFitness_. |
|
|
Definition at line 528 of file Population.cpp. References getPopulationSize(). Referenced by AbYSS::referenceSetUpdate(). |
|
|
Definition at line 562 of file Population.cpp. References getIth(), getPopulationSize(), and Individual::strengthRawFitness_. Referenced by AbYSS::referenceSetUpdate(). |
|
||||||||||||
|
Definition at line 236 of file Population.cpp. References population_. Referenced by sortByFitness(), sortByRankAndCrowding(), sortByStrengthFitness(), and sortByStrengthRawFitnessAndCrowding(). |
|
|
Definition at line 771 of file Population.cpp. References Individual::dominanceTest(), and getPopulationSize(). |
|
||||||||||||
|
Definition at line 712 of file Population.cpp. References Individual::identicalFitness(), population_, and populationSize_. Referenced by Ssmo::addImprovedIndividual(), and AbYSS::addImprovedIndividual(). |
|
|
Definition at line 675 of file Population.cpp. References Individual::dominanceTest(), getIth(), Individual::numberOfViolatedConstraintsTest(), populationSize_, random_, Random::rnd(), and Random::rndreal(). |
Member Data Documentation
|
|
Definition at line 29 of file Population.h. Referenced by Ssmo::addImprovedIndividual(), addIndividual(), getMaximumPopulationSize(), K_Distance::K_Distance(), Population(), Ranking::Ranking(), removeDominatedIndividuals(), K_Distance::~K_Distance(), and Ranking::~Ranking(). |
|
|
Definition at line 27 of file Population.h. Referenced by addIndividual(), clustering(), crowdingDistanceAssignment(), deleteIth(), extractIth(), getIth(), getRandom(), Population(), Ranking::rankPopulation(), and setIth(). |
|
|
Definition at line 30 of file Population.h. Referenced by addIndividual(), deleteIth(), extractIth(), getIth(), getRandom(), individualIsInPopulation(), Population(), setFitness(), setIth(), sortByFitness(), sortByRankAndCrowding(), sortByStrengthFitness(), sortByStrengthRawFitnessAndCrowding(), swap(), thereIsAnEqualFitnessIndividual(), and ~Population(). |
|
|
|
Definition at line 33 of file Population.h. Referenced by clustering(), crowdingDistanceAssignment(), K_Distance::K_Distance(), maxiMinDistanceAssignment(), minimumDistanceToPopulation(), Population(), printFitness(), printGenotype(), Ranking::Ranking(), removeDominatedIndividuals(), and sortByFitness(). |
|
|
Definition at line 31 of file Population.h. Referenced by clustering(), getRandom(), Population(), Ranking::Ranking(), rankingAndCrowdingTournamentSelection(), removeDominatedIndividuals(), strengthAndCrowdingTournamentSelection(), and tournamentSelection(). |
The documentation for this class was generated from the following files: