|Perl Monk, Perl Meditation|
Genetic algorithmsby dash2 (Hermit)
|on May 23, 2002 at 09:30 UTC||Need Help??|
dash2 has asked for the
wisdom of the Perl Monks concerning the following question:
Another insane project. This is just a gleam in my eye. I thought my other program was going to be my last one! Damn.
Iterations of the Prisoner's Dilemma prove interesting things about what a "successful" strategy is. (See Axelrod, The Evolution of Co-operation). I would love to build a genetic algorithm to play the prisoner's dilemma, and see what evolves. (I know it has been done before, but I like DIY.)
It's all easy apart from the genetic algorithm bit. My scribbled notes suggest this - NB I am an amateur and don't have any academic background in the field:
Use 1 for cooperation, 0 for defection. The DNA is a string of elements which operate successively to come up with a final 1 or 0.
Start with 1. (Or 0 - does it matter?)
DNA letter meanings:
Ax - "and" with x
I know this wastes space and it should all be bit vectors or whatever, but ignore that. My questions:
Could it be simpler? Do I need a "register"?
Should it be more complicated? Will adding complications allow for more powerful solutions?
Related to the "register" issue: does a simple linear program like this allow for different priorities? To put it another way, can you express "(1 and 0) or 1" as well as "1 and (0 or 1)" without the brackets?
How "atomic" should individual DNA elements be? E.g. should an element mean "and" and be coupled with the next element (disadvantage - some mutations might "not work" at all) or should an element mean "and with such and such" (seems less flexible, easier to write though).
A gene pool of 100 players all playing each other means 100*99 games (maths?) in a single generation. How can I make this bearably fast?
I'd be very interested to hear comments from people with a CS background.
NB: I found this page describing Axelrod's work with this. He uses simple brute force rather than a "programming language" approach. The downside is each player can only remember the last 3 games, and this is built in. Clever though.