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

Performs uniform mutation. More...

#include <UniformMutation.h>

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

Public Member Functions

 UniformMutation (GeneType lower, GeneType upper)
 Constructs the mutation operator.
 
void mutate (Individual< GeneType > &individual, double mutation_rate) override
 Replaces genes with random values from [lower, upper].
 
- Public Member Functions inherited from galib::Mutation< GeneType >
virtual ~Mutation ()=default
 

Detailed Description

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

Performs uniform mutation.

Replaces a gene with a new value sampled uniformly from the range [lower, upper].

Template Parameters
GeneTypeThe numeric type of the genes.

Definition at line 21 of file UniformMutation.h.

Constructor & Destructor Documentation

◆ UniformMutation()

template<typename GeneType >
galib::UniformMutation< GeneType >::UniformMutation ( GeneType  lower,
GeneType  upper 
)
inline

Constructs the mutation operator.

Parameters
lowerLower bound for new random values.
upperUpper bound for new random values.

Definition at line 32 of file UniformMutation.h.

Member Function Documentation

◆ mutate()

template<typename GeneType >
void galib::UniformMutation< GeneType >::mutate ( Individual< GeneType > &  individual,
double  mutation_rate 
)
inlineoverridevirtual

Replaces genes with random values from [lower, upper].

Parameters
individualTarget individual.
mutation_rateProbability per gene.

Implements galib::Mutation< GeneType >.

Definition at line 40 of file UniformMutation.h.

References galib::Individual< GeneType >::getGenotype().


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