An interactive web application that solves and visualizes the Traveling Salesman Problem (TSP) using the A* algorithm with Minimum Spanning Tree heuristics.
- Interactive Visualization: Real-time display of cities and optimal paths on an interactive map
- File Support: Upload and process standard
.tsp
format files - Advanced Algorithm: Implementation of A* search with MST heuristic for efficient pathfinding
- Performance Optimization: Efficient handling of problems with hundreds of cities
- Node.js (v14 or higher)
- npm or yarn package manager
- Clone the repository:
git clone https://github.com/your-username/tsp-solver.git
cd tsp-solver
- Install dependencies:
npm install
# or
yarn install
- Start the development server:
npm start
# or
yarn start
The solver uses the A* algorithm enhanced with a Minimum Spanning Tree (MST) heuristic:
-
MST Heuristic Calculation
- Creates a minimal-cost tree connecting all cities using Kruskal's algorithm
- Provides a lower bound estimate for remaining path costs
-
A Search Process*
- Starts from an initial city
- Iteratively selects optimal next cities based on combined actual and estimated costs
- Uses the MST heuristic to guide path selection
- Frontend: React.js for the user interface
- Calculations:
mathjs
library for distance computations - Graph Operations:
graphlib
for efficient graph management
-
Load Your Data
- Upload a
.tsp
file through the interface - Or select from provided example problems
- Upload a
-
Configure Settings
- Select the MST heuristic option
- Adjust any visualization preferences
-
Solve and Visualize
- Click "Solve TSP" to start the algorithm
- Watch the solution path develop in real-time
- View final route and total distance
The /public/tspProblems
directory includes sample datasets:
File | Cities | Description |
---|---|---|
att48.tsp |
48 | Standard TSPLIB problem |
ulysses16.tsp |
16 | Smaller dataset for testing |
a280.tsp |
280 | Larger challenge problem |
- Implement Ant Colony Optimization algorithm
- Add dynamic heuristic selection
- Develop backend service for larger datasets
- Add support for custom constraints
- Implement parallel processing for performance
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request