Code for reproducing the simulations and figures of:
Bingkun Zhao and Li Xie. Environmental feedback sign shapes cooperation and collapse in eco-evolutionary networks. (submitted to Chaos)
The model is a spatial evolutionary game in which each site carries a binary
strategy (cooperate/defect) and a local renewable resource. The resource
changes the reward for mutual cooperation through a signed coupling
lambda: negative feedback (lambda < 0) restores the resource, positive
feedback (lambda > 0) amplifies abundance and depletion alike. The paper
connects the mean-field sign rule sign(det J*) = -sign(lambda) to
finite-size quasi-cycles, collapse fronts, and rescue-cascade transitions
in multiplex networks.
code/— model core: lattice construction, the unified eco-evolutionary simulator (b_eco_unified.py), the mean-field analysis (mean_field.py), and operational observables including the regime classifier (observables.py).experiments/— production run scripts (run_*.py) and figure scripts (plot_fig*.py) for every main and supplementary figure, pluscommon.py(dataset I/O) andpubstyle.py(figure style).
Python 3 with numpy, numba, and matplotlib (developed with numpy 2.x,
numba 0.6x, matplotlib 3.10). No other dependencies.
Each plot_fig*.py script reads an archived dataset
(data/main/<name>.npz) and writes the corresponding figure. Datasets are
not included in this repository; they are available from the corresponding
author upon reasonable request, or can be regenerated with the matching
run_*.py script in --production mode (see the module docstrings for the
figure-to-script mapping and runtimes; the largest ensembles take a few
hours on a single desktop core).
python experiments/plot_fig3_v3.py # main Fig. 1 (phase maps and cuts)
python experiments/plot_fig4_v3.py # main Fig. 2 (quasi-cycles)
python experiments/plot_fig5_v3.py # main Fig. 4 (continuation, CSD)
python experiments/plot_fig_dynamics.py # supplementary Fig. S1
...
Ensembles are seeded per run (default_rng(seed)), so single runs are
bitwise reproducible. The topology and robustness scans seed the Numba RNG
stream once per scan rather than per parameter point, so those two scans
reproduce their statistics but not every individual trajectory bit-for-bit;
this limitation is also stated in the Supplementary Material of the paper.
If you use this code, please cite the paper above.