Contents
1 Description of a basic GA
1.1 Introduction
1.2 Iterative (imperative) pseudocode for a GA
1.3 Functional Haskell code outline for the binary GA
2 Tutorial: Binary GA
2.1 GA settings
2.2 Alphabet
2.3 Target strings
2.4 Bits, genes, chromosomes, and the population
2.5 Encoding functions
2.5.1 Encoding/decoding scheme
2.5.2 The encodeChar function
2.5.3 The encodeString function
2.5.4 The encodeStringList function
2.6 Decoding functions
2.6.1 The bitsToInt function
2.6.2 The decodeGene function
2.6.3 The decodeChromosome function
2.6.4 The decodePopulation function
2.7 Randomness functions
2.7.1 The randBits function
2.7.2 The randGene function
2.7.3 The randGenes function
2.7.4 The randChrom function
2.7.5 The randChroms function
2.7.6 The randPop function
2.7.7 The randIndex function
2.8 Cost functions
2.8.1 The elemCost function
2.8.2 The geneCost function
2.8.3 The stringCost and chromCost functions
2.8.4 The chromCostPair function
2.9 Population functions
2.9.1 The evalPop function
2.9.2 The sortPop function
2.9.3 The selection function
2.9.4 The getParents function
2.9.5 The toPopulation function
2.10 Mating functions
2.10.1 The crossover function
2.10.2 The matePairwise function
2.11 Mutation functions
2.11.1 The replaceAtIndex and flipBit functions
2.11.2 The mutateChrom function
2.11.3 The mutateChromInPop function
2.11.4 The mutatePop function
2.12 Evolution functions
2.12.1 The evolvePopOnce function
2.12.2 The evolvePop function
2.13 Final remarks
3 Exercises
3.1 Testing
3.2 Solve your own problem