https://github.com/kikoveiga/feup-da2
Algorithm Design (DA) Second Project (2022/2023): BSc in Informatics and Computing Engineering @ FEUP
https://github.com/kikoveiga/feup-da2
cpp feup feup-da feup-leic tsp tsp-solver
Last synced: 10 months ago
JSON representation
Algorithm Design (DA) Second Project (2022/2023): BSc in Informatics and Computing Engineering @ FEUP
- Host: GitHub
- URL: https://github.com/kikoveiga/feup-da2
- Owner: kikoveiga
- Created: 2023-04-28T15:40:36.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-07T19:27:44.000Z (over 2 years ago)
- Last Synced: 2025-02-03T07:46:00.703Z (11 months ago)
- Topics: cpp, feup, feup-da, feup-leic, tsp, tsp-solver
- Language: HTML
- Homepage: https://sigarra.up.pt/feup/en/ucurr_geral.ficha_uc_view?pv_ocorrencia_id=501678
- Size: 12.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Project 2 - Travelling Salesman Problem
Project made by:
Pedro Vidal Marcelino - up202108754@up.pt
Jose Francisco Reis Pedreiras Neves Veiga - up202108753@up.pt
Antonio Marujo Rama - up202108801@up.pt
This project was done for the Design of Algorithms curricular unit @ **FEUP - Faculdade de Engenharia da Universidade do Porto**.
It implements different algorithms and heuristics for solving the Traveling Salesman Problem (TSP) using C++ and provides a menu-based interface to interact with the algorithms and compare their performance on various graphs.
Algorithms Implemented
**TSP Backtracking** - It gives the optimal solution, efficient for small graphs.
**Kruskal and Prim** - Algorithms designed to find the Minimum Spanning Tree (MST) of the graph that help in other algorithms such as **Christofides** and Greedy Heuristics.
**TSP 2 Approximation Heuristic** - Relies on the triangular inequality, guarantees a ratio of at most 2 times the optimal solution.
**TSP Nearest Neighbor Heuristic** - Greedy heuristic which always chooses the next cheapest node to visit, similar to Prim's algorithm.
**TSP Greedy Heuristic** - Another greedy heuristic which always chooses the cheapest edge, similar to Kruskal's algorithm. Implemented with a priority queue and used in complete graphs.
**TSP 1 Tree Lower Bound** - Algorithm that calculates the largest MST with Prim after removing each node. Finds the best lower bound for the optimal solution.
**Christofides Algorithm** - Maybe the best algorithm for finding an approximation for the optimal solution in an efficient way in complete graphs. Guarantees a ratio of at most 1.5 times the optimal solution.
**TSP 2 Opt Improvement** - Algorithm that takes a TSP path as input and, using local search, keeps swapping pairs of nodes until it doesn't find a better path. Improves many of the above algorithms' solutions.
**Other Functions** - Other functions implemented to parse the information given on the csv files, the **Haversine** function for finding the distance between two geographical locations, and other algorithms.
Results
