The Atavism

Friday, May 1, 2009

So, the weasel script that I wrote to mock Dembski et al was kind of ugly, this is largely because I'm a terrible programmer but even I could improve on bits of it, and since I also thought I should learn about classes and dealing with command line arguments I spent some of a rainy weekend on a version that will collect paramaters from the commandline and make one run of the weasel algorithm with those paramters

From the inline help:
Usage: -[options] [popsize] [mutation rate]

Makes one run of Dawkins' weasel algorithm, displaying the best string in each generation and the 'fitness' of that string (number of characters matching the target string). Options -h or --help display this help message -t target sequence (defaults to"Methinks it is like a weasel") -l use locking (once a character matchs the target do not mutate) -o [file] log the fitness of the each generation to the specified file Arguments popsize: the number of strings created in each generation mutation rate: the probability of each letter mutating in each geneartion (a floating point number between 0 and 1) Example python -l -o outfile.csv 100 0.05 (a run with locking, logged to 'outfile.csv', n=100 and u=0.05)

Labels: , , , ,

Posted by David Winter 2:09 PM


Very nice!

The only suggestion I'd make would be to set -l to be on by default.
Actually, no, I take that back. I didn't realise the original weasel didn't use locking. Sorry.

Post a Comment