gaEncode

Encodes an individual’s binary, nominal, integer and real phenotypes into its chromosome.

Synopsis

gaEncode(individual)

Required Arguments

Imsls_d_individual individual (Input/Output)
An existing individual whose phenotypes get encoded into its chromosome.

Description

Normally encoding is required after changing phenotype values. By default, if either gaPopulation or gaRandomPopulation are used to build an initial population, phenotype values are automatically encoded into the chromosome. Normally this makes it unnecessary to decode the chromosome within the fitness function. However, if individual phenotype values are changed gaEncode can be used to encode these values into the individual’s chromosome.

Binary and nominal phenotypes are copied directly from their phenotype values into the individual’s chromosome. Integer and real phenotypes are encoded as binary bits using either Gray or Base-2 encoding. This function encodes those bits into their integer or real representations using the Gray or Base-2 encoding specification in the individual’s chromosome.