Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

(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
[LanX]: ... understood everything after mentally write down what he said.
[choroba]: Trainspotting?
[choroba]: Ouch, trailing commas in JSON :-(
[LanX]: ... though there seems to exist a taxation for the letter 't' in Northern Bri''ain ;-)
[LanX]: never seen trainspotting in OV ... :(
[karlgoethebier]: LanX
[LanX]: They should teach Scottish in continental schools after Brexit !!!

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2018-02-19 10:44 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (261 votes). Check out past polls.