Skip to content

Ramimashkouk/BirdsEcosystemSimulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BirdsEcosystemSimulation

Based on genetic algorithm

This project is built upon an idea from The Selfish Gene book by Richard Dawkins. It's a simulation of an evolutionary ecosystem of birds of the same kind, which differ from each other in some different genes responsible for the reply of help-asking. I wouldn't explain the ecosystem better than Richard Dawkins would do the system, so here's the problem introduction, quoting the text in his book:

"Suppose B has a parasite on the top of his head.A pulls it off him. Later, the time comes when A has a parasite on his head. He naturally seeks out B in order that B may pay back his good deed. B simply turns up his nose and walks off. B is a cheat, an individual who accepts the benefit of other individuals' altruism, but who does not pay it back, or who pays it back insufficiently. Cheats do better than indiscriminate altruists because they gain the benefits without paving the costs. To be sure, the cost of grooming another individual's head seems small compared with the benefit of having a dangerous parasite removed, but it is not negligible. Some valuable energy and time has to be spent. Let the population consist of individuals who adopt one of two strategies. As in Maynard Smith's analyses, we are not talking about conscious strategies, but about unconscious behaviour programs laid down by genes. Call the two strategies Sucker and Cheat. Suckers groom anybody who needs it, indiscriminately. Cheats accept altruism from suckers, but they never groom anybody else, not even somebody who has previously groomed them."

I encourage you now to have a look at this animation, trying to know what is going on in the ecosystem, before continuing to the ecosystem explanation, following

"If the incidence of parasites is high, any individual sucker in a population of suckers can reckon on being groomed about as often as he grooms. The average pay-off for a sucker among suckers is therefore positive. They all do quite nicely in fact, and the word sucker seems inappropriate. But now suppose a cheat arises in the population. Being the only cheat, he can count on being groomed by everybody else, but he pays nothing in return. His average pay-off is better than the average for a sucker. Cheat genes will therefore start to spread through the population. Sucker genes will soon be driven to extinction. This is because, no matter what the ratio in the population, cheats will always do better than suckers. When the proportion of cheats reaches 90 per cent, the average pay-off for all individuals will be very low: many of both types may by now be dying of the infection carried by the ticks. But still the cheats will be doing better than the suckers. Even if the whole population declines toward extinction, there will never be any time when suckers do better than cheats. Therefore, as long as we consider only these two strategies, nothing can stop the extinction of the suckers and, very probably, the extinction of the whole population too."

Playing around with parameters like INFECTION_RATE, MUTATION_RATE, INIT_SUCKER, N_CHEATS (init_cheats) would surprise you how ecosystem can be affected by small differences in nature's values.

For the other part of the simulation, Dawkins continue:

Suppose there is a third strategy called Grudger. Grudgers groom strangers and individuals who have previously groomed them. However, if any individual cheats them, they remember the incident and bear a grudge: they refuse to groom that individual in the future. In a population of grudgers and suckers it is impossible to tell which is which. Both types behave altruistically towards everybody else, and both earn an equal and high average pay-off.

Again, now I encourage you to have a look at the animation below, trying to figure out what's going on when the population consists of the three types of birds (suckers-cheats-grudgers).

In a population consisting largely of cheats, a single grudger would not be very successful. He would expend a great deal of energy grooming most of the individuals he met—for it would take time for him to build up grudges against all of them. On the other hand, nobody would groom him in return. If grudgers are rare in comparison with cheats, the grudger gene will go extinct. Once the grudgers manage to build up in numbers so that they reach a critical proportion, however, their chance of meeting each other becomes sufficiently great to off-set their wasted effort in grooming cheats. When this critical proportion is reached they will start to average a higher pay-off than cheats, and the cheats will be driven at an accelerating rate towards extinction. When the cheats are nearly extinct their rate of decline will become slower, and they may survive as a minority for quite a long time. This is because for any one rare cheat there is only a small chance of his encountering the same grudger twice: therefore the proportion of individuals in the population who bear a grudge against any given cheat will be small. I have told the story of these strategies as though it were intuitively obvious what would happen. In fact it is not all that obvious, and I did take the precaution of simulating it on a computer to check that intuition was right. Grudger does indeed turn out to be an evolutionarily-stable-strategy (ESS) against sucker and cheat, in the sense that, in a population consisting largely of grudgers, neither cheat nor sucker will invade. Cheat is also an ESS, however, because a population consisting largely of cheats will not be invaded by either grudger or sucker. Apopulation could sit at either of these two ESSs. In the longterm it might flip from one to the other. Depending on the exact values of the pay-offs —the assumptions in the simulation were of course completely arbitrary— one or other of the two stable states will have a larger 'zone of attraction' and will be more likely to be attained. Note incidentally that, although a population of cheats may be more likely to go extinct than a population of grudgers, this in no way affects its status as an ESS. If a population arrives at an ESS that drives it extinct, then it goes extinct, and that is just too bad.

Other varieties of results can be found here, 4, 6, 7, 8

About

A simulation of ecosystem of birds using Genetic Algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages