Built a pathfinding engine that finds obstacle-avoiding shortest paths between waypoints on a grid, and assembled the pairwise distance matrix that forms the input to the Traveling Salesman Problem.
Problem statement
Given multiple waypoints scattered among obstacles, find shortest point-to-point routes and prepare the data needed to optimize a full visiting tour (TSP).
Approach
- A* search with an admissible Manhattan-distance heuristic (
f = g + h), a heapq priority queue, and open/closed sets; run across all waypoint pairs to build a full distance matrix.
- That shows correct obstacle-avoiding shortest paths for every waypoint pair, a readable distance matrix, and grid visualizations of the computed routes.
- Then, the distance matrix is TSP-ready; solving for the optimal visiting order (e.g. brute-force permutations or nearest-neighbor) is the natural extension.
Technical Details
- Stack - Python · NumPy (grid) · heapq (priority queue) · pandas (matrix) · matplotlib/seaborn (path visualization).
View the notebook on GitHub →