Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Email:

Cultured Perl: Genetic Algorithms Applied with Perl

By Teodor Zlatanov
2004-11-03


History

The progress of genetics in the 20th century was rivaled in speed and reach only by the evolution of electronics and computer science. It is fitting that one of the most intriguing algorithms to come about in the 20 th century is the genetic algorithm.

Emerging in the early 1960s, the genetic algorithm (and evolutionary algorithms in general) took a place in computer science between deterministic and non-deterministic algorithms. The genetic algorithm, essentially, is as deterministic as you want to make it, meaning that the user can decide the number of iterations and termination criteria. It mimics Darwinian natural selection, making "fitness" (as determined by a formula applied to an individual) the chief selector of individuals for survival and procreation, together with mutation.

Other evolutionary algorithms attempt to mimic Lamarckian evolution, where behavior as a survival mechanism can be transferred between generations, and there are even evolutionary programs that write themselves for a particular purpose. All of those are beyond the scope of this article.

The main drawback of Perl for genetic algorithms is speed. Because of the computing needs of genetic algorithms, they are more efficiently implemented in C or other low-level pre-compiled languages. The Perl examples shown here are not as fast as their equivalents in C, but they will show you how the genetic algorithm works, and they are fast enough for some problems.

Tutorial Pages:
» Create Your Own Darwinian Breeding Grounds
» History
» So What is the Genetic Algorithm?
» A Simple Example
» Breeding words
» Conclusion
» Resources


First published by IBM DeveloperWorks


 | Bookmark
Related Tutorials:
» Random subroutines in Perl
» Log Script Use
» Creating Perl Modules for Web Sites
» Bit Vector, Using Perl Vec
» Build a Perl/CGI Voting System
» Perl Range Operator