Did It Work?

If you start with the simplest possible rule, and only have one item in the population, not much changes. Your tournament only has one competitor. The mutation gives it a chance to improve, but it might not manage to turn on all of the cells. Here’s a typical run—it started with 12 live cells, and creeps up to 17 over time:

images/Dream/pop1_big.png

You need a larger population to allow your GA to try more rows. Experimentation suggested about 25 items works well. The algorithm can then manage to turn on all 32 bits within 20 epochs, like this:

images/Dream/pop25_big.png

Your choice ...

Get Genetic Algorithms and Machine Learning for Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.