pulsatrix
Loading...
Searching...
No Matches
mutation.hpp File Reference

Genetic-algorithm mutation operators: bit-flip (generic boolean genotypes) and Gaussian, polynomial (real-valued genotypes). More...

#include <algorithm>
#include <cmath>
#include <random>
#include <stdexcept>
#include <vector>
Include dependency graph for mutation.hpp:

Go to the source code of this file.

Namespaces

namespace  pulsatrix
 

Functions

std::vector< bool > pulsatrix::BitFlipMutationByMask (const std::vector< bool > &genotype, const std::vector< bool > &flip_mask)
 Flips each gene where flip_mask is true, leaves the rest unchanged.
 
template<typename RNG >
std::vector< bool > pulsatrix::BitFlipMutation (const std::vector< bool > &genotype, double mutation_probability, RNG &rng)
 RNG-driven wrapper: each gene flips independently with probability mutation_probability.
 
std::vector< double > pulsatrix::GaussianMutationByNoise (const std::vector< double > &genotype, const std::vector< double > &noise, const std::vector< bool > &apply_mask)
 Adds noise[i] to genotype[i] wherever apply_mask[i] is true, leaves the rest unchanged.
 
template<typename RNG >
std::vector< double > pulsatrix::GaussianMutation (const std::vector< double > &genotype, double sigma, double mutation_probability, RNG &rng)
 RNG-driven wrapper: each gene independently receives N(0, sigma^2) noise with probability mutation_probability.
 
double pulsatrix::PolynomialMutationByDraw (double x, double lower, double upper, double eta, double u)
 Polynomial-mutates a single bounded gene given an explicit draw.
 
template<typename RNG >
std::vector< double > pulsatrix::PolynomialMutation (const std::vector< double > &genotype, const std::vector< double > &lower_bounds, const std::vector< double > &upper_bounds, double eta, double mutation_probability, RNG &rng)
 RNG-driven wrapper: each gene independently mutates (via PolynomialMutationByDraw) with probability mutation_probability.
 

Detailed Description

Genetic-algorithm mutation operators: bit-flip (generic boolean genotypes) and Gaussian, polynomial (real-valued genotypes).

Note
Same pure-core/RNG-wrapper split as selection.hpp and crossover.hpp: every stochastic operator's pure core takes an explicit mask/noise/draw, making its correctness hand-derivable independent of any particular RNG's output stream.