|
GALib-Parallel
Header-only C++ library for parallel evolutionary algorithms
|
Performs uniform crossover. More...
#include <UniformCrossover.h>
Public Member Functions | |
| std::pair< Individual< GeneType >, Individual< GeneType > > | crossover (const Individual< GeneType > &parent1, const Individual< GeneType > &parent2) override |
| Randomly picks genes from either parent at each position. | |
Public Member Functions inherited from galib::Crossover< GeneType > | |
| virtual | ~Crossover ()=default |
Performs uniform crossover.
For every gene position, there is a 50% chance to take the gene from Parent 1 and a 50% chance to take it from Parent 2.
| GeneType | The numeric type of the genes. |
Definition at line 22 of file UniformCrossover.h.
|
inlineoverridevirtual |
Randomly picks genes from either parent at each position.
| parent1 | First parent. |
| parent2 | Second parent. |
| std::invalid_argument | if parents have different genotype sizes. |
Implements galib::Crossover< GeneType >.
Definition at line 32 of file UniformCrossover.h.
References galib::Individual< GeneType >::getGenotype(), and galib::Individual< GeneType >::size().