A population of six 0.92 A 0.55 B 0.40 C 0.25 D 0.12 E 0.06 F
The height of each bar is the fitness of an individual. A is clearly the best, with fitness 0.92; F is the weakest. Selection is the rule for drawing parents from this population. Good individuals should be chosen more often, but if the weak ones are never chosen the population loses its diversity.
Roulette wheel 0.40 A 0.24 B 0.17 C 0.11 D 0.05 E 0.03 F A B C D E
On a roulette wheel the probability of choosing an individual is its fitness divided by the total fitness. The total is 2.30, and A's probability is 0.400. The strip on top is the wheel unrolled: each slice is as wide as its probability.
Spin the wheel 0.40 A 0.24 B 0.17 C 0.11 D 0.05 E 0.03 F A B C D E A random number between 0 and 1 was drawn: 0.156. The pointer marks this point and the slice under it is chosen: A. A's slice is the widest, so the pointer lands there most often.
Once more 0.40 A 0.24 B 0.17 C 0.11 D 0.05 E 0.03 F A B C D E The second draw is 0.625, and B is chosen. Every draw is independent; the same individual can be chosen twice in a row. The problem with the roulette wheel: if one individual is much better than the rest, it becomes most of the parents and the population quickly turns uniform.
Ranking 0.29 A 0.24 B 0.19 C 0.14 D 0.10 E 0.05 F A B C D E F
With ranking, the order of the fitness values matters, not their size. The best individual gets 6 points, the worst 1, and the probability is proportional to the points. A's probability is now 0.286; however good A is, its share stays the same.
Spin with ranking 0.29 A 0.24 B 0.19 C 0.14 D 0.10 E 0.05 F A B C D E F The same wheel turned, this time with the ranking probabilities. The number drawn is 0.301, and B is chosen. The slices are closer to each other, and the weak individuals have a better chance.
Tournament 0.92 A 0.55 B 0.40 C 0.25 D 0.12 E 0.06 F
A tournament has no wheel: 2 individuals are drawn at random and the fittest wins. The drawn ones are E, D, and the winner is D. Yellow bars are the competitors, the red bar is the winner. Only comparisons are made, so negative or very large fitness values are not a problem.
Selection pressure 0.40 roulette 0.29 ranking 0.31 tournament probability of choosing A
The probability that the best individual A is chosen in one draw is 0.400 with the roulette wheel, 0.286 with ranking and 0.306 with a tournament of 2. This probability is called selection pressure. High pressure makes the search fast but uniform too early; low pressure keeps it diverse but slow. In a tournament the pressure is set by k.