Encodes an individual’s binary, nominal, integer and real phenotypes into its chromosome.
#include <imsls.h>
void imsls_f_ga_encode(Imsls_f_individual *individual)
The type double function is imsls_d_ga_encode.
Imsls_f_individual
*individual (Input/Output)
An existing individual whose
phenotypes get encoded into its chromosome.
Normally encoding is required after changing phenotype values. By default, if either imsls_f_ga_population or imsls_f_ga_random_population 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 imsls_f_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.