Stung Eye
Stung Eye

« [Apr 28] Tit for Tat
Evolution Baby

A Stitch In Time [May 11] »

Generation5 contains a wealth of AI information.

I've long been fascinated by Genetic Programming.

From the above link: [Genetic Algorithms] are basically algorithms based on natural biological evolution. [...] A GA functions by generating a large set of possible solutions to a given problem. It then evaluates each of those solutions, and decides on a "fitness level" (you may recall the phrase: "survival of the fittest") for each solution set. These solutions then breed new solutions. The parent solutions that were more "fit" are more likely to reproduce, while those that were less "fit" are more unlikely to do so. In essence, solutions are evolved over time. This way you evolve your search space scope to a point where you can find the solution. Genetic algorithms can be incredibly efficient if programmed correctly.

When I discovered this article on a Genetic Algorithm that "evolves" a text string, I knew I would have to port the code to Processing. The results:

  • GA Words - Click to reset Text String Gene Pool. [permalink]

  • GA Images - Click to reset Image Gene Pool. [permalink]

  • GA Images (Large Image) - Click to reset Image Gene Pool. [permalink]

    The first applet uses a Genetic Algorithm to evolve a text string from a gene pool of 4096 randomly seeded text cells.

    The second applet uses the same GA to evolve a 625 pixel image from a gene pool of 1024 randomly seeded image cells.

    Because the GA doesn't guarantee a perfect solution, the resultant text string or image must only be considered the best guess (so far). This is why the first applet doesn't always evolve the correct string. Left to run over night, the second applet will still only produce an approximation of the desired image.

    The third applet uses the same framework, but the desired image contains 2500 pixels. Because of the increased pixel size (and a gene pool of 2048 images) this applet must be run on a powerful computer (1GHz+ processor with at least 256MB RAM) and could take 3 or 4 hours to evolve a reasonable output image.



  • Creative Commons License Valid CSS!