| We're all homos here|
|A Gradual Science|
|Plain Monkey Business|
So much for single-step selection of random variation. What about cumulative selection; how much more effective should this be? Very very much more effective, perhaps more so than we at first realize, although it is almost obvious when we reflect further. We again use our computer monkey, but with a crucial difference in its program. It again begins by choosing a random sequence of 28 letters, just as before:
WDLTMNLT DTJBKWIRZREZLMQCO P
It now 'breeds from' this random phrase. It duplicates it repeatedly, but with a certain chance of random error - 'mutation' - in the copying. The computer examines the mutant nonsense phrases, the 'progeny' of the original phrase, and chooses the one which, however slightly, most resembles the target phrase, METHINKS IT IS LIKE A WEASEL. In this instance the winning phrase of the next 'generation' happened to be:
WDLTMNLT DTJBSWIRZREZLMQCO P
Not an obvious improvement! But the procedure is repeated, again mutant 'progeny' are 'bred from' the phrase, and a new 'winner' is chosen. This goes on, generation after generation. After 10 generations, the phrase chosen for 'breeding' was:
MDLDMNLS ITpSWHRZREZ MECS P
After 20 generations it was:
MELDINLS IT ISWPRKE Z WECSEL
By now, the eye of faith fancies that it can see a resemblance to the target phrase. By 30 generations there can be no doubt:
METHINGS IT ISWLIKE B WECSEL
Generation 40 takes us to within one letter of the target:
METHINKS IT IS LIKE I WEASEL
And the target was finally reached in generation 43. A second run of the computer began with the phrase:
passed through (again reporting only every tenth generation):
Y YVMQKSPFTXWSHLIKEFV HQYSPY
METHINKS IT ISSLIKE A WEFSEY
METHINKS IT ISBLIKE A WEASES
METHINKS IT ISJLIKE A WEASEO
METHINKS IT IS LIKE A WEASEP
and reached the target phrase in generation 64. In a third run the computer started with:
and reached METHINKS IT IS LIKE A WEASEL in 41 generations of selective 'breeding'.
Thanks to the marvels of the modern Internet, you can see the weasel for yourself. Click the start button to see the phrase "evolve" before your very eyes!
By repeating the process you can begin to get a picture of how evolution can work. Sometimes it happens fast, sometimes slowly. Sometimes it gets word pretty quick while the rest of the phrase lingers around looking like gibberish. Other times it gets stuck in gibberish land until one tiny kick lets it evolve quickly. Of course, evolution isn't always directional like this, the Weasel program certainly has an aim; to reproduce the exact phrase put into it from randomness and variation. However, natural selection does favour certain aspects or abilities or traits over others and the Weasel program certainly does simulate this. In the case of the algorithm, it generates an "environment" that favours strings of words that look like ME THINKS IT IS LIKE A WEASEL, just like a green environment would favour green insects as they would camouflage themselves against predators. Thus, when the algorithm runs, it uses random mutation, followed by natural selection, to derive something that is optimal for the environment it's in.
The algorithm has been implemented in various programming languages by numerous programmers. Most implementations are quite similar, along the following lines:
- choose random string
- copy string n times with mutation
- take best fitting string
- Stop, if the number of correct letters is 28, otherwise
- goto 2
Step 3 includes the evaluation of a fitness function. Virtually all implementations define the best fitting string as the one with the most correct letters - a number between 0 and 28.
William Dembski, being a noted intelligent design advocate, chooses another way:
- choose random string
- if all letters are in place: STOP Otherwise:
- mutate letters which are not in place
- goto 2
Surprisingly, Dembski insists that this is the implementation Richard Dawkins used in his book - though Dawkins himself says otherwise... Answers in Genesis makes the same claim. The intellectual dishonesty in both cases is obvious as there exist examples of freely available scripts implementing the algorithm which clearly do allow for the mutation of in-place characters.
This confusion is doubtless because the fitness function used combined with a small percentage chance of mutations does not encourage regressions in small strings. Using a longer sentence and increasing the mutation chance as high as 10% tends to give regressions in many generations, even to the point where the fittest in the generation is not as fit as its progenitor. High mutation rates take longer to converge on the wanted solution, which may seem at first somewhat counter intuitive.
- Conservation of Information in Search - Measuring the Cost of Success
- Efficient Per Query Information Extraction from a Hamming Oracle
- Evolution IS a Blind Watchmaker - A YouTube video with a more graphical display of a similar algorithm, to synthesise a clock.
- Richard Dawkins: The Blind Watchmaker, 1986, pp. 46-47
- If you want the Dawkins weasel in other computer languages, see the "like a weasel" blog, which has versions in Python, Perl, Excel VBA, etc.