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!!!

donderdag 22 augustus 2013

Holiday project: my RaspberryPi shows that plants move!

After a few weeks of silence on this blog, a new post. Not about cucumbers, but moving plants (Do plants move? Yes, they do. Just very very slowly).

I bought a RaspberryPi before the holiday and wanted to test its capabilities and see how easy it was to program on it. So, I needed a project. After a view days of thinking I came up with making a time lapse movie (Ok, I know, not the most creative idea, but it was an idea). People might think that I would make a time lapse of the night sky, but I didn't. I am living in Delft, which is next to the Westland. This is a region with the largest surface area of the Netherlands (maybe even the world, I don't know, but you can see it from space, unlike the Great Wall of China) covered with greenhouses. At night they all turn on the lights. This makes it quite difficult to get a good view on the stars and Milky Way. So, I decided to capture other slow moving objects. Plants!!!

Another holiday project of mine is to grow my own fresh herbs. So at home little pots of green plants are scattered throughout the house. I used some of these. I had seen a Youtube movie (I think a TED talk, but I am not sure) about motion of plants and I wanted to see for myself, if this was true. Plants don't have eyes, ears, noses or mouths, so how could they interact with the surroundings without these (for humans) critical sensors. Of course they have the chloroplasts (the greenish color), so I assumed the main motion would have something to do with directing the leaves to the sun.

What I did was the following: After one morning of sunshine I would turn the pots 180 degree, such that the leaves where pointing in the opposite direction of the sun. Then I would start my time lapse recording and wait for results. For this purpose I used a RaspberryPi together with a CCD camera that I also ordered from the RaspberryPi website. On my RaspberryPi I had put the LinuxArch operating software, which made interacting with the RaspberryPi a bit like operating the servers at my work. After some searching on the internet, how to get things working (I am not a Linux wizard, but I am now some sort of first apprentice with the WWW as my mentor), I got it to work (don't use crontab, but the more simple SLEEP shell command does the job much easier). This was my setup:

Above the RaspberryPi, I attached the camera board to a camera stand with some sticky tape. This is the engineering way. Furthermore I mounted an extra external USB hard disk, where all the pictures could be stored on. I used my basil and parsley plants in the first run. The second run I added coriander and melissa to the experiment. Every five minutes a photo would be taken by the RaspberryPi and stored on the USB-hard disk. The results are shown in the next (brilliantly crafted) video:

In the side view the sun is to the right and in the front view the sun is to the back (This was just my reference frame). So you see, plants do move and can interact with the surroundings. You just need to take your time to notice it.