I’ve found the bit dynamics visualizer included in speedyGA very useful for understanding the dynamics of SGAs with bitstring genomes. In each generation the visualizer plots/updates the frequency of the bit 1 at each locus (the frequency of the bit 0 is straightforwardly deducible) .
Here’s a visualization of the bit dynamics of an SGA with 1pt crossover when applied to the the Royal Roads fitness function. Going by the building block hypothesis one expects to see the dots marching orderly to the top of the plot in groups of eight or more.
That’s not what happens. Instead, one gets to see hitchhiking in action—look for a swift downward movement of certain dots in tandem with the swift upward movement of other dots at close by loci.
The maximum and average fitness in each generation of this run are shown below
The matlab code used to generate these and other figures in this blog post can be found here.
Let’s visualize the bit dynamics of a population when an SGA with uniform-crossover is applied to the Royal Roads function.
The maximum and average fitness in each generation of this run are shown below
Finally, let’s visualize the bit dynamics of a mutation-only SGA on the Royal Roads function.
The maximum and average fitness in each generation of this run are shown below
As an exercise you might examine the bit dynamics of the SGA on the oneMax fitness function included in the distribution.
Comments welcome.
Enjoy!