ido1Shapira/Oop_Ex2_MazeOfWaze

TSP

Opened this issue · 0 comments

TSP algorithm is a very complicated algorithm meant to answer the question-Given a list of nodes and the distances between each pair of nodes, what is the shortest possible route that visits each node? (it is possible to visit a node more than one time). The only way to solve this question is to check each route that visits all nodes and take the shortest one.
This kind of algorithm would take n! operations.
In our implementation of TSP, we preferred the algorithm to be fast and return a relatively short path over it to return the shortest one.
Our algorithm is a greedy algorithm that always goes to the nearest nodes from where we are now.
After visiting all the needed nodes it returns the path's length.
We try this way of solution every time with a different node and after n rounds we return the shortest path of all.