Skip to main content

GA: Terminology & Structure

Source: Unit 5 §2

The vocabulary

TermMeaning
PopulationA subset of all possible (encoded) solutions.
ChromosomeOne solution to the problem.
GeneOne element or position of a chromosome.
AlleleThe value a gene takes in a particular chromosome.
GenotypeThe chromosome as represented in computation space, i.e. encoded.
PhenotypeThe solution in the real-world solution space.
Encoding / decodingEncoding is phenotype → genotype; decoding is genotype → phenotype.
Fitness functionTakes a solution, returns its suitability.
Genetic operatorsAlter the genetics of offspring: crossover, mutation, selection.
Chromosome10110genegenea positiona positionallele = the value in a gene, here 0 or 1
One chromosome is one candidate solution. A gene is a position in it; an allele is the value sitting in that position.
GotchaGenotype and phenotype are not interchangeable

The GA operates entirely on genotypes: crossover and mutation cut and flip bits without knowing what they mean. The fitness function is the only place the genotype is decoded back into a phenotype and judged as a real solution. Mixing the two up is what makes an encoding scheme fail.

The generalised pseudo-code

GA():
initialize population
find fitness of population
while (termination criterion not reached):
parent selection
crossover with probability p_c
mutation with probability p_m
decode and calculate fitness
survivor selection
find best
return best

The structure as a loop

Population initialisationFitness evaluationCrossoverwith probability p_cMutationwith probability p_mSurvivor selectionwho lives to next genloop untilterminationTerminate, return best
The GA loop. Everything between fitness evaluation and survivor selection repeats once per generation.

In words: a pool of candidate solutions undergoes recombination and mutation to produce offspring, repeated over generations, with fitter individuals given a higher chance to mate. The population evolves until a stopping criterion is met.