What
Mutate is a simple web based application written in PHP to demonstrate the
concept of evolution through random mutation and natural selection. The
demonstration utilizes human language and randomized characters to mimic
the random mutations and a dictionary lookup and human interaction to complete
the natural selection of viable mutations.
Why
I viewed a similar web application that was written with the intent of
disproving the concept of random mutation and natural selection. Aside from
the likelihood that by itself such an application does not disprove the
concept, the application not only failed to implement any means of natural
selection but it appears it was written with the intent of never producing
a viable mutation.
While a sentence entered into the application would start with
spaces between words I never observed any mutations that produced a
space character, therefore, all the spaces in the original sentence were
eventually replaced with characters making it impossible for the experimental
mutation simulation to produce a viable sentence.
The application also did not provide an easy means of retaining viable
sentences but instead leaves the user stuck with a meaningless mutated
sentence. This makes the natural selection process cumbersome for the
user.
The objective of the simulation was interesting and should be relatively
simple to implement so I took a crack at it myself.
How
The application provides a form for the user to interact and control the
mutation and natural selection process. You start with a valid sentence,
set the mutation parameters and click the mutate button. The server performs
random character mutations on the sentence to create new mutated sentences.
Each mutated sentence is first checked using the dict protocol to check a
dictionary for the existence of each word in the mutated sentences. If all
the words in a mutated sentence are valid then the user is presented with
the sentence to verify it is truly viable and makes sense. When a user
clicks on a viable mutated sentence it is transfered to the form and prepared
for further mutation.
If a mutated sentence is selected and the mutate button is clicked again to
continue the mutation process for this new sentence, a record is stored in a
database table to track the mutation process.
The mutation results stored in the database can be viewed using the Mutation
Tree. Each sentence in the mutation tree can be selected as a candidate for
further mutation testing.
Running A Server
To run your own mutation server you need an http server with PHP 5 and the
dict command and either a postgresql or mysql database server (the mysql server
must be capable or running innoDB tables).
Download the PHP application tarball, extract into your web directory on
your http server, edit the config/dbconfig.php file with your database
settings (db_type='pgsql' and db_port='5432' for postgresql, db_type='mysqli'
and db_port='3306' for mysql) and the host name for the server that will
provide the dictionary dict protocol (default is dict_host='127.0.0.1' if
running your own dict server).
Create the table in the database:
CREATE TABLE mutations ( id INTEGER NOT NULL, sentence VARCHAR(120) NOT NULL,
mutations INTEGER NOT NULL, parentid INTEGER, mutatetime TIMESTAMP WITH TIME ZONE,
PRIMARY KEY (id), FOREIGN KEY (parentid) REFERENCES mutations(id) ON DELETE CASCADE
ON UPDATE CASCADE );
Open the web page in a browser and start mutating.
mutate-0.2.tgz