Genetic Operators#
Some utilities to perform common genetic operations
#include <pagmo/utils/genetic_operators.hpp>
New in version 2.16.
-
std::pair<vector_double, vector_double> sbx_crossover(const vector_double &parent1, const vector_double &parent2, const std::pair<vector_double, vector_double> &bounds, vector_double::size_type nix, const double p_cr, const double eta_c, detail::random_engine_type &random_engine)#
- Parameters
parent1 – first parent.
parent2 – second parent.
bounds – problem bounds.
nix – integer dimension of the problem.
p_cr – crossover probability.
eta_c – crossover distribution index.
random_engine – the pagmo random engine
- Throws
std::invalid_argument – if the bounds size is zero.
std::invalid_argument – if parent1, parent2 and bounds have unequal length.
std::invalid_argument – if bounds contain any nan or infs.
std::invalid_argument – if any lower bound is greater than the corresponding upper bound.
std::invalid_argument – if nix is larger than bounds size.
std::invalid_argument – if any of the integer bounds are not integers.
std::invalid_argument – if p_cr or eta_c are not finite numbers.
This function perform a simulated binary crossover (SBX) among two parents. The SBX genetic operator was designed to preserve average property and the spread factor property of one-point crossover in binary encoded chromosomes. This version of the SBX will act as a simple two-points crossover over the integer part of the chromosome / decision vector.
See: https://www.slideshare.net/paskorn/simulated-binary-crossover-presentation
New in version 2.16.
-
void polynomial_mutation(vector_double &dv, const std::pair<vector_double, vector_double> &bounds, vector_double::size_type nix, const double p_m, const double eta_m, detail::random_engine_type &random_engine)#
- Parameters
dv – decision vector to be mutated in place.
bounds – problem bounds.
nix – integer dimension of the problem.
m_cr – mutation probability.
m_c – mutation distribution index.
random_engine – the pagmo random engine
- Throws
std::invalid_argument – if the bounds size is zero.
std::invalid_argument – if dv, and bounds have unequal length.
std::invalid_argument – if bounds contain any nan or infs.
std::invalid_argument – if any lower bound is greater than the corresponding upper bound.
std::invalid_argument – if nix is larger than bounds size.
std::invalid_argument – if any of the integer bounds are not integers.
std::invalid_argument – if m_cr or m_c are not finite numbers.
This function performs the polynomial mutation proposed by Agrawal and Deb over some chromosome / decision vector.