makeNKFunction: Generator for NK-landscapes

View source: R/makeNKFunction.R

makeNKFunctionR Documentation

Generator for NK-landscapes

Description

Generate a single-objective NK-landscape. NK-landscapes are combinatorial problems with input space \{0,1\}^N (in their basic definition). The value of each bit position i \in \{1, \ldots, N\} depends on K other bits, the so-called (epistatic) links / interactions.

Usage

makeNKFunction(N, K)

Arguments

N

[integer(1)]
Length of the bit-string (decision space dimension).

K

[integer]
Integer vector of the number of epistatic interactions. If a single value is passed a homogeneous NK-landscape is generated, i.e. k_i = k \forall i = 1, \ldots, N.

Value

[smoof_single_objective_function] NK-landscape function.

References

Kauffman SA, Weinberger ED. The NK model of rugged fitness landscapes and its application to maturation of the immune response. Journal of Theoretical Biology 1989 Nov 21;141(2):211-45. doi: 10.1016/s0022-5193(89)80019-0.

See Also

Other nk_landscapes: exportNKFunction(), makeMNKFunction()

Examples

# generate homogeneous NK-landscape with each K=3 epistatic links
N = 20
fn = makeNKFunction(N, 3)

# evaluate function on some random bitstrings
bitstrings = matrix(sample(c(0, 1), size = 10 * N, replace = TRUE), ncol = N)
apply(bitstrings, 1, fn)

# generate heterogeneous NK-landscape where K is sampled from {2,3,4}
# uniformly at random
fn = makeNKFunction(N, K = sample(2:4, size = N, replace = TRUE))


jakobbossek/smoof documentation built on Feb. 17, 2024, 2:23 a.m.