Questions tagged [traveling-salesman]

The "traveling salesman problem" is a classical computer science problem which involves finding the shortest path which could be taken by a hypothetical salesman to make a single visit to each location on a map (in a graph).

The traveling salesman problem (often referred to by its initials: TSP) is one of the most well known "hard" (NP-complete) problems in classical computer science. Simply stated, it involves finding the shortest path which could be taken by a hypothetical salesman to make a single visit to each location on a map (in a graph).

732 questions
0
votes
0 answers

Gurobi JAVA subtour elimination constraints in the TSP

Actually, what I'm trying is the selective TSP which connects tour with not entire nodes under specific condition.(Example: if there are 20 nodes, this problem will select 12 nodes to make tour) And I copied this subtour elimination code from…
hjsg1010
  • 165
  • 3
  • 13
0
votes
0 answers

Infinite loop in Basic Greedy Algorithm for TSP

I am trying to implement basic greedy algorithm for Travelling Salesman Problem in Python 2.7. I have a dictionary called d_dict = {(city1,city2):distance} that stores distances between cities. Here, all cities are connected to one another. I simply…
singhuist
  • 302
  • 1
  • 6
  • 17
0
votes
0 answers

TSP taking into account shapes of cities

I'm looking for a solution of symmetric Traveling Salesman Problem in which we take into account shapes of cities. For example, in the graph from geeksforgeeks.org, the shortest path is 1-2-4-3-1 We can imagine that cities aren't points but e.g.…
trojek
  • 3,078
  • 2
  • 29
  • 52
0
votes
1 answer

How to do a math optimization (TSP) in R, perhaps with optim()

I’m working on creating a basic traveling salesman problem (TSP) in R, but I haven’t found the right resources to help me use optim() with imported data. Or perhaps optim() is not really what I am looking for. I’ll share my example and hope that…
windyvation
  • 497
  • 3
  • 13
0
votes
1 answer

TSP with a twist

I've encountered a problem that is very similar to the Traveling Salesman Problem, except with a few twists: You are able to visit the same node multiple times Traveling an edge that you have already traversed before is costless The graph is…
0
votes
2 answers

Heuristics for the Asymmetric Traveling Salesman

I am using A* in order to solve the Asymmetric Traveling Salesman problem. My state representation has 4 variables: 1 - Visited cities (List) 2 - Unvisitied cities (List) 3 - Current City (Integer) 4 - Current Cost (Integer) However, even tho I find…
0
votes
1 answer

Optimal and efficient ways to solve a very simple variant of Multiple Traveling Salesman

I have two nx2 matrices of doubles, A & B containing x and y coordinates in each row. I have to pair one point from A with one point from B such that its done optimally in terms of euclidean distance heuristic meaning suppose A contains people…
user_1_1_1
  • 903
  • 1
  • 12
  • 27
0
votes
1 answer

Is there an algorithm for computing permutation of distances?

This is related to travelling salesman problem. First all permutations need to be generated and then the destination (same as origin) attached. I.e.: 1) abcd abdc .... 2) abcda abdca ....a I have all the distances and only need an algorithm to sum…
0
votes
1 answer

Translating Python Code from gurobipy to PuLP in Python

I'm new to PuLP and LP in general. While translating the code meant for gurobipi library so it can be used with PuLP, I am stuck at the following gurobipy code which creates the variables. # Create variables. # x[i, j] is 1 if the edge i->j is on…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
0
votes
2 answers

Solve Travelling Salesman once you know the distance of the shortest possible route

I am trying to solve the TSP (Travelling Salesman Problem), but not in a traditional way. I am following these steps. 1) First I change the TSP to a true / false problem. The definition of this problem is now: "Is there a route by all the cities…
Santiago Gil
  • 1,292
  • 7
  • 21
  • 52
0
votes
1 answer

How to to optimize more than 10 addresses using google-maps api v3

So, this will be pretty straight forward question. I have function in helper class to fetch optimized (or not) route using maps API. public static JObject CalcRoute(string origin, string destination, string[] waypoints) { var…
Kadaj
  • 615
  • 3
  • 13
  • 31
0
votes
3 answers

Improve A star algorithm to search multiple goals in a maze

If I have finished implementing the A* algorithm in a maze for finding the shortest path to a single goal(just like the pacman game), how should I improve my current heuristic(manhattan distance to the goal + traveling cost so far from the start) so…
Deidara
  • 667
  • 2
  • 13
  • 28
0
votes
1 answer

Traveling Salesman On Boolean Matrix

I'm looking for some advice on how to tackle this problem. You're given a binary matrix of 1s and 0s, and the goal is to find the shortest path that visits every 1. For example: 1 0 0 0 0 0 1 0 1 0 1 1 0 0 0 1 The shortest path (I think) to…
0
votes
1 answer

How does Uber Pool do routing (or how should they)?

Uber Pool purportedly "allows you to share your ride and split the cost of your trip with another Uber rider headed in the same direction," and yet this seems like a rather inefficient routing method. The problem being solved is which route, when…
TheEnvironmentalist
  • 2,694
  • 2
  • 19
  • 46
0
votes
0 answers

Finding approximation ratio of an algorithm

I am trying to find the solution of the traveling salesman problem using various techniques. I have tested my code for some sample data. The optimal solution is known. Now I want to find the approximation ratio of my algorithm. how will I do that?…
AAA
  • 87
  • 3
  • 9