This project is a simulation of a predator-prey ecosystem. It uses reinforcement learning to model the behavior of the predators and prey. The simulation is built in Python and uses Matplotlib for visualization.
The simulation takes place on a grid. The grid is populated with three types of agents:
- Predators: Predators hunt prey. Their behavior is controlled by a neural network. The neural network is trained using reinforcement learning.
- Prey: Prey wander the grid and eat grass. Their behavior is also controlled by a neural network. The neural network is trained using reinforcement learning.
- Grass: Grass grows on the grid. It is eaten by prey.
The simulation proceeds in discrete time steps. At each time step, each agent takes an action. The actions available to the agents are:
- Move: Move to an adjacent cell on the grid.
- Eat: Eat an agent in the same cell.
- Reproduce: Create a new agent of the same type.
The simulation ends when all the predators or all the prey have died.
To run the simulation, you will need to have Python and the required dependencies installed. You can install the dependencies by running the following command:
pip install -r requirements.txt
Once you have installed the dependencies, you can run the simulation by running the following command:
python Main.py --gridDim 50 --nPredators 100 --nPrey 400 --nGrass 1200
The simulation does not run in a separate window but will output the results to the console and save a plot as Distributions.pdf. You can customize the simulation by changing the command-line arguments. For a full list of arguments, see the Main.py file.
[A video of the simulation will be added here.]
The dependencies for this project are listed in the requirements.txt file.
- Python 3
- NumPy
- Matplotlib
- Pandas