EncodeChromosome: Encode and Decode an Integer Chromosome
Description
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.
Usage
EncodeChromosome(x, n)
DecodeChromosome(y, n)
Arguments
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 0s and 1s.
Value
EncodeChromosome returns a 'numeric' vector of 0s and 1s.
DecodeChromosome returns a 'numeric' vector of integers.