|
Telecom Paris
Dep. Informatique & Réseaux
October 2025 |

Module Athens TP-09
| Ada Diaconescu - Associate professor at Telecom-Paris |
| Jean-Louis Dessalles - Associate professor at Telecom-Paris |
| Samuel Reyd - PhD student at Telecom-Paris |
Load the configuration Favourable.evo in the Configuration Editor (Starter). In this application, implemented in Scenarii/S_Favourable.py, individuals are rewarded depending on the value of the gene named favourable. The other gene, named neutral, has no effect. Choose a positive value for parameter IndividualBenefit (in the section Scenarios/BehaviouralEcology/Favourable in the Configuration Editor). Run Evolife (button [Run]). As predicted by basic Darwinian principles, the average value of the first gene should rise to maximum, whereas the neutral gene average value oscillates around 50 (the amplitude of the deviation depends on the size of the population).
| Change the interpretation of DNA from ‘Weighted’ to ‘Unweighted’ in the ‘genetic’ section of Starter. Does this have any effect on the evolution of the gene? (pay attention to the ‘Genome’ window) |
➜ You might restore GeneCoding to Weighted.
| Try a negative value for IndividualBenefit. You may have to change DNAFill (which defines how DNA is initialized) to -1 (random DNA) or to 1 (whole DNA filled with 1s). What do you observe? |
➜ Restore a positive value for IndividualBenefit.
| Change the value of Cumulative to 1, to indicate that scores are not reset each year and are instead accumulated throughout the individual’s life. You may open the Field window (shortcut 'f') to display individuals according to their score (vertical axis). Compare the cumulative and non-cumulative cases. How does accumulation change the evolution of the Favourable gene? Why? |
Set CollectiveBenefit to a high value such as 100, and IndividualBenefit to a smaller negative value, such as -10. The net profit for each member of the group may be significant, with a maximum of 90 if everyone contributes 100% to the public good. We may thus intuitively expect the value of the gene to rise.
| Run the program (button [Run]) and see what happens. Do you understand why? (you may have a look at this). Try to set IndividualBenefit to -1. Does it change the result? Try to switch Cumulative between 0 and 1. |
To understand the limits of the so-called "group-selection", you may read Group Competition, by Samuel Bowles.
Let’s suppose that all individuals have the same gene value m, except for a proportion p of them (mutants) whose gene value is M. Let’s call:
| Give a formal expression of A’s and B’s benefit. Calculate the differences A–B and A–C. |
|
These expressions suggest ways to have collective benefit prevail over individual loss.
Suggestion: you may change (NumberOfGroups) to 10 to get smaller groups. Does it help? |
|
This effect, known as The tragedy of the commons (Hardin, 1968) is quite counterintuitive at first sight. Share any thought, comment or interrogation you might have about it. Hardin, G. (1968). The tragedy of the commons. Science, 162 (3859), 1243-1248. |
This small experiment was popularized by Richard Dawkins in his book The selfish gene. It shows how some interesting coupling between genes may emerge in a population.Suppose a given gene has two effects on its carriers:
Open the file S_GreenBeard.py (in the Scenarii directory) and implement the function interaction so that green bearded individuals (those whose gene named GreenBeard has value 1) behave altruistically toward their green-bearded fellows by helping them: they give them life points (through the score function) at their own expense (they lose points, but possibly less, as controlled by the GB_Cost coefficient). To do so, you need to use functions such as:
self.Parameter('GB_Gift')
self.Parameter('GB_Cost')
| Implement the interaction function, using only the GreenBeard gene. Copy the relevant lines of your function in the box below. |
Observe that the GreenBeard gene invades the population. To understand the phenomenon, one must look at genes rather than at individuals. On average, the payoff of the GB+ allele is:
\(p * (GB_{Gift} - GB_{Cost})\)
where $p$ is the probability of GB-GB encounter. The average payoff of the GB- allele is 0.|
Try values for which the cost is slightly larger than the benefit. You should observe that the GreenBeard gene does NOT drop down to 0! (you may turn the selection method to ‘selection pressure’ for comparison).
Why is it so? |
The GreenBeard gene happens to have two coupled effects:
|
Split the two effects by using the second gene Altruist. You read the value of that gene by calling: indiv.gene_value('Altruist')
Copy the relevant lines of your function in the box below. |
If you made appropriate changes, appearance is now controlled by GreenBeard, whereas the altruistic behaviour is controlled by Altruist. So whenever a green beard agent meets one of its fellows, it checks for the value of its own Altruist gene before helping at its own cost.
| Reset the benefit/cost to their initial values. You may start from a random population (set DNAFill to -1 in the ‘Genetics’ section). You should see that the 'Altruist' gene drops down to zero, but not the 'GreenBeard' gene. Why? |
Sex ratio is one the most famous problems in evolutionary theory. It is also one of the most impressive achievements of the game theoretic approach to evolution.
What’s wrong in this reasoning?
As it turns out, the welfare of the population is not what is maximized through the mechanics of natural selection. If one adopts the perspective of gene (or schema) replication, then the game theoretic optimum is predicted to be reached, in most species, for a 1:1 ratio between sexes.
Run Evolife with the SexRatio configuration (button [Run]). Observe that both the average value of the gene and the sex ratio itself remain stable around 50% .
Open the S_SexRatio.py file. In this scenario, individuals can be male or female (interestingly, we chose to implement the distinction as a phenotypic character, as it is not inherited). Individuals have a gene, called sexControl. When expressed in females, this gene is supposed to control the sex ratio of children. This is performed in the new_agent function.
Have a look at the implementation in S_SexRatio.py. Locate the lines in the new_agent function where the child’s sex is determined. Replace the line:
if random.randint(0,100) >= mother.gene_relative_value('sexControl'):
by either of the following lines:
if random.randint( 0, 60) >= mother.gene_relative_value('sexControl'):
if random.randint( 0, 60) <= mother.gene_relative_value('sexControl'):
if random.randint(40,100) >= mother.gene_relative_value('sexControl'):
if random.randint(40,100) <= mother.gene_relative_value('sexControl'):
These lines introduce a sex bias in favour of one of the two sexes.
| What do we observe at the population level? |
To explain what we see, let’s consider three alleles of 'sexControl':
| Which allele will be the most successful? |
| Run the simulation (button [Run]) with a non-zero value of the parameter SelectiveDeath, such as 75%. Males are "killed" at birth up to that proportion (new_agent is called from Group.py in the Ecology directory). We expect this selective infanticide to change the sex ratio. What do you observe? |
| Do you understand why? |
Hymenoptera (which include ants, wasps, bees) are known to have sometimes a sex ratio close to 3:1 in favour of females. This is explained by the imbalance of relatedness: In these species, female workers are related 0.75 to their sisters (one inherited mutation has 75% chance to be present in a sister), whereas they are related 0.25 with their brothers. The female workers are observed to bring the sex ratio from 1:1 among eggs to 3:1 (3 females for 1 male) by killing a certain amount of male larvae. This phenomenon provides one of the most striking evidence that evolution is governed by strict (and computable) laws.
Let’s compute the probability of transmission of a mutation from worker to niece or nephew. Let p be the proportion of females in the population, and b the worker’s bias in favour of sisters. The transmission w --> f --> f involves bias b times prob. 0.75 that the mutation be present in the sister, times prob. 1/(Np) that the sister be selected for reproduction (N = size of the local population), times prob. 0.5 that the child born is female, times prob. 0.5 that the mutation is passed on to the niece.
w --> f --> f: b * 0.75 * 1/(Np) * 0.50 * 0.50
Similarly:
w --> f --> m: b * 0.75 * 1/(Np) * 0.50 * 0.50
w --> m --> f: (1-b) * 0.25 * 1/(N(1-p)) * 0.50 * 1
w --> m --> m: (1-b) * 0.25 * 1/(N(1-p)) * 0.50 * 0
If we sum the four probabilities, take the first derivative in b and make it zero, then make p=b (equilibrium), we get b = p = 3/4, which means a 3:1 ratio in favour of females.
To represent the phenomenon (in a somewhat crude way) in our scenario, we suppose that the mother (not the worker) still controls the sex ratio, but that the daughter’s DNA is re-crossed with the mother’s genome a second time (see S_SexRatio.py). As a consequence, the mother-daughter relatedness is 0.75 (Note that this situation resembles the hymenoptera case, but only vaguely).
Run the simulation (button [Run]) after having set parameter Hymenoptera to 1. Observe the resulting sex ratio.
To explain it, we will compute the probability that a given mutation expressed in the female propagates to her grandchildren (distinguishing the four possibilities).
Let p be the proportion of females in the population, and b the mother’s bias in favour of daughters.
The transmission f --> f --> f involves:
f --> f --> f: b * 0.75 * 1/(Np) * b * 0.75
|
Write the four probabilities from female to grandchild in the box below. If you feel in good form, you may sum up the four probabilities, take the first derivative in b to find the optimum, make b = p because the optimum must be an equilibrium. This will give you p ≈ 0.78. This is the value you should have observed (a gray code may avoid problems with anisotropy of mutations). |
| Modify S_SexRatio.py so that sons, and not daughters, get more genes from the mother. What do you read from the simulation? Do you see why the result is different? |
Runaway selection has been imagined by Ron Fischer to explain extravagant features in animals (such as the peacock tail) as resulting from sexual selection. The scenario presented here is somewhat simpler than Fischer’s. However, it presupposes a direct advantage for females making the right choice.We suppose that it is crucial for females to mate with males that are in good health. The reason for this might be to avoid being infected by a contagious male during contact (see: Hamilton, W. D. & Zuk, M. (1982). Heritable true fitness and bright birds: a role for parasites? Science, 218 (4570), 384-387).
| Go to the Scenarios/BehaviouralEcology/Runaway section in Starter. Change the price for choosing an unhealthy male (parameter LowQualityCost). Which is the mimimum value for which runaway selection seems to be stable? |
In the current implementation, females get a proportional penalty for mating with an unhealthy male.
To get closer to the infection metaphor, we want to make penalty binary (the male is infected or he is not).
|
Go back to S_Runaway.py and introduce a new phene 'Parasite' in 'phenemap'. Phenes are randomly drawn between 0 and 100 at birth. This new phene is used to make individuals sick. Go to the new_agent function. It is called just after a new individual has been born. Compare the newborn’s phene 'Parasite' to the value of the parameter ParasiteProbability (that you can set using Starter). When it is smaller (which means that the individual is sick), divide the newborn’s quality by 2 (put the new value as second argument in Phene_value). Now go a few lines up, at the end of the parents function. Make the penalty binary instead of proportional by comparing again the father’s 'Parasite' phene to ParasiteProbability. If he is infected, the mother should lose 'LowQualityCost' score points. [Copy your last modification below] |
You should observe that the runaway mechanism still works, though for different values of LowQualityCost.
| For which minimal value of LowQualityCost do you observe runaway selection? |