9.3 Gene Coding Class

The central class used for gene coding is TGenCode. Problem specifications are encoded into gene (see User's Guide). Each specification is either integer or a real number, is encoded binary or using Gray encoding, has its accuracy, has its bounds (min_value and max_value) and is either a scalar value or a vector. Specification encoded into gene is also called gene part.

9.3.1 Accessing Gene Part

In fitness expression the user can use gene parts for fitness evaluation. Gene part is transformed into an element in the expression stack (see fitness function) as type variable. When the expression stack is produced this variable must be translated to a corresponding number. This means indexing into array of gene parts (if this gene part is a vector then another indexing inside the vector has to be performed.

9.3.2 Coding and Decoding

Storing ratio p is counted for each gene part (p=(max_value-min_value)/2^accuracy). It says how to scale specification value so it is possible to store this value into space available in the specific gene part. We recommend to use p <= 1 for integers and for real numbers the smaller the value of p the better.

Coding (specification->gene part):
1) gene_parti,j = round [(specificationi,j-min_valuei)/pi]
2) store gene_parti,j into gene (binary or Gray encoding)

Decoding (gene part->specification):
1) get gene_parti,j from gene (binary or Gray decoding)
2) specificationi,j=(gene_parti,j*pi) +min_valuei

i is the index of specification/gene part
j is the index of element in specification/gene part

Programmer's Guide Project Antares