Genetic Algorithm Simulator in Flex

Posted on June 7, 2007 by Tony Fendall.
Categories: Adobe, Components, Flex.

Over the last few days I’ve been working on a little flex application to simulate/demonstrate genetic algorithms.  This is what I came up with, and I think it works quite well.  Personally, I find these “non-intuative” algorithms really interesting, so it was cool to build one and see the visualizations.

Click on the image below to view the application. Right click on the application to view source.
Genetic Algorithm Simulator

The genetic algorithm in this implementation trys to solve the problem of finding a path across a 2D space.  Each chromosome represents a possible path and each path is evaluated to see how far across the space it gets.  Using a survival of the fittest mechanism, the paths which get furtherest are combined to generate more possible paths, and over many generations (cycles) better and better solutions are found.  All of the standard genetic algorithm variables (such as chromosome length and number) are adjustable, and I’ve also added the option to add an obstacle which adds a different selection pressure.

The application is pretty simple at the moment, but I’d welcome any comments or thoughts on the application, especially in terms of its potential as an educational resource.  As with all code released on this site, the source for this application is completly open and free.

TripleM
Comment on June 8th, 2007.

Heh, thats quite cool. I’ve always wanted to play around with a genetic algorithm, but I’ve never come across a problem where its actually worth using one yet. Still, this almost inspires me to actually try something sometime.

Bhuvana R
Comment on January 6th, 2008.

Hey, that was really cool..
Was learning abt GAs..
This gave me a better understanding..
But am not able to view the source..
Could u mail it to me..

Comment on January 6th, 2008.

Hi Bhuvana
The source can be found by right clicking on the application, when it is open, and selecting the first item in the context menu (’View Source”). Doing so will take you to this location:
http://www.munkiihouse.com/flexapps/Genetics/srcview/index.html

Hope that helps

Antonio
Comment on January 23rd, 2009.

Hi Tony

Since a while, I am interesting in Genetic Algorithms. I am a completely newbie in this field, could you be so kind to guide me learning how to program using GA o Genetic Programming? How do I must start? How can I start learning FLEX? Which book do you recommend me to start reading about GA?

Thank you in advance

Antonio

Comment on September 21st, 2009.

Hi,
First of all congratulations on the visual implementation of the algorithm i think is pretty neat. I recently stared exploring this field it would make very happy if you could take a look at my first implementation of one an tell me if i have made any big mistakes.

Antonio the book that i’m using to learn these concepts is called. An introduction to genetic algorithms from MIt press is pretty easy to follow.