#include <NaryTournamentSelection.h>
◆ NaryTournamentSelection()
Constructs an NaryTournamentSelection object with specified algorithm parameters.
- Parameters
-
params | The algorithm parameters including the tournament size. |
◆ apply()
void NaryTournamentSelection::apply |
( |
std::mt19937 & | generator | ) |
|
|
overridevirtual |
Performs the n-ary tournament selection operation.
This method selects individuals from the population based on n-ary tournament competition and stores the selected individuals in the provided vector.
- Parameters
-
generator | The random number generator used for selecting individuals. |
Implements Operator.
◆ setIndividual()
void NaryTournamentSelection::setIndividual |
( |
Individual & | individual | ) |
|
|
inlinevirtual |
Sets the individual to be mutated.
This method sets the individual to be mutated by the operator.
- Parameters
-
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 NaryTournamentSelection operator.
- Parameters
-
offspring | The offspring individual to be generated. |
parent1 | The first parent individual. |
parent2 | The second parent individual. |
Implements Operator.
◆ setPopulation()
void NaryTournamentSelection::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>* NaryTournamentSelection::population |
|
private |
Pointer to the vector of individuals in the population
◆ selected
std::vector<Individual>* NaryTournamentSelection::selected |
|
private |
Pointer to the vector of selected individuals
◆ tournamentSize
int NaryTournamentSelection::tournamentSize |
|
private |
Size of the tournament (number of individuals competing)
The documentation for this class was generated from the following files: