A GA is a metaheuristic optimiser from natural selection (Holland). It uses only the objective function, no derivatives, and explores many points at once so it escapes local optima.
Terms: population, chromosome (a solution), gene (a position), allele (a value), genotype (encoded), phenotype (real). Fitness measures suitability.
Binary decode:X=Xl+2n−1Xu−Xl×decoded. With n=4, Xl=4, Xu=25, 1010 decodes to 10 and gives 18.
String length:Sl=log2(pXu−Xl).
Prüfer code length is n−2.
Roulette example:1089<1279<1311 selects the 7th chromosome.
The full worked example minimises f(x)=xsin(10πx)+1 over [−1,2] by directional crossover, C1=P1+R(P2−P1). Crossover rate 0.5 over 10 gives 5 crossovers; mutation rate 0.1 gives 1 mutation.
≡FactsRepresentations and operators
Representations: binary, real, integer, permutation (TSP), random key, tree / Prüfer.
Hypothesis encoding: one bit per value, 1 means allowed, 111 means don't care. (Outlook = Overcast ∨ Rain) ∧ (Wind = Strong) is 101 10.
Selection: roulette wheel (proportional to fitness), tournament, rank, elitism (keep the best).
Crossover: single, double, multi-point, uniform (p = 0.5), masking, matrix, order and position for permutations.
Mutation: uniform, boundary, one's complement, inversion, insertion, heuristic. It escapes local optima and prevents premature convergence.