At the forefront of Artificial Intelligence
  Home Articles Reviews Interviews JDK Glossary Features Discussion Search
Home » Articles » Genetic Algorithms » Beginner

An Introduction to Genetic Algorithms

By Sam Hsiung and James Matthews

After scientists became disillusioned with classical and neo-classical attempts at modelling intelligence, they looked in other directions. Two prominent fields arose, connectionism (neural networking, parallel processing) and evolutionary computing. It is the latter that this essay deals with - genetic algorithms and genetic programming.

Symbolic AI vs Genetic Algorithms

Most symbolic AI systems are very static. Most of them can usually only solve one given specific problem, since their architecture was designed for whatever that specific problem was in the first place. Thus, if the given problem were somehow to be changed, these systems could have a hard time adapting to them, since the algorithm that would originally arrive to the solution may be either incorrect or less efficient. Genetic algorithms (or GA) were created to combat these problems. They are basically algorithms based on natural biological evolution. The architecture of systems that implement genetic algorithms (or GA) are more able to adapt to a wide range of problems. 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.

General Algorithm for Genetic Algorithms

Genetic algorithms are not too hard to program or understand, since they are biological based. Thinking in terms of real-life evolution may help you understand. Here is the general algorithm for a GA:

Create a Random Initial State
An initial population is created from a random selection of solutions (which are analagous to chromosomes). This is unlike the situation for Symbolic AI systems, where the initial state in a problem is already given instead.

Evaluate Fitness
A value for fitness is assigned to each solution (chromosome) depending on how close it actually is to solving the problem (thus arriving to the answer of the desired problem). (These "solutions" are not to be confused with "answers" to the problem, think of them as possible characteristics that the system would employ in order to reach the answer.)

Reproduce (& Children Mutate)
Those chromosomes with a higher fitness value are more likely to reproduce offspring (which can mutate after reproduction). The offspring is a product of the father and mother, whose composition consists of a combination of genes from them (this process is known as "crossing over".

Next Generation
If the new generation contains a solution that produces an output that is close enough or equal to the desired answer then the problem has been solved. If this is not the case, then the new generation will go through the same process as their parents did. This will continue until a solution is reached.

Applications of GAs

The possible applications of genetic algorithms are immense. Any problem that has a large search domain could be suitable tackled by GAs. A popular growing field is genetic programming (GP).

Genetic Programming

In programming languages such as LISP and Scheme, the mathematical notation is not written in standard notation, but in prefix notation. Some examples of this:
+ 2 1		:	2 + 1
* + 2 1 2	:	2 * (2+1)
* + - 2 1 4 9	:	9 * ((2 - 1) + 4)
Notice the difference between the left-hand side to the right? Apart from the order being different, no parenthesis! The prefix method makes life a lot easier for programmers and compilers alike, because order precedence is not an issue. You can build expression trees out of these strings that then can be easily evaluated, for example, here are the trees for the above three expressions.

     +              *              *
    / \            / \            / \
   1   2          +   2          +   9
                 / \            / \
                1   2          -   4
                              / \
                             2   1
You can see how expression evaluation is thus a lot easier. What this have to do with GAs? If for example you have numerical data and 'answers', but no expression to conjoin the data with the answers. A genetic algorithm can be used to 'evolve' an expression tree to create a very close fit to the data. By 'splicing' and 'grafting' the trees and evaluating the resulting expression with the data and testing it to the answers, the fitness function can return how close the expression is. The limitations of genetic programming lie in the huge search space the GAs have to search for - an infinite number of equations. Therefore, normally before running a GA to search for an equation, the user tells the program which operators and numerical ranges to search under. Uses of genetic programming can lie in stock market prediction, advanced mathematics and military applications (for more information on military applications, see the interview with Steve Smith).

Evolving Neural Networks

Glossary
Neural Network
GAs have successfully been used to evolve various aspects of GAs - either the connection weights, the architecture, or the learning function. You can see how GAs are perfect for evolving the weights of a neural network - there are immense number of possibilities that standard learning techniques such as back-propagation would take thousands upon thousands of iterations to converge to. GAs could (given the appropriate direction) evolve working weights within a hundred or so iterations.

Evolving the architecture of neural network is slightly more complicated, and there have been several ways of doing it. For small nets, a simple matrix represents which neuron connection which, and then this matrix is, in turn, converted into the necessary 'genes', and various combinations of these are evolved.

Many would think that a learning function could be evolved via genetic programming. Unfortunately, genetic programming combined with neural networks could be incredibly slow, thus impractical. As with many problems, you have to constrain what you are attempting to create. For example, in 1990, David Chalmers attempted to evolve a function as good as the delta rule. He did this by creating a general equation based upon the delta rule with 8 unknowns, which the genetic algorithm then evolved.

Other Areas

Genetic Algorithms can be applied to virtually any problem that has a large search space. Al Biles uses genetic algorithms to filter out 'good' and 'bad' riffs for jazz improvisation, the military uses GAs to evolve equations to differentiate between different radar returns, stock companies use GA-powered programs to predict the stock market.

Last Updated: 31/03/2000

Article content copyright © Sam Hsiung and James Matthews, 2000.
 Article Toolbar
Print
BibTeX entry

Search

Latest News
- The Latest (03/04/2012)
- Generation5 10-year Anniversary (03/09/2008)
- New Generation5 Design! (09/04/2007)
- Happy New Year 2007 (02/01/2007)
- Where has Generation5 Gone?! (04/11/2005)

What's New?
- Back-propagation using the Generation5 JDK (07/04/2008)
- Hough Transforms (02/01/2008)
- Kohonen-based Image Analysis using the Generation5 JDK (11/12/2007)
- Modelling Bacterium using the JDK (19/03/2007)
- Modelling Bacterium using the JDK (19/03/2007)


All content copyright © 1998-2007, Generation5 unless otherwise noted.
- Privacy Policy - Legal - Terms of Use -