https://github.com/carlosagalicia/sheep-shepherd-simulation
This project implements a multi-agent simulation using the Mesa framework to model the behavior of shepherd agents interacting with sheeps and the environment.
https://github.com/carlosagalicia/sheep-shepherd-simulation
agent-based-modeling matplotlib mesa python simulation
Last synced: 26 days ago
JSON representation
This project implements a multi-agent simulation using the Mesa framework to model the behavior of shepherd agents interacting with sheeps and the environment.
- Host: GitHub
- URL: https://github.com/carlosagalicia/sheep-shepherd-simulation
- Owner: carlosagalicia
- License: mit
- Created: 2024-12-27T22:33:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-28T01:01:57.000Z (over 1 year ago)
- Last Synced: 2025-03-03T01:41:38.121Z (over 1 year ago)
- Topics: agent-based-modeling, matplotlib, mesa, python, simulation
- Language: Jupyter Notebook
- Homepage:
- Size: 5.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Sheep-Shepherd-Simulation
This project implements a multi-agent simulation using the Mesa framework to model the behavior of shepherd agents interacting with sheeps and the environment. The simulation includes collecting and moving sheep within a grid environment.
## Overview
- **Functionality:** The simulation models shepherd agents that move within a grid to collect sheep and deposit them in specified locations. The environment uses a grid representation to track the positions of agents and sheep in real time.
- **Objective:** To study agent-based modeling techniques and understand decision-making and resource management within a simulated environment.
## Key Learning Areas
### 1. Agent-Based Modeling
- **Agent Behavior:** Implementation of autonomous agents with unique behaviors, such as moving randomly or based on environmental conditions.
- **Environment Interaction:** Agents interact with a grid environment, collecting and depositing sheep based on specific rules.
### 2. Mesa Framework
- **SingleGrid:** Used to represent the environment where agents interact, ensuring only one agent per cell.
- **RandomActivation:** Implements simultaneous activation of all agents in each simulation step.
- **Data Collection:** Utilizes Mesa’s DataCollector to track simulation progress and gather metrics.
### 3. Real-Time Visualization
- **Matplotlib Integration:** Visualizes agent movements and environment changes with animations using Matplotlib.
- **Interactive Visualization:** Enables analysis of simulation dynamics through graphical representations.
## Languages and Tools Used
### Python
- **Mesa:** Framework for agent-based modeling.
- **Matplotlib:** For creating animations and visualizing the simulation.
- **NumPy & Pandas:** For numerical operations and data analysis.
## Installation and Usage
### Requirements
- **Python 3.x** to run the script.
- **Required Libraries:**
```bash
pip install mesa matplotlib numpy pandas
```
## Instructions
1. Clone the repository
```bash
git clone https://github.com/carlosagalicia/Sheep-Shepherd-Simulation.git
```
2. Navigate to the project directory and run the notebook:
```bash
jupyter notebook sheep-shepherd.ipynb
```
3. Follow the instructions in the notebook to execute the simulation.
## Operation
- The shepherd agents move within the grid, collecting sheep from one location and depositing them in another.
- Agents make decisions based on their surroundings, including whether to move, pick up, or drop off sheep.
- The simulation updates the grid environment in real time and visualizes the process.
## Usage
- Adjust simulation parameters in the notebook to explore different scenarios.
- Run all cells in the notebook to start the simulation.
## Visual Representation
Ungrouped Sheep (initial state)
Grouped Sheep (final state)