TelecomParis_IPParis.png Telecom Paris
Dep. Informatique & Réseaux

Dessalles_2018.png J-L. DessallesHome page

October 2025

5

ECS_image.jpg Module Athens TP-09

    Emergence in Complex Systems

Lecturers:
    Ada Diaconescu - Associate professor at Telecom-Paris
    Jean-Louis Dessalles - Associate professor at Telecom-Paris
    Samuel Reyd - PhD student at Telecom-Paris

                                other AI courses
5


Contents









Please answer in English!

Behavioural Ecology







Individual fitness


Fitness.png 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).
Fitness (1)
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)

Evolution is now slower, as all bits have to evolve independently
Evolution is now faster, as all bits have to evolve independently

    

    You might restore GeneCoding to Weighted.

Fitness (2)
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.

Accumulation
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?

    








Public goods


    You may load Favourable_collective.evo from starter. Landscape.png
Individuals may contribute to public welfare. This is controlled by parameter CollectiveBenefit (in the section Scenarios/BehaviouralEcology/Favourable in the Configuration Editor). The value of the gene favourable, cumulated over all individuals in the group, provides a public good that will be redistributed to all members in the group (see S_Favourable.py). Intuitively, we would expect the gene to remain stable at high values, as the whole group benefits from the contribution of all its members.

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.

Public Goods
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:

C’s benefit is: CB * (N*m/N) + IB * m = (CB+IB)*m
PublicGoodsEquation
Give a formal expression of A’s and B’s benefit. Calculate the differences A–B and A–C.


    


PublicGoodsGroups
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?

    

Forum: Public goods
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.


    Hardin, G. (1968). The tragedy of the commons. Science, 162 (3859), 1243-1248.">         
    






The Green Beard effect


GreenBeard.jpg 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:

Load the configuration GreenBeard.evo in the Configuration Editor. The scenario offers two parameters: GB_Gift and GB_Cost that you may use to control individuals’ altruistic behaviour.

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:

The values of parameters may be accessed from the scenario through:

    self.Parameter('GB_Gift')
    self.Parameter('GB_Cost')

Green Beard (1)
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.
Green Beard (2)
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?

Because in the ‘selection pressure’ condition, parenthood is no longer biased in favour of the GreenBeard gene
Because in the ‘selection pressure’ condition, GreenBeard carriers accumulate negative scores
Because in the ‘selectivity’ condition, some lucky GreenBeard carriers get positive scores

    

The GreenBeard gene happens to have two coupled effects:


Altruist Green Beard (1)
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.

Altruist Green Beard (2)
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?

Because ‘GreenBeard’ individuals take advantage of the few altuists that are still around.
Because some altruistic ‘GreenBeard’ individuals are lucky enough to encounter other altruists like themselves.

    

Suggestions for further work

You may play with the idea.     






Sex ratio


MaleFemelleSymbol.jpg SexRatio.gif 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.
In our species, the sex ratio is roughly 1:1 (it is actually 1.05:1 in favour of boys; note that the ratio is currently 1:1.2 in some developing countries (see diagram) for non-biological reasons that you can figure out!!). From a "Public Goods" perspective, a 1:1 ratio is absurd. Only females contribute energetically to the reproduction of the population; tolerating 50% of males seems underproductive, since 1% would suffice for siring all the children.

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.

Sex bias at birth
What do we observe at the population level?

Sex ratio gets biased as expected
Sex ratio remains unbiased
Sex ratio gets slightly biased     

    

To explain what we see, let’s consider three alleles of 'sexControl':

Let’s suppose that we are in a situation in which the actual sex ratio in the population is 1:9 (there are nine times more females).
Sex ratio
    Which allele will be the most successful?

SC1     SC5     SC9

    


Selective death

    Restore the code line as it was.
Selective death
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?

the sex ratio remains close to 50%     the sex ratio climbs up to 75%
the sex control gene remains close to 50%     the sex control gene climbs up to 75%

    

Selective death (2)
Do you understand why?

    

Wasp.gif Bee.gif Ant.gif 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

Mother Daughter Relatedness
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).



    


Mother Son Relatedness
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?

    

Suggestions for further work

    






Runaway selection


le_paon_fait_la_roue_-_jardins_de_bagatelle.jpg 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).

If the risk for females is significant, we observe that Open the file S_Runaway.py (in the Scenarii directory). Locate the start_game function. Observe that both sexes pay a cost.
Open Starter    from the Evolife directory and load the Runaway scenario. Run it and observe that males evolve to invest massively in costly signals. The phenomenon is slightly richer than that. The two genes 'FemaleDemand' and 'MaleInvestment' co-evolve: females compare more males and males compete to please them. The crucial point here is that females have no absolute reference. They just compare males with one another.

Runaway Low Quality Cost
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?

    150 120
    100 80
    70    

    


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).

Runaway binary code
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.

Runaway binary cost
For which minimal value of LowQualityCost do you observe runaway selection?

    300 250
    200 150
    100    

    

Suggestions for further work