#include <RouletteWheelSelection.h>
◆ RouletteWheelSelection()
Constructs a RouletteWheelSelection object with specified algorithm parameters.
- Parameters
-
params | The algorithm parameters. |
◆ apply()
void RouletteWheelSelection::apply |
( |
std::mt19937 & | generator | ) |
|
|
overridevirtual |
Performs the roulette wheel selection operation.
This method selects individuals from the population based on fitness-proportional selection and stores the selected individuals in the provided vector.
- Parameters
-
generator | The random number generator used for selection. |
Implements Operator.
◆ setIndividual()
void RouletteWheelSelection::setIndividual |
( |
Individual & | individual | ) |
|
|
inlinevirtual |
Sets the individual to be mutated.
- Parameters
-
individual | The individual to be mutated. |
individual | The individual to be mutated. |
Implements Operator.
◆ setParents()
Sets the parents and offspring for the crossover operation.
This method is not used by the RouletteWheelSelection operator.
- Parameters
-
offspring | The offspring individual to be generated. |
parent1 | The first parent individual. |
parent2 | The second parent individual. |
Implements Operator.
◆ setPopulation()
void RouletteWheelSelection::setPopulation |
( |
const std::vector< Individual > & | population, |
|
|
std::vector< Individual > & | selected ) |
|
virtual |
Sets the population and selected vectors for the selection operation.
- Parameters
-
population | The vector of individuals in the population. |
selected | The vector of selected individuals. |
Implements Operator.
◆ population
const std::vector<Individual>* RouletteWheelSelection::population |
|
private |
Pointer to the vector of individuals in the population
◆ populationSize
int RouletteWheelSelection::populationSize |
|
private |
◆ selected
std::vector<Individual>* RouletteWheelSelection::selected |
|
private |
Pointer to the vector of selected individuals
The documentation for this class was generated from the following files: