An interactive Python tool for exploring different path planning algorithms in a grid-based environment — featuring A*, Ant Colony Optimization (ACO), and Held-Karp.
This project provides a visual and configurable platform to simulate and compare pathfinding techniques across three task settings:
- Shortest Path: A* search between a start and goal position.
- Waypoint Navigation: Travel through a user-defined set of waypoints using Held-Karp or ACO.
- Relief-Aware Pathfinding: Navigate a terrain with elevation, adjusting path preferences based on terrain flatness.
Great for educational, experimentation, and demonstration purposes!
Install all required dependencies with:
pip install -r requirements.txt
⚠️ requirements-dev.txtis used only for internal development/testing — it can be ignored.
Run the app with:
python main.pyTo explore the available options:
python main.py --help--window_size: GUI window size (default: 700x700 pixels).--rows: Grid size (rows = cols).--K: Heuristic weight for terrain influence in relief tasks.--deterministic_waypoints: Use Held-Karp for optimal waypoint path (default is ACO).--epochs,--number_ants,--rho,--Q,--alpha,--beta,--ini_pheromone: ACO hyperparameters.
Use A* to find the shortest path from start to goal.
- Left-click to place start, goal, and obstacles.
- Right-click to remove them.
- Press
Spaceto run A*. - Press
Cto clear the grid.
Color scheme:
- Start: 🟣 | Goal: 🟢 | Obstacles: ⚫
- Open nodes: 🔵 (light) | Closed nodes: 🔵 (dark) | Path: 🟩
| Default Grid | Solved Path |
|---|---|
![]() |
![]() |
Find the optimal route from start to goal while visiting a number of intermediate waypoints.
- Left-click to set start, goal, and waypoints.
- Use either:
- Held-Karp for guaranteed optimality.
- Ant Colony Optimization as a heuristic.
- Press
Spaceto run algorithm. - Press
Cto reset.
ACO defaults:
- Epochs: 100, Ants: 10, ρ: 0.1, Q: 1, α: 1, β: 1, Initial pheromone: 1
| Default Grid | Solved Path |
|---|---|
![]() |
![]() |
In this scenario, the grid has elevation — requiring the algorithm to trade off between path length and terrain flatness.
- Left-click to raise terrain.
- Right-click to lower it.
--Kcontrols the trade-off:K=0: prioritize shortest path (ignore relief)K=1: prioritize flatness
| Terrain Map | K=0 Result | K=1 Result |
|---|---|---|
![]() |
![]() |
![]() |
- Switching to Waypoint Task a second time may cause UI input to freeze — restart as a workaround.
- Holding clicks too long can result in unintended cell changes.
- Performance degradation with >30 waypoints is due to path reconstruction inefficiencies, not algorithmic limitations.
- ACO performance depends heavily on hyperparameters, which may require tuning.
For a full explanation of the algorithms and design rationale, see report.pdf.






