traveling-salesman

Using A* to solve Travelling Salesman

僤鯓⒐⒋嵵緔 提交于 2019-11-27 11:39:57
问题 I've been tasked to write an implementation of the A* algorithm (heuristics provided) that will solve the travelling salesman problem. I understand the algorithm, it's simple enough, but I just can't see the code that implements it. I mean, I get it. Priority queue for the nodes, sorted by distance + heuristic(node), add the closest node on to the path. The question is, like, what happens if the closest node can't be reached from the previous closest node? How does one actually take a "graph"

TSP - Branch and bound

守給你的承諾、 提交于 2019-11-26 23:28:52
问题 I'm trying to solve the TSP with Branch and bound algorithm. I must build a matrix with costs but I have this problem: I have city with coordinates x and y. The cost of traveling is ceil(ceil(sqrt((x1-x2)^2+(y1-y2)^2))/v) + days spent in the city. V is speed. Days spent in the city depends from day when w comes to the city. For example if we arrived on Monday(t1) to city 1, we stay for 9 days but if we arrived on Tuesday, then we stay in the city for 4 days. x y t1 . t7 city 1. 79 -36 9 4 8 5

Variation of TSP which visits multiple cities

拟墨画扇 提交于 2019-11-26 21:43:04
问题 I am looking to discuss branch and bound solution for TSP with multiple visits.(that is every city needs to be visited atleast once , instead of just once) Edit: Removed the doubt as it was not relevant as pointed by Jitse. Now the question is more clear. 回答1: Simply augment the graph by adding, for each pair of nodes A and B, an edge representing the shortest path from A to B. The Floyd-Warshall algorithm allows you to do this in O(n^3), which is much faster than any TSP algorithm. Once you

What is the problem name for Traveling salesman problem(TSP) without considering going back to starting point?

£可爱£侵袭症+ 提交于 2019-11-26 16:05:31
问题 I would like to know what is the problem name for TSP w/o considering the way of going back to starting point and what is the algorithm to solve this. I looked into Shortest path problem but that is not what I am looking for, the problem only find the shortest path from 2 assigned points. But what I am looking for is the problem which we give n points and inputting only 1 starting point. Then, find the shortest path traveling all points exactly once. (end point can be any point.) I also