This repository supplements our paper "A Dynamical Systems Approach to Optimal Foraging"
This repository contains code for the 3 experiments presented in the paper. It is developed using the JAX ecosystem
- Experiment 1 highlights the learning process involved in adaptive patch foraging and analysis of the learned agent at various stages of training.
- Experiment 2 presents an analysis of evidence accumulation mechanism observed in the adaptive agent.
- Experiment 3 presents an analysis of change in average patch residing time of the adaptive agent with respect to change in growth rate of the resources in the environment.
In order to run the code following requirements must be satisfied.
- Python - 3.10.10
- IPython - 8.10.0
- JAX - 0.4.13
- Diffrax - 0.4.0
- Equinox - 0.10.6
- Optax - 0.1.4
- NumPy - 1.26.1
- Matplotlib - 3.6.3
This repository is stuctured as follows
- source
- exp_1_basic_foraging: directory for Experiment 1.
- main.py: A Python script that executes the learning process for different seeds.
- plot_values.ipynb: An IPython notebook to plot the loss curve.
- analysis.ipynb: An IPython notebook to observe the behaviour of agent at various stages of training.
- render.py: A Python Script to render the learned agent.
- exp_2_evidence_accumulation: directory for Experiment 2.
- evidence.ipynb: An IPython notebook to analyse the neuronal dynamics of the learned agent.
- exp_3_diff_growth_rate: directory for Experiment 3.
- growth_rate_08f.py: A Python file for learning in the environment having growth rate of 0.08.
- growth_rate_10f.py: A Python file for learning in the environment having growth rate of 0.1.
- growth_rate_12f.py: A Python file for learning in the environment having growth rate of 0.12.
- growth_rate_time_analysis.ipynb: An IPython notebook to sample and compare average patch residing time for agent trajectories in the 3 environemts.
- avg_growth_rate_plt.ipynb: An IPython notebook to plot the average patch residing time across the 3 environments for the first 3 patch visits.
- exp_1_basic_foraging: directory for Experiment 1.
This software is part of the project Dutch Brain Interface Initiative (DBI2) with project number 024.005.022 of the research programme Gravitation which is (partly) financed by the Dutch Research Council (NWO).
For citing this work you can cite the paper
@article {Chaturvedi2024.01.20.576399,
author = {Siddharth Chaturvedi and Ahmed ElGazzar and Marcel van Gerven},
title = {A Dynamical Systems Approach to Optimal Foraging},
elocation-id = {2024.01.20.576399},
year = {2024},
doi = {10.1101/2024.01.20.576399},
publisher = {Cold Spring Harbor Laboratory},
URL = {https://www.biorxiv.org/content/early/2024/01/22/2024.01.20.576399},
eprint = {https://www.biorxiv.org/content/early/2024/01/22/2024.01.20.576399.full.pdf},
journal = {bioRxiv}
}