![]() |
Quetzal-CoaTL
The Coalescence Template Library
|
#include <quetzal/coalescence/merger_policy.hpp>
Discrete generation binary merger.
Defines a policy class to coalesce two nodes selected uniformely at random in a range, with a probability \(1/N\). Its interface makes it exchangeable with the SimultaneousMultipleMerger policy.
Static Public Member Functions | |
template<class BidirectionalIterator , class T , class BinaryOperation , class Generator > | |
static auto | merge (BidirectionalIterator first, BidirectionalIterator last, unsigned int N, T init, BinaryOperation const &op, Generator &g) |
merges 2 randomly selected elements in a range. | |
template<class BidirectionalIterator , class Generator > | |
static auto | merge (BidirectionalIterator first, BidirectionalIterator last, unsigned int N, Generator &g) |
merges 2 randomly selected elements in a range. | |
|
inlinestatic |
merges 2 randomly selected elements in a range.
With a probability \(1/N\), merges 2 elements selected uniformely at random in a range.
first | iterator at the begin of the range |
last | iterator to the past-the-end element. |
N | the number of individuals in the population |
g | a random generator that must meet the requirements of UniformRandomBitGenerator concept. |
T
BidirectionalIterator::value_type
must be defined.T
default constructor is used to set the value at which the parent is initialized.a
and b
two objects of type T
, the expression a + B
must be defined.
|
inlinestatic |
merges 2 randomly selected elements in a range.
With a probability \(1/N\), merges 2 elements selected uniformely at random in a range.
first | iterator at the begin of the range |
last | iterator to the past-the-end element. |
N | the number of individuals in the population |
init | the value at which parent is initialized |
op | binary operation function object that will be applied for branching a child to its parent. The binary operator takes the parent value (initialized to init) and the value of the child as parameters. The signature of the function should be equivalent to the following: Ret fun(const Type1 &parent, const Type2 &child); |
g | a random generator that must meet the requirements of UniformRandomBitGenerator concept. |