VectorGA: A Vectorized Implementation of a Genetic Algorithm in Matlab

January 25, 2007 at 11:36 am (Uncategorized) ()

VectorGA is a vectorized implementation of a genetic algorithm in the Matlab programming language.

Matlab is optimized for performing operations on arrays. Loops, especially nested loops, tend to run slowly in Matlab. It is possible to significantly improve the performance of Matlab programs by converting loops into array operations. This process is called vectorization. Matlab provides a rich set of functions and many expressive indexing schemes that make it possible to vectorize code. Such code not only runs faster, it is also shorter, and simpler to understand and change (provided that you know a little about Matlab of course).

Genetic Algorithms that are implemented in C/C++ or Java typically have multiple nested loops. Therefore direct ports of such implementations to Matlab will run very slowly. Many of the nested loops found in a typical GA implementation have been eliminated from VectorGA. The resulting code is short, fast and simple. It is a neat coincidence when the constructs of a programming language match a programming task so well that a program can be written this succintly.

VectorGA is proof that Matlab is a useful language for the rapid prototyping of Genetic Algorithms. This, in addition to Matlab’s extensive data visualization capabilities, make Matlab an extremely useful platform for the experimental analysis of GAs.

VectorGA has been created and tested under Matlab 7 (R14). Out of the box it evolves a population against the one-max fitness function. The royal-roads fitness function has also been included but is not currently being called. If you find vectorGA useful or find any bugs please let me know.

Enjoy!

Original vectorGA release site

The latst version of VectorGA is SpeedyGA

Permalink 6 Comments

GA Research and Reverse Engineering

January 24, 2007 at 6:40 am (genetic algorithms) ()

Genetic Algorithms are widely used in industry to adapt high quality solutions to difficult non-convex optimization problems. Yet the means by which GAs generate better solutions over time is poorly understood. Despite the existence of many publications which purportedly explain how GAs “work”, no theory of adaptation for GAs has achieved widespread acceptance within the theoretical EC community.

In a sense, we know exactly what GAs ‘do’ (the algorithm after all is open for inspection). This is the same sense in which it can be said that we know what the set of assembly language instructions of a large executable application (e.g. Firefox), will ‘do’. In order to understand why the application exhibits some particular behavior, it is typically necessary to have a description of the behavior of the application in terms of concepts that Read the rest of this entry »

Permalink Leave a Comment