Weasel program



The weasel program is a computer software simulation written by ethologist Richard Dawkins in order to demonstrate the relative power of cumulative selection in natural and artificial evolutionary systems.

Overview
In chapter 3 of his book The Blind Watchmaker, Dawkins gave the following introduction to the program, referencing the well-known infinite monkey theorem:

"I don't know who it was first pointed out that, given enough time, a monkey bashing away at random on a typewriter could produce all the works of Shakespeare. The operative phrase is, of course, given enough time. Let us limit the task facing our monkey somewhat. Suppose that he has to produce, not the complete works of Shakespeare but just the short sentence 'Methinks it is like a weasel', and we shall make it relatively easy by giving him a typewriter with a restricted keyboard, one with just the 26 (capital) letters, and a space bar. How long will he take to write this one little sentence?"

The example is staged to produce a string of gibberish letters, assuming that the selection of each letter in a sequence of 28 characters will be random. The number of possible combinations in this random sequence is 2728, or about 1040. The probability that the monkey will produce any given sequence is extremely low; conversely, the probability that the monkey will produce at least one of these possible sequences is very high. Any particular sequence can be selected as a "target" phrase, all equally as probable as Dawkins's chosen target, "METHINKS IT IS LIKE A WEASEL."

A computer program could be written to carry out the actions of Dawkins's hypothetical monkey, continuously generating combinations of 26 letters and spaces at high speed. Even at the rate of millions of combinations per second, it is unlikely, even given the entire lifetime of the universe to run, that the program would ever produce the phrase "METHINKS IT IS LIKE A WEASEL."

Dawkins intends this example to illustrate a common misunderstanding of evolutionary change, i.e. that DNA sequences or organic compounds such as proteins are the result of atoms "randomly" combining to form more complex structures. In these types of computations, any sequence of amino acids in a protein will be extraordinarily improbable. (See: Fred Hoyle)

Dawkins then goes on to show that a process of cumulative selection can take far fewer steps to reach any given target. He refines the program to preserve "favorable" combinations (or "hits") and to allow the remaining letters in the sequence to be replaced. In Dawkins's words:

"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 ... 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."

By repeating the procedure, a randomly generated sequence of 28 letters and spaces will be gradually changed each generation, preserving characters of the "target" phrase and replacing non-matching characters with randomly-chosen ones. The sequences progress through each generation:

Generation 1: WDLMNLT DTJBKWIRZREZLMQCO P  Generation  2: WDLTMNLT DTJBSWIRZREZLMQCO P Generation 10: MDLDMNLS ITJISWHRZREZ MECS P Generation 20: MELDINLS IT ISWPRKE Z WECSEL Generation 30: METHINGS IT ISWLIKE B WECSEL Generation 40: METHINKS IT IS LIKE I WEASEL Generation 43: METHINKS IT IS LIKE A WEASEL

Dawkins continues:

"The exact time taken by the computer to reach the target doesn't matter. If you want to know, it completed the whole exercise for me, the first time, while I was out to lunch. It took about half an hour. (Computer enthusiasts may think this unduly slow. The reason is that the program was written in BASIC, a sort of computer baby-talk. When I rewrote it in Pascal, it took 11 seconds.) Computers are a bit faster at this kind of thing than monkeys, but the difference really isn't significant. What matters is the difference between the time taken by cumulative selection, and the time which the same computer, working flat out at the same rate, would take to reach the target phrase if it were forced to use the other procedure of single-step selection: about a million million million million million years. This is more than a million million million times as long as the universe has so far existed."

Implications for biology
The program is a vivid demonstration that the preservation of small changes in an evolving string of characters (or genes) can produce meaningful combinations in a relatively short time, as long as there is some mechanism to identify and preserve desirable changes while allowing undesirable changes to be removed or replaced. This is intended to serve as an analogy to natural selection's action on randomly mutating genomes, with the "desirability" (or fitness) of any given change being determined by the organism's interaction with its environment.

Though this simplified example is contrived, involving the selection of a target phrase by an intelligent agent, Dawkins is careful to point out that the example has its limitations:

"Although the monkey/Shakespeare model is useful for explaining the distinction between single-step selection and cumulative selection, it is misleading in important ways. One of these is that, in each generation of selective 'breeding', the mutant 'progeny' phrases were judged according to the criterion of resemblance to a distant ideal target, the phrase METHINKS IT IS LIKE A WEASEL. Life isn't like that. Evolution has no long-term goal. There is no long-distance target, no final perfection to serve as a criterion for selection, although human vanity cherishes the absurd notion that our species is the final goal of evolution. In real life, the criterion for selection is always short-term, either simple survival or, more generally, reproductive success."

Critical analyses
Dawkins's "weasel program" has been the subject of much debate. Some philosophers of science have criticized the example as overly simplistic, and proponents of creationism and intelligent design have denied it as a useful example of natural selection because it requires that a target phrase be chosen by a human operator, who serves as a "designer" establishing a goal toward which the stepwise changes progress; thus, the program is actually an example of automated artificial selection.

Dawkins has responded to these criticisms by pointing out that the program was never intended to model evolution accurately, and that he very specifically described it as an artificial selection process from the outset, as the citation above shows. It was only meant to demonstrate the power of cumulative selection as compared to random selection, and show the complete unrealism of the popular notion of natural selection as "monkeys pounding on typewriters". A "monkeys & typewriters" program would simply guess strings independently until it got a match, which would take a very long time; such a "monkeys" program could be regarded as a model of saltationism, but not selective evolution.

More complex models
In The Blind Watchmaker, Dawkins goes on to provide a graphical model of gene selection involving entities he calls biomorphs. These are two-dimensional sets of line segments which bear relationships to each other, drawn under the control of "genes" that determine the appearance of the biomorph. By selecting entities from sequential generations of biomorphs, an experimenter can guide the evolution of the figures toward given shapes, such as "airplane" or "octopus" biomorphs.

As a simulation, the biomorphs are not much closer to the actual genetic behavior of biological organisms, but serve to illustrate the concept of "genetic space," where each possible gene is treated as a dimension, and the actual genomes of living organisms make up a tiny fraction of all possible gene combinations, most of which will not produce a viable organism. As Dawkins puts it:

"...however many ways there may be of being alive, it is certain that there are vastly more ways of being dead."