This project provides a visual demo of the Bee Colony Optimization (BCO) algorithm solving the Traveling Salesman Problem (TSP) with varying levels of graph complexity. You can switch between simple, moderate, and complex graphs and observe how bee agents traverse the cities to find the shortest path.
- Configurable Complexity: Choose between three levels of complexity:
A(simple),B(moderate), andC(complex). - Dynamic Visuals: Watch as the bee agents explore cities, move along edges, and iteratively optimize their routes.
- Stopping Condition: The demo automatically stops once the optimal solution is found (no improvements for multiple iterations).
First, clone the project repository:
git clone <repository_url>
cd <repository_name>For macOS/Linux:
python3 -m venv venv
source venv/bin/activateFor Widnows:
del /s /q *.*Once the virtual environment is activated, install the required dependencies:
pip install -r requirements.txtTo run the demo, use the following command:
python3 bco_visualisation.py [A|B|C]Where:
- A runs the visualization in simple mode (fewer cities, visible edge weights).
- B runs the visualization in moderate mode (more cities, no edge weights).
- C runs the visualization in complex mode (maximum number of cities, no edge weights).
- bco_visualisation.py: The main script for running the BCO visualization.
- requirements.txt: A list of dependencies required for the project.
- README.md: Project instructions and information.
- Ensure your virtual environment is activated before installing dependencies.
- Make sure all dependencies are installed with pip install -r requirements.txt.
- If the visualization doesn’t appear, try upgrading matplotlib:
pip install --upgrade matplotlib