GALib-Parallel
Header-only C++ library for parallel evolutionary algorithms
Loading...
Searching...
No Matches
Public Member Functions | List of all members
galib::ArithmeticCrossover< GeneType > Class Template Reference

Performs arithmetic (convex) crossover. More...

#include <ArithmeticCrossover.h>

Inheritance diagram for galib::ArithmeticCrossover< GeneType >:
[legend]

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
 

Detailed Description

template<typename GeneType>
class galib::ArithmeticCrossover< GeneType >

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.

Template Parameters
GeneTypeThe numeric type of the genes.

Definition at line 24 of file ArithmeticCrossover.h.

Member Function Documentation

◆ crossover()

template<typename GeneType >
std::pair< Individual< GeneType >, Individual< GeneType > > galib::ArithmeticCrossover< GeneType >::crossover ( const Individual< GeneType > &  parent1,
const Individual< GeneType > &  parent2 
)
inlineoverridevirtual

Produces children via linear interpolation of parent genes.

Parameters
parent1First parent.
parent2Second parent.
Returns
Pair of children.
Exceptions
std::invalid_argumentif 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().


The documentation for this class was generated from the following file: