Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

(Genetic) Perls of Evolution

by Chmrr (Vicar)
on May 31, 2001 at 05:12 UTC ( #84422=CUFP: print w/replies, xml ) Need Help??

Yes, this is yet another post about Genetic something-or-others and Perl. What seemed like ages ago, I showed up here while working on my research project, which involved tweaking distributed Genetic Programming -- and I had written all of the code in Perl. At the time, I was also tremendously impressed with myself because I had thought myself to be the only person insane enough to attempt such a thing. Of course, nearly the first node I saw showed me how wrong I was. I did, however, promise to post my code once it was in a vaguely readable state.

Well, it's now several months later, and, having graduated from high school, I now have copious free time. Therefore, I present you with what I called GPerl, or Genetic Programming in Perl.

It implements all of the basic steps which are detailed in Koza's first book (overview). As such, it has a few differences from some of the other genetic methods posted here (1,2,3). Firstly, and probably most imoprtantly, each individual is a nested set of valid perl expressions. "Evaluating" the fitness of an individual is simple: just use eval().

As is noted at the bottom of the POD, this implementation isn't really anywhere close to the speed of various other compiled solutions out there. However, speeding it up couldn't possibly be a bad thing. ;> As such, please do make whatever stylistic, functional, or optimizational suggestions that cross your mind!

For an overview, read the POD.

Update (May 2nd, 2002): So that I don't need to remember to update this every time I push out a new version, I've taken the code off of this page. Go here for the code.

perl -e 'print "I love $^X$\"$]!$/"#$&V"+@( NO CARRIER'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://84422]
Approved by root
and the shadows deepen...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2017-02-20 00:50 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (293 votes). Check out past polls.