Your Mission: Find the Best

You’ll start with the simple rule—any row stays as it is. You stack up copies of this row until you’re above the paper bag:

images/Dream/stack_300.png

Will your genetic algorithm be clever enough to switch on all of the cells to begin with? This challenge is a variant of the OneMax problem.[68] You don’t need an evolutionary algorithm (EA) such as a GA to solve this. However, it does illustrate the characteristics of an EA, and the fitness function is easy to understand.

You can express your problem in formal terms. Find a bit pattern

images/_pragprog/svg-0076.png

that ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.