GA_ENCODE Function
Encodes an individual’s binary, nominal, integer and real phenotypes into its chromosome.
Usage
result = GA_ENCODE(individual)
Input Parameters
individual—An existing individual whose phenotypes get encoded into its chromosome.
Returned Value
result—The GA_ENCODE function returns the encoded data structure.
Input Keywords
Double—If present and nonzero, then double precision is used.
Discussion
Normally encoding is required after changing phenotype values. By default, if either the GA_POPULATION Function or the GA_RANDOM_POPULATION Function 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 GA_ENCODE 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.