Ultra 0.9.4
Loading...
Searching...
No Matches
ultra::replacement::alps< E > Class Template Reference

#include <evolution_replacement.h>

Inheritance diagram for ultra::replacement::alps< E >:
ultra::replacement::strategy< E >

Public Member Functions

template<PopulationWithMutex P>
void operator() (alps_layer_pair< P >, const scored_t &, status_t &) const
template<PopulationWithMutex P>
void try_promote_individuals (const P &, P &) const
template<PopulationWithMutex P>
std::array< typename alps< E >::scored_t, 2 > operator() (alps_layer_pair< const P > pops) const
Public Member Functions inherited from ultra::replacement::strategy< E >
 strategy (E &, const parameters &)

Additional Inherited Members

Public Types inherited from ultra::replacement::strategy< E >
using individual_t = evaluator_individual_t<E>
using fitness_t = evaluator_fitness_t<E>
using scored_t = scored_individual<individual_t, fitness_t>
using status_t = evolution_status<individual_t, fitness_t>
Protected Attributes inherited from ultra::replacement::strategy< E >
E & eva_
const parameters & params_

Detailed Description

template<Evaluator E>
class ultra::replacement::alps< E >

ALPS based replacement scheme.

This strategy select an individual for replacement by an ad hoc kill tournament. When an individual is too old for its current layer, it cannot be used to generate new individuals for that layer and eventually is removed from the layer. Optionally, an attempt can be made to move this individual up to the next layer – in which case it replaces some individual there that it's better than.

Member Function Documentation

◆ operator()() [1/2]

template<Evaluator E>
template<PopulationWithMutex P>
std::array< typename alps< E >::scored_t, 2 > ultra::replacement::alps< E >::operator() ( alps_layer_pair< const P > pops) const

Selects two parents using ALPS tournament selection.

Parameters
[in]popspair of eligible layers. pops.primary() is the current/main layer; pops.secondary() (if present) is the immediately younger layer
Returns
two selected scored individuals (best first)
Precondition
Parameters must have been initialised (no auto-tune values)

Used parameters:

  • evolution.tournament_size to control number of selected individuals.
  • alps.p_main_layer (probability of sampling each additional tournament candidate from the primary layer when a secondary layer is present).

The first two candidates are always sampled from the primary layer. The remaining evolution.tournament_size - 1 candidates use alps.p_main_layer.

Note
This function can be used in a multithreaded environment. Individuals are sampled through random::individual, which acquires a shared lock on the population mutex and returns a copy of the selected individual. The selection logic therefore operates on local copies and does not access mutable population state after sampling.

Correctness assumes that:

  • population mutations acquire the same mutex with exclusive access;
  • any additional population queries used here (e.g. max_age()) are either immutable or internally synchronised.

◆ operator()() [2/2]

template<Evaluator E>
template<PopulationWithMutex P>
void ultra::replacement::alps< E >::operator() ( alps_layer_pair< P > pops,
const scored_t & offspring,
status_t & status ) const
Parameters
[in]popsa collection of references to populations. Can contain one or two elements. The first one (pop[0]) is the main/current layer; the second one, if available, is the next layer
[in]offspringthe "incoming" scored individual
[out]statuscurrent evolution status

Used parameters:

  • evolution.elitism;
  • evolution.tournament_size.

◆ try_promote_individuals()

template<Evaluator E>
template<PopulationWithMutex P>
void ultra::replacement::alps< E >::try_promote_individuals ( const P & from,
P & to ) const
Parameters
[in]fromstarting layer
[out]todestination layer

Try to promote individuals from layer from to to (with ALPS this is always the upper layer).


The documentation for this class was generated from the following files: