This is a model of co-evolutionary dynamics described and thoroughly studied in the context of ecology, economics, coupling population dynamics, game theory and evolutionary innovation to investigate the conditions and properties for the formation of robust ecological communities.
Here is a list of relevant papers describing the model and key features:
-
Modelling coevolution in multispecies communities - J. Theor. Biol.
-
The influence of predator–prey population dynamics on the long-term evolution of food web structure - J. Theor. Biol.
-
The impact of nonlinear functional responses on the long-term evolution of food web structure - J. Theor. Biol.
-
Modelling food webs - Handbook of Graphs and Networks: From the Genome to the Internet
-
Topological structure and interaction strengths in model food webs - Ecol. Model.
-
The robustness of the Webworld model to changes in its structure - Ecological Complexity
-
The characteristics of species in an evolutionary food web model - J. Theor. Biol.
This is a compact python implementation and requires:
- A python implementation >= 3.10.
- Numpy, Numba, Pandas.
The two files webworld.py
and webworld_lib.py
are necessary to run the simulations. The former consists of the main simulation loops, whereas the latter contains the implementations of the necessary functions used to compute species, species features, score matrices, evolutionarily stable strategies as well as the population updates, species addition and removals.
To collect the results and to further processing the function save_matrices
should be invoked to save the arrays at the desired points in the evolution process. The last argument should be one of the set BLOBS
, ARRAY
, ESS
. Which are destination folders, where the data will be written into. I use these names to store the data into corresponding to a specific time-scale. These folders should exists before the simulation is started.
To specify the number of evolutionary events and the rest of the model parameters you must edit the webworld.py
code. Specifically the lines:
#Maximum system size: Nsp
Nsp = 100;
#Traits Pool Size K and Species Length
K = 500; L = 10;
.
.
.
#INITIAL SETUP
#Model Parameters: Resources:R
# Ecological Effciency: ld
# F.response: b
# Competition parameter: c
R = 1e5; ld = 0.1;
b = 5e-3; c = 0.5;
#Initial Population: No
#Minimum population allowed: Nd
No = 1.0; Nd = 1.0;
And the value Ngen
. The simulation will run the specified number of Ngen
time-steps or until the systems evolves a newtwork of size Nsp
. The default values are 50000 and 100.
The code should run by executing:
>>> ./webworld.py
The jupyter notebook fwebs.ipynb
is provided to compute the foodweb structure and plot the results, shown below:
The foodweb structures should look like this.
A live web-version of the code can be found if you click on the image below.
The code is the same as the one provided here, but it should run in the browser. This version is limited to 60 species and 10000 evolutionary steps.
A more detailed and fun discussion of the model and its implementation, as well as many other interesting topics on physics and simulation can be found on my personal website