maandag 26 augustus 2013

Testing the theory of evolution: The story of the Red Dots

"But you are a geophysicist, not I biologist", I hear you thinking. Yes, that is true, but that does not stop me from looking at science in other fields. I think the theory of evolution is a great way to describe all the diversity we see around us. Not only in animals and plants, but also in man-made objects, politics, design, law, ethics and social interaction. Lets say evolution really is correct and is happening around us (I know that on the internet there is a large debate about its correctness, but I think one side just lack in good arguments and evidence), could we test it? To see if it really works.

Let me explain what I think evolution is about, correct me if you think I am wrong (finally some comments :)). Evolution in systems is about finding the optimal solution for the system to be in. Evolution does not know that it is doing this. The optimal solution changes over time, because of internal and external forces. In this sense evolution is very powerful. It allows the system to cope with change.

Lets explain this in classical Darwin Evolution. It is based on the survival of the fittest (fitness function, we are going to use this later on). Say we have a population of birds on an island. This population contains the same kind of birds, yet every individual bird is slightly different than its brothers and sisters. On the island we have red berries (very tasty) and blue berries (poisonous). The birds need to eat the berries in order to survive. In the earlier days of the birds existence there is a massacre. Lots of birds of this population die because they eat the blue berries. A few birds do not eat the berries, because they don't like the color blue and are afraid of it. Those birds eat the red berries, stay alive and grown baby birds (reproduction). These baby birds are also afraid of the blue berries, because they got the 'afraid' genes from their mother and father. Some baby birds are not afraid (point mutation), but die after eating the blue berries. In the end you have a population of birds that only eats red berries and leave the blue berries alone. In this case the fittest individual was afraid of the blue berries and after some time the optimal solution for the complete population (system of birds) was found.

If you think about this it is an elegant theory that can explain adaptation of systems to any environment. The theory needs four things to work:
  • population of individual that slightly differ from each other (randomness and point mutations)
  • a mechanism to pass on information to future individuals (genes, reproduction)
  • an optimal solution (fitness function)
  • time to let the population evolve to the new equilibrium (sometimes a lot of time)
We can test and even use this theory in computer science and it has been used a lot. In space engineering, we use it a few years now. It is called genetic algorithm and it works! I will try to show you how it works with another simple example. However, don't get fooled by the simplicity, the possible applications are endless.

In this little experiment we have an environment of 256 by 256 positions (yes, this can be reproduced by a string with 2x8 bits). This environment has height differences, there are minimum and maximum height locations. I have created such an environment by putting some random equations together (You can also use the DTM of your neighborhood or country). My environment (call it the garden of Red Rots) is illustrated in the figure:

The red areas are positive height areas and the blue are negative areas. The greenish color represent zero height (or coastal areas after the Great Flood, damn spoiler alert!). In this environment I put at random locations a population of red dots (They are called the Red Dots). Every red dot has a gene of 16 bits (ones or zeros), which give it its location. The good thing about the red dot's life is that in the middle of the day (a for loop run), it can reproduce with a fellow red dot and create two children. This doubles the population. To keep the population stable, 50% of the red dots die depending on their location and a defined fitness function. After the selection, another day will start and this goes on for several generations.

Let the story begin! The Red Dots need water to survive. Lets say the probability of survival is better when they have access to water. In our environment, water can be found in the lower areas. This is what happens (top left to bottom right, read it like a book ;) ):
You see that overtime the Red Dots prefer to go to the lower situated areas. Here they can reproduce and be happy! But then on one day it begins to rain and rain. Floods are threatening the Red Dots at low situated areas. Red Dots that are located in higher areas have a much greater chance of survival and reproduction (which is what we are all here for). This is what happens:

Nine generations after the Great Flood, the Red Dots have climbed the High mountain. But life is not good. Water is scarce and it is very cold up there. Unfortunately after nine generations (should it be 40, nah!!!) the Great Rain stops and so does the Flood. The Red Dots can go back to their old lands, however they remember! In their genes they remember the Great Flood and therefore they won't go to the absolute minimum, but stay half way. Due to this knowledge they find that the probability of survival is around the zero height. This is what happens:

Nowadays the Red Dots live at the coastal areas, where there is enough fish and water to survive. And they all reproduced happily and after. 

Evolution in a few seconds (it took 2 minutes to compute this story). I just applied the four elements (I could not fix a fifth element, Mila did not answer her phone) of evolution in a software program and I could create order out of chaos. Also my system of Red Dots where able to adapt to external forces. Evolution really works!!!

Geen opmerkingen:

Een reactie posten