|
GALib-Parallel
Header-only C++ library for parallel evolutionary algorithms
|
Performs k-way tournament selection. More...
#include <TournamentSelection.h>
Public Member Functions | |
| TournamentSelection (size_t tournament_size) | |
| Constructs the selector. | |
| std::size_t | getTournamentSize () const |
| const Individual< GeneType > & | select (const Population< GeneType > &population) override |
| Conducts a tournament and returns the winner. | |
Public Member Functions inherited from galib::Selection< GeneType > | |
| virtual | ~Selection ()=default |
Performs k-way tournament selection.
Randomly samples k individuals from the population and returns the one with the best fitness. Higher tournament sizes result in higher selection pressure.
| GeneType | The numeric type of the genes. |
Definition at line 23 of file TournamentSelection.h.
|
inlineexplicit |
Constructs the selector.
| tournament_size | Number of candidates per tournament. Must be >= 1. |
| std::invalid_argument | if tournament_size is 0. |
Definition at line 32 of file TournamentSelection.h.
|
inline |
Definition at line 38 of file TournamentSelection.h.
|
inlineoverridevirtual |
Conducts a tournament and returns the winner.
| population | Source population. |
Implements galib::Selection< GeneType >.
Definition at line 45 of file TournamentSelection.h.
References galib::Individual< GeneType >::getFitness(), and galib::Population< GeneType >::size().