A Processing application that visualizes the classic Traveling Salesman Problem (TSP) using a brute-force approach to find the optimal route between cities.
- Processing 4.0+
- Java 8 or higher
-
Clone this repository:
git clone https://github.com/Jimmyu2foru18/Traveling-Salesman.git
-
Open the project in Processing:
- Launch Processing IDE
- File -> Open -> Navigate to
Traveling_Salesman.pde
- Click the "Run" button in Processing IDE, or press
Ctrl + R
(Windows/Linux) orCmd + R
(Mac) - The application will:
- Generate 10 random cities
- Calculate the optimal route
- Display an animation of the route
Traveling_Salesman.java
- Main application codeInstructions.md
- Detailed documentation of how the application worksREADME.md
- This file
The application:
- Generates random cities on an 800x800 canvas
- Uses a brute-force algorithm to find the shortest possible route
- Visualizes the route with:
- Black dots representing cities
- Red lines showing the optimal path
- Blue dot animating the journey between cities
- Due to the brute-force approach, the application works best with 10 or fewer cities
- Performance decreases exponentially with additional cities due to factorial time complexity
- Based on the Traveling Salesman Problem, a classic computer science challenge
- Built with Processing, a flexible software sketchbook