In this set of experiments we use a very simple simulation to investigate how certain parameters of the simulation impact the overall fitness of the evolved population. The objective of this work is to get some insight on the dynamic of a population evolution depending on the initial size of the population, the size of its DNA, the size of the world, the mutation rate, etc.
In Evo(rand), a simulated being (named creature) has an associated DNA (it's genotype) which typically encodes the rules that govern it's behaviour. The DNA is composed of a number of bytes, called the DNA Size. Upon birth of a creature, it's DNA is copied from it's parent and each bit is inverted with a mutation probability, the mutation rate. These random changes in the DNA is the basis for the evolution within Evo(rand).
Evo(rand) implements a DNA parser which looks for bytes in the DNA that match a particular pattern. Once such byte is found, it marks the beginning of a Gene within the DNA. The parser extracts the gene and continues scanning the DNA for other matching bytes. There is no limit to the number of genes that can be extracted from the DNA.
One particularity of Evo(rand) is that the mutation rate can be encoded in the DNA of the creature itself instead of being fixed for all creatures. For example it can be defined as a range of values (say between 2% and 0.001%) with the default value being the maximum (in this case the mutation rate of the first generation would be 2%).
When you run a simulation of a world of creatures where the DNA mutation rate is encoded in the DNA itself, you would typically expect that mutation rate would go down over the generations. This would be a sign that the population has found some reasonable fitness with its environment, and is better off not changing too much from one generation to the next. However in some extremely changing environments, a low mutation rate may not be the best. Examples of such environments are described here.
Evo(rand) simulates a rectangular non-toric world of lattices in X and Y directions. In this very simple simulation, the creatures have 2 possible actions:
Creatures can indefinitely reproduce and move. There is no concept of conservation of energy or maximum live span. But to limit the explosion of population, all creatures within a lattice are killed when there are strictly more than 3.
This is actually the simplest possible simulation of a world where evolution can occur.
In all the graphs below we define as fitness the average number of live creatures per lattice. By definition, the maximum possible fitness is 3.
The only mean for creatures to adapt to the environment is through the evolved behaviour rules encoded in the DNA. When rules encoded in the DNA do not lead to a behaviour decision, the default behaviour is:
The DNA on the initial population is a set of 0s and does not have any encoded behaviour rule. So the behaviour of the initial population is entirely governed by the default behaviour. The fitness with the default behaviour is 0.15 creature per lattice.
In this first test we look at the impact of the number of creatures in the initial population. The world is a square of 50 by 50 lattices and the initial population varies from 50 (1 per 50 lattices) to 5,000 (2 per lattice). The DNA size is 100 and the mutation rate is 0.5%.
The graph shows the average number of creatures per lattice at simulation ages 1,000, 4,000 and 20,000.
As can be seen, the number of creatures in the initial population has no impact.
However we can already see that the fitness improves over a longer period of simulation.
Still with a world of 50 x 50 lattices and a mutation rate of 0.5%, we now vary the size of the DNA between 10 and 200 bytes at simulation ages 500, 1,000, 2,000, 4,000, 8,000, 20,000 and 100,000. The graph below shows averages over multiple simulations with the same DNA size and age. It shows average values with some filtering along the DNA size dimension.
A first observation of the graph is that the fitness grows with the DNA size and then goes down, more or less early. With low DNA sizes we observe 4 stages:
With higher DNA sizes, and starting at 56 bytes for age 500, a peak of fitness is met and then the graph goes down. The highest peak is 1.56 with ages 20,000 and 100,000. The reason why it goes down is the following: as the DNA size increases there is a higher chance for creatures to evolve a behaviour rule which is to stay put, not to move anymore. The longer is the DNA the higher is the probability that such behaviour arises from evolution, which is reflected by a decreasing average fitness.
When the simulation runs for a longer time (the increase in age), the few creatures which continue to move and evolve would ultimately take over the space of the static creatures, and the overall population still increases. This is why, given a DNA size, the average fitness increases with the age.
The graph below shows the fitness when trying to filter out the simulations with static creatures: the fitness keeps increasing with the DNA size.
Starting from 40 bytes and above, we see that the fitness increases with the age.
The age is the unit of time in Evo(rand). The graph at age 4,000 (in green) was generated by running 100 different simulations till age 4,000, and this for each value of DNA size between 10 and 200 bytes.
In other words, the longer the simulation runs (i.e. the longer time we give to evolution), the better is the fitness. And the benefit of a longer simulation is more apparent for longer DNAs. Some optimum seems to be reached at age 20,000.
As explained in the introduction to thew simulated model, the default behaviour of a creatures is:
Those rules govern the behaviour of the first generation of creatures, for which the DNA is a sequence of 0s. From one generation to the next, the 0s and 1s of the DNA are inverted with a probability of 0.5%. Over multiple generations new behaviour rules can arise from the DNA. A simple behaviour rule uses 10 bytes and a complex behaviour rule uses 14 bytes.
Between 10 and 13 bytes, the evolution has no effect and the fitness is always 0.23. All simulations evolve to the same basic behaviour rule, which is to Move to a random location 33% of the time. With this rule added to the default behaviour, what the creatures actually do is:
Between 14 and 19 bytes, the evolution has no effect and the fitness is 0.54. All simulations evolve to the same complex behaviour rule, which is to Move to the neighbouring lattice with minimum creatures right after a "Clone" action. With this rule added to the default behaviour, what the creatures actually do is:
That very simple change of behaviour immediately increases by 150% the average fitness of the population.
From 20 bytes and above, the evolved combination of rules varies from one simulation to the other and is much more complex to analyse.
Fitness increases with the size of the DNA and the age of the simulation (which is the time given for evolution to occur over more generations). However a large DNA can cause evolution to stall. This is certainly due to the extreme simplicity of the simulation.
The best fitness achieved is 1.72, with a mutation rate of 0.5%, DNA size 200 and at evolution age 20,000.
With a mutation rate of 0.5% and a simulation age of 4,000, we now vary the size of the world from 20 x 20 lattices to 100 x 100 lattices. The graph below shows averages over multiple simulations with the same DNA size and world size (from 400 till 10,000). It shows average values with some filtering along the DNA size dimension.
And the same after filtering simulations with static creatures.