MTK++ Latest version: 0.2.0
Selects gaIndividuals from gaPopulation based on fitness. More...
#include <mtkpp/src/GA/gaSelection.h>
Public Member Functions | |
gaSelection (gaOperators *parent=0, std::string selection="semi-random", int maxInds=0) | |
gaSelection Constructor | |
virtual | ~gaSelection () |
gaSelection Destructor | |
int | select () |
void | setGaussian (int start, int end, double selPress) |
Create a gaGaussian. | |
Protected Member Functions | |
int | __random () |
Returns uniform random individuals. | |
int | __semi_random () |
Returns semi-random individuals weighted by a normal gaussian distribution. | |
int | __rouletteWheel () |
returns individuals using proportional fitness/roulette wheel | |
int | __tournament () |
returns individuals by perform a tournament (size N) of fitness | |
int | __truncation () |
Used by the keep operator a certain percentage of the generation is allowed to live without competition or selection. | |
Protected Attributes | |
gaOperators * | pParent |
gaOperators pointer | |
gaGaussian * | pGaGaussian |
gaGaussian pointer | |
std::string | selection |
Selection method used. | |
int | maxInds |
Maximum number of gaIndividuals in the gaPopulation. |
Selects gaIndividuals from gaPopulation based on fitness.
Selection Functions Available:
1) Random
2) Semi-random
3) Proportional fitness / Roulette wheel
4) Tournament
5) Truncation
MTKpp::gaSelection::gaSelection | ( | gaOperators * | parent = 0 , |
std::string | selection = "semi-random" , |
||
int | maxInds = 0 |
||
) |
gaSelection Constructor
parent | gaOperators pointer |
selection | Type of selection procedure employed |
maxInds | Maximum gaIndividuals in the gaPopulation |
References maxInds, pGaGaussian, pParent, and selection.
MTKpp::gaSelection::~gaSelection | ( | ) | [virtual] |
gaSelection Destructor
int MTKpp::gaSelection::select | ( | ) |
References __random(), __rouletteWheel(), __semi_random(), __tournament(), and __truncation().
Referenced by MTKpp::gaOperators::average(), MTKpp::gaOperators::crossover(), MTKpp::gaOperators::keep(), and MTKpp::gaOperators::mutate().
void MTKpp::gaSelection::setGaussian | ( | int | start, |
int | end, | ||
double | selPress | ||
) |
Create a gaGaussian.
start | Start value for the gaussian |
end | End value for the gaussian |
selPress | The standard deviation of the gaussian |
References maxInds, pGaGaussian, and MTKpp::gaGaussian::setup().
Referenced by MTKpp::gaOperators::setup().
int MTKpp::gaSelection::__random | ( | ) | [protected] |
Returns uniform random individuals.
References maxInds, and MTKpp::ranNumBetweenZeroAndX().
Referenced by select().
int MTKpp::gaSelection::__semi_random | ( | ) | [protected] |
Returns semi-random individuals weighted by a normal gaussian distribution.
References pGaGaussian, MTKpp::gaGaussian::pick(), and MTKpp::ranNumBetweenZeroAndOne().
Referenced by select().
int MTKpp::gaSelection::__rouletteWheel | ( | ) | [protected] |
int MTKpp::gaSelection::__tournament | ( | ) | [protected] |
int MTKpp::gaSelection::__truncation | ( | ) | [protected] |
gaOperators* MTKpp::gaSelection::pParent [protected] |
gaOperators pointer
Referenced by gaSelection().
gaGaussian* MTKpp::gaSelection::pGaGaussian [protected] |
gaGaussian pointer
Referenced by __semi_random(), gaSelection(), and setGaussian().
std::string MTKpp::gaSelection::selection [protected] |
Selection method used.
Referenced by gaSelection().
int MTKpp::gaSelection::maxInds [protected] |
Maximum number of gaIndividuals in the gaPopulation.
Referenced by __random(), gaSelection(), and setGaussian().
Generated on Fri Dec 23 2011 09:28:55 for MTK++ by Doxygen 1.7.5.1