|
GALib-Parallel
Header-only C++ library for parallel evolutionary algorithms
|
Selects the fittest direct neighbour of a cell in a cellular grid. More...
#include <BestNeighborSelection.h>
Public Member Functions | |
| const Individual< GeneType > & | select (const Population< GeneType > &population, std::size_t row, std::size_t col, std::size_t rows, std::size_t cols) const override |
| Returns the best direct neighbour of the specified cell. | |
Public Member Functions inherited from galib::LocalSelection< GeneType > | |
| virtual | ~LocalSelection ()=default |
| Virtual destructor for polymorphic use. | |
Selects the fittest direct neighbour of a cell in a cellular grid.
The neighbourhood is the Von Neumann neighbourhood: up, down, left, and right. Grid boundaries wrap around, so border cells still have four neighbours.
| GeneType | Numeric type of each gene. |
Definition at line 20 of file BestNeighborSelection.h.
|
inlineoverridevirtual |
Returns the best direct neighbour of the specified cell.
| population | Population interpreted as a 2D grid in row-major order. |
| row | Row of the current cell. |
| col | Column of the current cell. |
| rows | Total number of grid rows. Must be non-zero. |
| cols | Total number of grid columns. Must be non-zero. |
| std::invalid_argument | if rows or cols is zero. |
Implements galib::LocalSelection< GeneType >.
Definition at line 33 of file BestNeighborSelection.h.
References galib::Individual< GeneType >::getFitness().