shark::UniformCrossover Class Reference

Uniform crossover of arbitrary individuals. More...

#include <shark/Algorithms/DirectSearch/Operators/Recombination/UniformCrossover.h>

Public Member Functions

 UniformCrossover (double mixingRatio=0.5)
 Default c'tor, initializes the per element probability. More...
 
template<class randomType , typename Point >
Point operator() (randomType &rng, const Point &mom, const Point &dad) const
 Executes the uniform crossover. More...
 
double mixingRatio () const
 Returns the mixing ratio \( \in [0,1]\). More...
 
void setMixingRatio (double newRatio)
 Sets the mixing ratio to \( \in [0,1]\). More...
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int version)
 Serializes instances of the uniform crossover operator. More...
 

Detailed Description

Uniform crossover of arbitrary individuals.

Mixes individual genes of parent individuals according to a fixed mixing ratio. See http://en.wikipedia.org/wiki/Crossover_(genetic_algorithm) for further details.

Definition at line 44 of file UniformCrossover.h.

Constructor & Destructor Documentation

◆ UniformCrossover()

shark::UniformCrossover::UniformCrossover ( double  mixingRatio = 0.5)
inline

Default c'tor, initializes the per element probability.

Parameters
[in]mixingRatioMixing ratio between parent individuals.

Definition at line 50 of file UniformCrossover.h.

References mixingRatio(), and setMixingRatio().

Member Function Documentation

◆ mixingRatio()

double shark::UniformCrossover::mixingRatio ( ) const
inline

Returns the mixing ratio \( \in [0,1]\).

Definition at line 71 of file UniformCrossover.h.

Referenced by UniformCrossover().

◆ operator()()

template<class randomType , typename Point >
Point shark::UniformCrossover::operator() ( randomType &  rng,
const Point &  mom,
const Point &  dad 
) const
inline

Executes the uniform crossover.

Returns
The offspring individual.

Definition at line 58 of file UniformCrossover.h.

◆ serialize()

template<typename Archive >
void shark::UniformCrossover::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

Serializes instances of the uniform crossover operator.

Definition at line 85 of file UniformCrossover.h.

◆ setMixingRatio()

void shark::UniformCrossover::setMixingRatio ( double  newRatio)
inline

Sets the mixing ratio to \( \in [0,1]\).

Definition at line 77 of file UniformCrossover.h.

References SHARK_RUNTIME_CHECK.

Referenced by UniformCrossover().


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