Empirical
Public Member Functions | List of all members
emp::evo::NKLandscapeConst< N, K > Class Template Reference

#include <NK-const.h>

Public Member Functions

 NKLandscapeConst ()=delete
 
 NKLandscapeConst (emp::Random &random)
 Build a new NKLandscapeConst using the random number generator [random]. More...
 
 NKLandscapeConst (const NKLandscapeConst &)=delete
 
 ~NKLandscapeConst ()
 
NKLandscapeConstoperator= (const NKLandscapeConst &)=delete
 
constexpr size_t GetN () const
 Returns N. More...
 
constexpr size_t GetK () const
 Returns K. More...
 
constexpr size_t GetStateCount () const
 Get the number of posssible states for a given site. More...
 
constexpr size_t GetTotalCount () const
 
double GetFitness (size_t n, size_t state) const
 
double GetFitness (std::array< size_t, N > states) const
 Get the fitness of a whole bitstring. More...
 
double GetFitness (const BitSet< N > &genome) const
 Get the fitness of a whole bitstring. More...
 

Detailed Description

template<size_t N, size_t K>
class emp::evo::NKLandscapeConst< N, K >

An NK Landscape is a popular tool for studying theoretical questions about evolutionary dynamics. It is a randomly generated fitness landscape on which bitstrings can evolve. NK Landscapes have two parameters: N (the length of the bitstrings) and K (epistasis). Since you have control over the amount of epistasis, NK Landscapes are often called "tunably rugged" - a useful feature, since the ruggedness of the fitness landscape is thought to be important to many evolutionary dynamics. For each possible value that a site and its K neighbors to the right can have, a random fitness contribution is chosen. These contributions are summed across the bitstring. So when K = 0, each site has a single optimal value, resulting in a single smooth fitness peak.

For more information, see Kauffman and Levin, 1987 (Towards a general theory of adaptive walks on rugged landscapes).

This object handles generating and maintaining an NK fitness landscape. Note: Overly large Ns and Ks currently trigger a seg-fault, caused by trying to build a table that is larger than will fit in memory. You can use larger values of N and K (for slightly reduced speed) of you use an NKLandscape object instead.

Constructor & Destructor Documentation

template<size_t N, size_t K>
emp::evo::NKLandscapeConst< N, K >::NKLandscapeConst ( )
delete
template<size_t N, size_t K>
emp::evo::NKLandscapeConst< N, K >::NKLandscapeConst ( emp::Random random)
inline

Build a new NKLandscapeConst using the random number generator [random].

template<size_t N, size_t K>
emp::evo::NKLandscapeConst< N, K >::NKLandscapeConst ( const NKLandscapeConst< N, K > &  )
delete
template<size_t N, size_t K>
emp::evo::NKLandscapeConst< N, K >::~NKLandscapeConst ( )
inline

Member Function Documentation

template<size_t N, size_t K>
double emp::evo::NKLandscapeConst< N, K >::GetFitness ( size_t  n,
size_t  state 
) const
inline

Get the fitness contribution of position [n] when it (and its K neighbors) have the value [state]

template<size_t N, size_t K>
double emp::evo::NKLandscapeConst< N, K >::GetFitness ( std::array< size_t, N >  states) const
inline

Get the fitness of a whole bitstring.

template<size_t N, size_t K>
double emp::evo::NKLandscapeConst< N, K >::GetFitness ( const BitSet< N > &  genome) const
inline

Get the fitness of a whole bitstring.

template<size_t N, size_t K>
constexpr size_t emp::evo::NKLandscapeConst< N, K >::GetK ( ) const
inline

Returns K.

template<size_t N, size_t K>
constexpr size_t emp::evo::NKLandscapeConst< N, K >::GetN ( ) const
inline

Returns N.

template<size_t N, size_t K>
constexpr size_t emp::evo::NKLandscapeConst< N, K >::GetStateCount ( ) const
inline

Get the number of posssible states for a given site.

template<size_t N, size_t K>
constexpr size_t emp::evo::NKLandscapeConst< N, K >::GetTotalCount ( ) const
inline

Get the total number of states possible in the landscape (i.e. the number of different fitness contributions in the table)

template<size_t N, size_t K>
NKLandscapeConst& emp::evo::NKLandscapeConst< N, K >::operator= ( const NKLandscapeConst< N, K > &  )
delete

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