|
GALib-Parallel
Header-only C++ library for parallel evolutionary algorithms
|
Performs arithmetic (convex) crossover. More...
#include <ArithmeticCrossover.h>
Public Member Functions | |
| std::pair< Individual< GeneType >, Individual< GeneType > > | crossover (const Individual< GeneType > &parent1, const Individual< GeneType > &parent2) override |
| Produces children via linear interpolation of parent genes. | |
Public Member Functions inherited from galib::Crossover< GeneType > | |
| virtual | ~Crossover ()=default |
Performs arithmetic (convex) crossover.
Children are produced as a linear combination of parent genes: Child1 = alpha * Parent1 + (1 - alpha) * Parent2 Child2 = alpha * Parent2 + (1 - alpha) * Parent1 where alpha is a random value in [0, 1] chosen once per crossover event.
| GeneType | The numeric type of the genes. |
Definition at line 24 of file ArithmeticCrossover.h.
|
inlineoverridevirtual |
Produces children via linear interpolation of parent genes.
| parent1 | First parent. |
| parent2 | Second parent. |
| std::invalid_argument | if parents have different genotype sizes. |
Implements galib::Crossover< GeneType >.
Definition at line 34 of file ArithmeticCrossover.h.
References galib::Individual< GeneType >::getGenotype(), and galib::Individual< GeneType >::size().