Empirical
|
#include <NK.h>
Public Member Functions | |
NKLandscape () | |
NKLandscape (const NKLandscape &)=default | |
NKLandscape (NKLandscape &&)=default | |
NKLandscape (size_t _N, size_t _K, emp::Random &random) | |
~NKLandscape () | |
NKLandscape & | operator= (const NKLandscape &)=delete |
NKLandscape & | operator= (NKLandscape &&)=default |
void | Reset (emp::Random &random) |
Randomize the landscape without changing the landscape size. More... | |
void | Config (size_t _N, size_t _K, emp::Random &random) |
Configure for new values of N and K. More... | |
size_t | GetN () const |
Returns N. More... | |
size_t | GetK () const |
Returns K. More... | |
size_t | GetStateCount () const |
Get the number of posssible states for a given site. More... | |
size_t | GetTotalCount () const |
double | GetFitness (size_t n, size_t state) const |
double | GetFitness (std::vector< size_t > states) const |
Get the fitness of a whole bitstring. More... | |
double | GetFitness (BitVector genome) const |
Get the fitness of a whole bitstring (pass by value so can be modified.) More... | |
void | SetState (size_t n, size_t state, double in_fit) |
void | RandomizeStates (Random &random, size_t num_states=1) |
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. If you are using small values for N and K, you can get better performance by using an NKLandscapeConst instead.
|
inline |
|
default |
|
default |
|
inline |
N is the length of bitstrings in your population, K is the number of neighboring sites the affect the fitness contribution of each site (i.e. epistasis or ruggedness), random is the random number generator to use to generate this landscape.
|
inline |
|
inline |
Configure for new values of N and K.
|
inline |
Get the fitness contribution of position [n] when it (and its K neighbors) have the value [state]
|
inline |
Get the fitness of a whole bitstring.
|
inline |
Get the fitness of a whole bitstring (pass by value so can be modified.)
|
inline |
Returns K.
|
inline |
Returns N.
|
inline |
Get the number of posssible states for a given site.
|
inline |
Get the total number of states possible in the landscape (i.e. the number of different fitness contributions in the table)
|
delete |
|
default |
|
inline |
|
inline |
Randomize the landscape without changing the landscape size.
|
inline |