This project explores various approaches to solve the Traveling Salesman Problem (TSP), one of the most famous NP-Hard problems in computer science and operations research. We implement and compare exact methods, heuristics, metaheuristics, and matheuristics to find optimal or near-optimal solutions for TSP instances.
- Francesco Biscaccia Carrara
- Riccardo Modolo @RickSrick
Department of Information Engineering, University of Padua
Academic Year: 2023/2024
The TSP is defined on a graph
- Bender's Loop: Iteratively adds subtour elimination constraints.
- Branch and Cut: Utilizes IBM ILOG CPLEX with custom callbacks.
- Nearest Neighbors: A greedy approach for quick solutions.
- 2-OPT: Improves existing tours by swapping edges.
- Tabu Search: Explores the solution space while avoiding cycles.
- Variable Neighborhood Search (VNS): Uses the concept of systematic change of neighborhood.
- Diving: Fixes some variables to guide the MIP solver.
- Local Branching: Provides flexibility in the number of variables to change.
The project is primarily implemented in C for performance, with Python scripts for analysis and visualization.
- Exact Methods: Optimal for instances with ≤300 nodes
- Matheuristics: Best trade-off for 1000-4000 nodes
- Heuristics: Recommended for large instances (10K-50K nodes)
Our performance profiles and comparisons show:
- VNS often outperforms Tabu Search
- Local Branching is competitive with Branch and Cut for shorter time limits
- Weighted Diving generally performs better than Random Diving
Use the provided Makefile:
makeThis generates the main executable.
./main -n <nodes> -s <seed> -t <time_limit> -a <algorithm>where:
<nodes>: The number of nodes in the graph.<seed>: The random seed used to generate a random TSP instance.<time_limit>: The maximum execution time in seconds.<algorithm>: The algorithm to be used, such as nn, 2opt, tabu, vns, diving, or localbranching.
Use the Python scripts for visualization and analysis:
python3 plot/plot_solution.py input/<input_file>
python3 launch_test/perfprof.py <input_path> <output_path>.<extension>- C compiler
- Python 3.x
- IBM ILOG CPLEX Optimization Studio (for exact methods)
- Python libraries: matplotlib, numpy
- Enhance VNS performance by utilizing the history of applied kicks
- Introduce "memory" to the Local Branching algorithm
- Apply Machine Learning to optimize the application of the g2opt routine
- Explore the effectiveness of these algorithms on various TSP variants
This project is licensed under the MIT License with a Non-Commercial Clause - see the LICENSE file for details.
💡 For more details, please refer to the full report or contact the authors.