Quetzal-CoaTL
The Coalescence Template Library
Loading...
Searching...
No Matches
quetzal::coalescence::merger_policy::SimultaneousMultipleMerger< SpectrumSamplingPolicy > Struct Template Reference

#include <quetzal/coalescence/merger_policy.hpp>

Detailed Description

template<class SpectrumSamplingPolicy>
struct quetzal::coalescence::merger_policy::SimultaneousMultipleMerger< SpectrumSamplingPolicy >

Discrete generation simultaneous multiple merger.

Defines a policy class to coalesce multiple nodes selected uniformely at random in a range, according to an OccupancySpectrum. Its interface makes it exchangeable with the BinaryMerger policy.

Template Parameters
SpectrumSamplingPolicyThe policy used to generate an OccupancySpectrum: on_the_fly or in_memoized_distribution

Static Public Member Functions

template<class BidirectionalIterator , class T , class BinaryOperation , class Generator >
static auto merge (BidirectionalIterator first, BidirectionalIterator last, unsigned int N, T const &init, BinaryOperation const &op, Generator &g)
 merges multiple randomly selected elements in a range.
 
template<class BidirectionalIterator , class Generator >
static auto merge (BidirectionalIterator first, BidirectionalIterator last, unsigned int N, Generator &g)
 merges multiple randomly selected elements in a range.
 

Member Function Documentation

◆ merge() [1/2]

template<class SpectrumSamplingPolicy >
template<class BidirectionalIterator , class Generator >
static auto quetzal::coalescence::merger_policy::SimultaneousMultipleMerger< SpectrumSamplingPolicy >::merge ( BidirectionalIterator  first,
BidirectionalIterator  last,
unsigned int  N,
Generator &  g 
)
inlinestatic

merges multiple randomly selected elements in a range.

Coalesce multiple nodes selected uniformely at random in a range, according to an OccupancySpectrum.

Parameters
firstiterator at the begin of the range
lastiterator to the past-the-end element.
Nthe number of individuals in the population
Returns
An iterator to the element that follows the last element of the nodes remaining after coalescence.
Remarks
The function cannot alter the properties of the object containing the range of elements (i.e., it cannot alter the size of an array or a container): signaling the new size of the shortened range is done by returning an iterator to the element that should be considered its new past-the-end element. The range between first and this iterator includes all the remaining nodes in the sequence.
the type T BidirectionalIterator::value_type must be defined.
the T default constructor is used to set the value at which the parent is initialized.
With a and b two objects of type T, the expression a + b must be defined.
BidirectionalIterator must meet the requirements of ValueSwappable and RandomAccessIterator.

◆ merge() [2/2]

template<class SpectrumSamplingPolicy >
template<class BidirectionalIterator , class T , class BinaryOperation , class Generator >
static auto quetzal::coalescence::merger_policy::SimultaneousMultipleMerger< SpectrumSamplingPolicy >::merge ( BidirectionalIterator  first,
BidirectionalIterator  last,
unsigned int  N,
T const &  init,
BinaryOperation const &  op,
Generator &  g 
)
inlinestatic

merges multiple randomly selected elements in a range.

@detais Coalesce multiple nodes selected uniformely at random in a range, according to an OccupancySpectrum.

Parameters
firstiterator at the begin of the range
lastiterator to the past-the-end element.
Nthe number of individuals in the population
initthe value at which parent is initialized
opbinary operation function object that will be applied for branching a child to its parent. The binary operator takes as parameters the parent value (initialized to init) and the value of the child. The signature of the function should be equivalent to the following: Ret fun(const Type1 &parent, const Type2 &child);
Returns
An iterator to the element that follows the last element of the nodes remaining after coalescence.
Remarks
The function cannot alter the properties of the object containing the range of elements (i.e., it cannot alter the size of an array or a container): signaling the new size of the shortened range is done by returning an iterator to the element that should be considered its new past-the-end element. The range between first and this iterator includes all the remaining nodes in the sequence.
BidirectionalIterator must meet the requirements of ValueSwappable and RandomAccessIterator.

The documentation for this struct was generated from the following file: