In his endless pursuit of that wascally Weasel, Mung made the following silly claim:
GAs are often used to demonstrate “the power of cumulative selection.” Given small population sizes drift ought to dominate yet in GAs drift does not dominate.
That is clearly false, but for the benefit of Mung (and his cousin Elmer) I have modified my Weasel program to incorporate both drift and selection. They can now see for themselves that small population sizes are insufficient to guarantee that drift dominates selection.
The code is here. Compile it under Linux using “gcc -std=gnu99 -lm weasel.c -o weasel”.
Run the program and type ‘h’ to see a list of interactive commands:
c – clear the histogram data
f – change the selection coefficient
h – print this help message
m – change the mutation rate
p – pause until a key is pressed
q – quit the program
s – toggle selection on/off
t – change the target phrase
The program generates and updates a scaled histogram showing the number of generations spent at each possible Hamming distance from the target.