Ultra 0.9.4
Loading...
Searching...
No Matches
alps.h File Reference
#include "kernel/population.h"
#include <array>
#include <cstddef>
#include <functional>
#include <span>

Go to the source code of this file.

Classes

class  ultra::alps_layer_pair< Layer >
struct  ultra::alps::parameters

Namespaces

namespace  ultra

Functions

template<class Layer>
 ultra::alps_layer_pair (Layer &) -> alps_layer_pair< Layer >
template<class Layer>
 ultra::alps_layer_pair (Layer &, Layer &) -> alps_layer_pair< Layer >
template<class Layer>
 ultra::alps_layer_pair (const Layer &) -> alps_layer_pair< const Layer >
template<class Layer>
 ultra::alps_layer_pair (const Layer &, const Layer &) -> alps_layer_pair< const Layer >
template<LayeredPopulation P>
void ultra::alps::set_age (P &pop)
template<LayeredPopulation P>
alps_layer_pair< typename P::layer_t > ultra::alps::replacement_layers (P &pop, typename P::layer_iter l)
template<LayeredPopulation P>
alps_layer_pair< const typename P::layer_t > ultra::alps::selection_layers (const P &pop, typename P::layer_const_iter l)

Detailed Description

Remarks
This file is part of ULTRA.
License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/

Function Documentation

◆ replacement_layers()

template<LayeredPopulation P>
alps_layer_pair< typename P::layer_t > ultra::alps::replacement_layers ( P & pop,
typename P::layer_iter l )

Determines the set of layers whose individuals may be replaced by offspring generated from the specified layer.

Parameters
[in]poplayered population
[in]literator to the layer producing the offspring
Returns
an alps_layer_pair containing the layers eligible for replacement
Precondition
pop contains at least one layer
l is a valid iterator into pop.range_of_layers()

In the ALPS paradigm, replacement is restricted in order to preserve age stratification. Individuals are typically replaced either within the same layer or, in some cases, in the oldest layer.

The replacement policy implemented here is:

  • if l refers to the last (oldest) layer, only that layer is eligible;
  • otherwise, both the current layer and the last layer are eligible.
Note
The returned object stores references to layers owned by pop; it doesn't extend their lifetime.

◆ selection_layers()

template<LayeredPopulation P>
alps_layer_pair< const typename P::layer_t > ultra::alps::selection_layers ( const P & pop,
typename P::layer_const_iter l )

Determines the set of layers from which parents may be selected when generating offspring for the specified layer.

Parameters
[in]poplayered population
[in]literator to the layer for which parents are being selected
Returns
an alps_layer_pair containing the layers eligible for parent selection
Precondition
pop contains at least one layer
l is a valid iterator into pop.range_of_layers()

In ALPS, parent selection is typically restricted to the same age layer or younger ones, preventing older individuals from influencing younger layers.

The selection policy implemented here is:

  • if l refers to the first (youngest) layer, only that layer is used;
  • otherwise, both the current layer and the immediately younger layer are used.
Note
The returned object stores references to layers owned by pop; it doesn't extend their lifetime.