Real encoded mutations#

namespace real#

Predefined mutation operators for the real encoded genetic algorithm.

class Uniform#

#include <mutation/real.hpp>
class Uniform : public gapp::mutation::Mutation<RealGene>#

Uniform mutation operator for the real encoded GA.

Each gene of a candidate solution is mutated with the specified probability, and the values of the mutated genes are randomly generated from a uniform distribution within the gene bounds.

Public Functions

inline explicit constexpr Mutation(Probability pm) noexcept#

Create a mutation operator.

Parameters:

pm – The mutation probability. Must be in the closed interval [0.0, 1.0].

class NonUniform#

#include <mutation/real.hpp>
class NonUniform : public gapp::mutation::Mutation<RealGene>#

Michalewicz’s non-uniform mutation operator for the real encoded GA.

Each gene of a candidate solution is mutated with the specified probability, and the values of the mutated genes are randomly selected from a non-uniform distribution that changes over time. In the early generations the distribution is close to being uniform, while in the later generations the mutated values tend to be closer to the original values.

The operator has one parameter (beta), which controls how quickly the shape of the probability distribution changes over the generations. For smaller values, the distribution is more uniform and changes less over time, while for larger values it will change faster and the mutated genes will tend to be closer to the original ones.

The value of this parameter must be >= 0.0. If the value is 0, the distribution is uniform and won’t change at all over the generations.

Public Functions

inline explicit constexpr NonUniform(
Probability pm,
NonNegative<GeneType> beta = 2.0,
) noexcept#

Create a non-uniform mutation operator with the specified parameters.

Parameters:
  • pm – The mutation probability used. Must be in the closed range [0.0, 1.0].

  • beta – The beta parameter of the mutation. Must be a finite non-negative value.

inline constexpr void beta(NonNegative<GeneType> beta) noexcept#

Set the beta parameter of the mutation.

The value of this parameter controls how quickly the shape of the probability distribution changes over the generations. For smaller values, the distribution is more uniform and changes less over time, while for larger values it will change faster and the mutated genes will tend to be closer to the original ones.

Parameters:

beta – The beta parameter of the mutation. Must be a finite non-negative value.

inline constexpr GeneType beta() const noexcept#
Returns:

The beta parameter of the operator.

class Gauss#

#include <mutation/real.hpp>
class Gauss : public gapp::mutation::Mutation<RealGene>#

Gauss mutation operator for the real encoded GA.

Each gene of a candidate solution is mutated with the specified probability, and the values of the mutated genes are randomly generated from a normal distribution around the current value of the gene.

The operator has one parameter (sigma), which controls the standard deviation of the normal distribution used (but isn’t the actual standard deviation). The standard deviation of the normal distribution used for the i-th gene is calculated as:

\[ SD_i = \frac{ bound_i^{upper} - bound_i^{lower} }{ sigma } \]

Larger sigma values will lead to the values of the mutated gene to be closer to their original values.

Public Functions

inline explicit constexpr Gauss(
Probability pm,
Positive<GeneType> sigma = 6.0,
) noexcept#

Create a Gauss mutation operator with the specified parameters.

Parameters:
  • pm – The mutation probability used. Must be in the closed range [0.0, 1.0].

  • sigma – The sigma parameter of the crossover. Must be a finite value greater than 0.0.

inline constexpr void sigma(Positive<GeneType> sigma) noexcept#

Set the sigma parameter of the mutation.

The value of this parameter controls the standard deviation of the normal distribution the mutated gene values are selected from. The standard deviations are calculated from the value of the parameter as:

\[ SD_i = \frac{ bound_i^{upper} - bound_i^{lower} }{ sigma } \]

Larger sigma values will lead to the values of the mutated genes to be closer to their original values.

Parameters:

sigma – The sigma parameter of the gauss crossover. Must be a finite value greater than 0.0.

inline constexpr GeneType sigma() const noexcept#
Returns:

The sigma parameter of the operator.

class Polynomial#

#include <mutation/real.hpp>
class Polynomial : public gapp::mutation::Mutation<RealGene>#

Polynomial mutation operator for the real encoded GA. Each gene of a candidate solution is mutated with the specified probability, and the values of the mutated genes are randomly generated from a non-uniform distribution.

This mutation operator has one parameter (eta), which controls shape of the probability distribution the mutated genes are picked from. Larger values will lead to the mutated genes being closer to their original values, while smaller ones will have the opposite effect.

The value of the parameter must be a finite, non-negative value. Typical values are in the range [20.0, 100.0].

Public Functions

inline explicit constexpr Polynomial(
Probability pm,
NonNegative<GeneType> eta = 40.0,
) noexcept#

Create a polynomial mutation operator with the specified parameters.

Parameters:
  • pm – The mutation probability used. Must be in the closed range [0.0, 1.0].

  • eta – The eta parameter of the mutation. Must be a finite non-negative value.

inline constexpr void eta(NonNegative<GeneType> eta) noexcept#

Set the eta parameter for the crossover.

The value of this parameter controls the shape of the probability distribution the mutated genes are picked from. Larger values will lead to the mutated genes being closer to their original values, while using smaller values for the parameter will have the opposite effect.

Typical values are in the range [20.0, 100.0].

Parameters:

eta – The eta parameter of the mutation. Must be a finite non-negative value.

inline constexpr GeneType eta() const noexcept#
Returns:

The eta parameter of the operator.

class Boundary#

#include <mutation/real.hpp>
class Boundary : public gapp::mutation::Mutation<RealGene>#

Boundary mutation operator for the real encoded GA.

Each gene of a candidate solution is mutated with the specified probability, and the values of the mutated genes are either the lower or upper bounds of the gene (with equal probability).

Public Functions

inline explicit constexpr Mutation(Probability pm) noexcept#

Create a mutation operator.

Parameters:

pm – The mutation probability. Must be in the closed interval [0.0, 1.0].