View source: R/FindOptimalSubset.R
EncodeChromosome | R Documentation |
Functions for encoding and decoding a chromosome represented by integer values. Where a chromosome is a set of numbers that defines a proposed solution to the problem that a genetic algorithm is trying to solve.
EncodeChromosome(x, n) DecodeChromosome(y, n)
x |
'integer' vector. Integer representation of chromosome. |
n |
'integer' count. Maximum permissible number in the integer chromosome, used to calculate the bit width of a binary string. |
y |
'integer' vector.
Binary representation of chromosome, a vector of |
EncodeChromosome
returns a 'numeric' vector of 0
s and 1
s.
DecodeChromosome
returns a 'numeric' vector of integers.
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
FindOptimalSubset
, binary2decimal
x <- c(41, 796, 382) y <- EncodeChromosome(x, 1000) print(y) x <- DecodeChromosome(y, 1000) print(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.