Wikipedia:Peer review/Weasel program/archive1
Appearance
I think this is pretty good work by user:MFNickster. Though perhaps we ought to explain some more of it in our own words rather than Dawkins, wondered what you guys thought. Dunc|☺ 10:58, 11 Jun 2005 (UTC)
- It seems pretty straight forward. So was the matching criteria merely the number of letters that matched the string? Were those matches then allowed to mutate or were they locked in position? If it's a short algorithm then possibly a pseudo-code snippet would be useful? — RJH 15:28, 15 Jun 2005 (UTC)
- Thanks for the kind words, Dunc! Unfortunately, Dawkins didn't publish his code, and has said that he doesn't have a copy anymore. But from his description, it sounds like an increase in matching characters could make a string "more fit" and not necessarily be locked in position. For instance, a string could mutate into a variant that loses 1 correct character and gains 2 different correct characters, and still be closer to the target.
- Also: It would be nice to know if Dawkins gave each character in the string a probability of mutating each generation, or if the 'children' each varied from the 'parent' by a single randomly-selected character. I think the simplest method would be to have each generation consist of a population of 28 strings that are exactly one character removed from the 'parent,' but my suspicion is that such a program would take many more generations to reach the target than one with a larger population size.
- MFNickster 03:14, 19 Jun 2005 (UTC)
- I think the fitness function was whether it matched (1) or not (0). Being able to mutate those already matched would simulate reality more, but take slightly longer computational time. I however guess it's former, otherwise you won't see it slowing down as it gets nearer to its target sequence (which ought to happen). I agree on the pseudocode, but not sure how to write it. Dunc|☺ 15:40, 15 Jun 2005 (UTC)
- (RJH 16:33, 16 Jun 2005 (UTC)) Here's my simplistic attempt, which I am sure can be much improved:
Create a random population of n members Base score is zero For each member in population Compute score equal to total character/position matches If score improvement Store member and its score as best match For each successive generation If exact match found, exit loop For each member of a random (1/8 population) sample Copy a random sub-string from best match into member Compute new score If score improvement Store member and its score as next generation's best match For each member of a random (1/8 population) sample Mutate one character of member Compute new score If score improvement Store member and its score as next generation's best match List the results