Vita
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
vita::evolution_strategy< T, SS, CS, RS > Class Template Reference

Defines the skeleton of the evolution, deferring some steps to client subclasses. More...

#include <evolution_strategy.h>

Public Member Functions

void after_generation () const
 Work to be done at the end of a generation. More...
 
 evolution_strategy (population< T > &pop, evaluator< T > &eva, summary< T > *s)
 
void init () const
 Initial setup performed before evolution starts. More...
 
void log_strategy (unsigned, unsigned) const
 Evolution strategy specific log function (it's called by the evolution::log method). More...
 
bool stop_condition () const
 Used to signal strategy specific stop conditions. More...
 

Static Public Member Functions

static environment shape (const environment &env)
 Sets strategy-specific parameters. More...
 

Public Attributes

CS< T > recombination
 
RS< T > replacement
 
SS< T > selection
 

Static Public Attributes

static constexpr bool is_alps
 
static constexpr bool is_de
 

Protected Attributes

population< T > & pop_
 
summary< T > * sum_
 

Detailed Description

template<class T, template< class > class SS, template< class > class CS, template< class > class RS>
class vita::evolution_strategy< T, SS, CS, RS >

Defines the skeleton of the evolution, deferring some steps to client subclasses.

Template Parameters
Ttype of individual
SSclass containing the selection strategy
CSclass containing the recombination strategy
RSclass containing the replacement strategy

Selection, recombination and replacement are the main steps of evolution. In the literature a lot of different algorithms are described and many of them are implemented in Vita (not every combination is meaningful).

The user can choose, at compile time, how the evolution class should work via the evolution strategy class (or one of its specialization).

In other words the template method design pattern is used to "inject" selection, recombination and replacement methods specified by the evolution_strategy object into an evolution object.

Definition at line 46 of file evolution_strategy.h.

Constructor & Destructor Documentation

◆ evolution_strategy()

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
vita::evolution_strategy< T, SS, CS, RS >::evolution_strategy ( population< T > &  pop,
evaluator< T > &  eva,
summary< T > *  s 
)
inline

Definition at line 49 of file evolution_strategy.h.

Member Function Documentation

◆ after_generation()

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
void vita::evolution_strategy< T, SS, CS, RS >::after_generation ( ) const
inline

Work to be done at the end of a generation.

Definition at line 70 of file evolution_strategy.h.

◆ init()

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
void vita::evolution_strategy< T, SS, CS, RS >::init ( ) const
inline

Initial setup performed before evolution starts.

Definition at line 67 of file evolution_strategy.h.

◆ log_strategy()

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
void vita::evolution_strategy< T, SS, CS, RS >::log_strategy ( unsigned  ,
unsigned   
) const
inline

Evolution strategy specific log function (it's called by the evolution::log method).

Definition at line 58 of file evolution_strategy.h.

◆ shape()

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
static environment vita::evolution_strategy< T, SS, CS, RS >::shape ( const environment env)
inlinestatic

Sets strategy-specific parameters.

The default implementation doesn't change the user-specified environment. Some evolution strategies force parameters to specific values.

Definition at line 64 of file evolution_strategy.h.

◆ stop_condition()

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
bool vita::evolution_strategy< T, SS, CS, RS >::stop_condition ( ) const
inline

Used to signal strategy specific stop conditions.

Definition at line 73 of file evolution_strategy.h.

Member Data Documentation

◆ is_alps

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
constexpr bool vita::evolution_strategy< T, SS, CS, RS >::is_alps
staticconstexpr
Initial value:
=
std::is_same<SS<T>, typename vita::selection::alps<T>>::value &&
std::is_same<RS<T>, typename vita::replacement::alps<T>>::value
ALPS based replacement scheme.
Alps selection as described in https://github.com/ghornby/alps (see also vita::basic_alps_es for furt...

Definition at line 75 of file evolution_strategy.h.

◆ is_de

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
constexpr bool vita::evolution_strategy< T, SS, CS, RS >::is_de
staticconstexpr
Initial value:
=
std::is_same<CS<T>, typename vita::recombination::de<T>>::value
This is based on the differential evolution four members crossover.

Definition at line 79 of file evolution_strategy.h.

◆ pop_

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
population<T>& vita::evolution_strategy< T, SS, CS, RS >::pop_
protected

Definition at line 88 of file evolution_strategy.h.

◆ recombination

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
CS<T> vita::evolution_strategy< T, SS, CS, RS >::recombination

Definition at line 84 of file evolution_strategy.h.

◆ replacement

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
RS<T> vita::evolution_strategy< T, SS, CS, RS >::replacement

Definition at line 85 of file evolution_strategy.h.

◆ selection

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
SS<T> vita::evolution_strategy< T, SS, CS, RS >::selection

Definition at line 83 of file evolution_strategy.h.

◆ sum_

template<class T , template< class > class SS, template< class > class CS, template< class > class RS>
summary<T>* vita::evolution_strategy< T, SS, CS, RS >::sum_
protected

Definition at line 89 of file evolution_strategy.h.


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