|
pulsatrix
|
Genetic-algorithm crossover operators: one-point, two-point, uniform (generic sequence genotypes), and blend/BLX-alpha, simulated binary (SBX) (real-valued genotypes). More...
#include <algorithm>#include <cmath>#include <random>#include <stdexcept>#include <utility>#include <vector>
Go to the source code of this file.
Namespaces | |
| namespace | pulsatrix |
Functions | |
| template<typename T > | |
| std::pair< std::vector< T >, std::vector< T > > | pulsatrix::OnePointCrossoverAtPoint (const std::vector< T > &parent1, const std::vector< T > &parent2, size_t point) |
| Splits both parents at point and swaps tails. | |
| template<typename T , typename RNG > | |
| std::pair< std::vector< T >, std::vector< T > > | pulsatrix::OnePointCrossover (const std::vector< T > &parent1, const std::vector< T > &parent2, RNG &rng) |
| RNG-driven wrapper: draws an interior point in [1, size-1] uniformly. | |
| template<typename T > | |
| std::pair< std::vector< T >, std::vector< T > > | pulsatrix::TwoPointCrossoverAtPoints (const std::vector< T > &parent1, const std::vector< T > &parent2, size_t point1, size_t point2) |
| Swaps the [point1, point2) segment between both parents. | |
| template<typename T , typename RNG > | |
| std::pair< std::vector< T >, std::vector< T > > | pulsatrix::TwoPointCrossover (const std::vector< T > &parent1, const std::vector< T > &parent2, RNG &rng) |
| RNG-driven wrapper: draws two points in [0, size], sorted ascending. | |
| template<typename T > | |
| std::pair< std::vector< T >, std::vector< T > > | pulsatrix::UniformCrossoverByMask (const std::vector< T > &parent1, const std::vector< T > &parent2, const std::vector< bool > &swap_mask) |
| Swaps each gene independently wherever swap_mask is true. | |
| template<typename T , typename RNG > | |
| std::pair< std::vector< T >, std::vector< T > > | pulsatrix::UniformCrossover (const std::vector< T > &parent1, const std::vector< T > &parent2, double swap_probability, RNG &rng) |
| RNG-driven wrapper: each gene swaps independently with probability swap_probability. | |
| std::pair< std::vector< double >, std::vector< double > > | pulsatrix::BlendCrossoverByGamma (const std::vector< double > &parent1, const std::vector< double > &parent2, const std::vector< double > &gamma) |
| Blends each gene pair via an explicit per-gene gamma: child1_i = (1-gamma_i)*x1_i + gamma_i*x2_i, child2_i = gamma_i*x1_i + (1-gamma_i)*x2_i. | |
| template<typename RNG > | |
| std::pair< std::vector< double >, std::vector< double > > | pulsatrix::BlendCrossover (const std::vector< double > &parent1, const std::vector< double > &parent2, double alpha, RNG &rng) |
| RNG-driven wrapper (DEAP's cxBlend): draws gamma_i = (1+2*alpha)*u_i - alpha per gene, u_i ~ Uniform(0, 1). | |
| std::pair< std::vector< double >, std::vector< double > > | pulsatrix::SimulatedBinaryCrossoverByDraw (const std::vector< double > &parent1, const std::vector< double > &parent2, double eta, const std::vector< double > &draws) |
| Simulated binary crossover (Deb & Agrawal 1995; DEAP's cxSimulatedBinary), given an explicit per-gene draw in [0, 1). | |
| template<typename RNG > | |
| std::pair< std::vector< double >, std::vector< double > > | pulsatrix::SimulatedBinaryCrossover (const std::vector< double > &parent1, const std::vector< double > &parent2, double eta, RNG &rng) |
| RNG-driven wrapper: draws u_i ~ Uniform(0, 1) per gene (std::uniform_real_distribution is documented to produce values in [0, 1), matching the pure core's requirement). | |
Genetic-algorithm crossover operators: one-point, two-point, uniform (generic sequence genotypes), and blend/BLX-alpha, simulated binary (SBX) (real-valued genotypes).