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