Library tutorials & articles

An Introduction to Genetic Algorithms

How Does It Work?

The GA does not simply bounce around randomly, instead there must be some method behind the bouncing.

This can be described as a set of stages:

1. Have a few guesses – generate a number of random points somewhere in the grid
2. Find out how near they are to the answer
3. Alter them
4. Return to 2 – This loop is performed until an answer is found

It is stage three that is the brains behind the Genetic Algorithm, because, as the name “Genetic” suggests, the way in which the guesses are made has something to do with DNA or Evolution.  The guesses are altered using methods which are loosely based on the theories of Evolution first suggested by Charles Darwin.

Before we can demonstrate the ways in which the guesses are generated it is necessary to introduce some terminology: the guesses are referred to as “Chromosomes” and the ways in which these chromosomes can change are referred to as mutation and crossover.

Getting Started

The chromosomes (guesses!) are represented as binary.  In our combination example each chromosome has to store a guess for the first digit and a guess for the second digit – for instance a guess may be 9,2.  In binary this would be:
1001, 0010

These two separate strings of binary are stuck together to form 1 long string of eight digits – 10010010.

In order to form new guesses we can simply alter individual binary digits (genes!) of the guess (chromosome!), for example, by changing the first digit from a 1 to a 0:

10010010 becomes 00010010

In this way we are able to jump around inside the grid to potentially any position.  In order to determine how good the guesses are they must be split in half to produce the two parameters.

Comments

  1. 25 Oct 2008 at 16:18

    I think your math is slightly off... in your example you derice 23 and 75.5 from formulars that don't arrived at these... what am I missing ??? 5*4 = 20, 20/2 = 10, 10 + 1 = 11, 11 + 6 = 17

  2. 26 Apr 2007 at 20:30

    I think that's a basic knowledge of GAs.
    Can give to us about detail of GAs, and another important application of this algorithm especially in Robot?


  3. 01 Jan 1999 at 00:00

    This thread is for discussions of An Introduction to Genetic Algorithms.

Leave a comment

Sign in or Join us (it's free).

AddThis

Related discussion

Events coming up

  • Dec 6

    Developing AJAX Web Applications with Castle Monorail

    London, United Kingdom

    Monorail is the model-view-controller engine of the Castle Project, bringing many of the best ideas of Ruby on Rails to the .NET world. In this talk, David De Florinier and Gojko Adzic show how Monorail makes it easy to develop .NET based AJAX applications, and how to use the Castle Project to build Web 2.0 applications effectively. Come to this session if you are a .NET web developer. Everyone is welcome!