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
3 answers

Traveling Salesman Problem for a large number of vertices

I need to solve TSP for a large number of vertices(30-100) with good accuracy and adequate time(like 1-2 days). My graph can contain asymmetrical edges(g[i][j] not equal g[j][i]). I tried greedy, little(maybe my bad, but that shows worse results…
0
votes
1 answer

How can I use the Traveling Salesperson Problem (TSP) with a List of Haversine Distances?

I have a list of haversine distances between customers and their respective salespersons and I would like to apply the TSP algorithm to optimize each salesperson's distance traveled in a given day. What would be the best approach to solving this…
GodspeedYou77
  • 23
  • 1
  • 7
0
votes
1 answer

Multi-trip VRP with time windows: CPLEX error in solution

I am writing my master thesis en encountering a problem in the MT-VRP-TW solution, with catering flights from depot 1 to 112 flights. There are 11 vehicles available so I am looking for an optimal tour for 11 vehicles. My vehicles make trips, but…
Emma
  • 3
  • 1
0
votes
0 answers

How to join random lines, defined by two points, into a single path? A traveling salesman like problem

I am attempting to generate at single continuous line from a set of lines that have been defined by two points. Currently I generate a subset of random lines as follows: [ [0, 0] [2, 2], [2, 1] [0, 1], [0, 1] [2, 2], ... ] Next, I want to trace…
0
votes
0 answers

Recommend a good heuristic for longest Hamiltonian path in polynomial time

I have a complete weighted graph with 1000 nodes and need to find the longest possible Hamiltonian path in the graph (the sequence of nodes, to be more precise). I am supposed to fit in 5 sec (for Java), the memory limit is big enough. Finding the…
Rnam
  • 65
  • 1
  • 7
0
votes
2 answers

Pass through all cities but allowing forks (traveling salesman who can split himself)

I'm looking for advice or resources to solve a problem similar to TSP but where: forks are allowed, ie. the salesman can duplicate himself on each city; starting and ending locations doesn't matter and can be different. This means, given these…
roipoussiere
  • 5,142
  • 3
  • 28
  • 37
0
votes
1 answer

run the same method of a list of instances in pathos.multiprocessing

I am working on a traveling salesman problem. Given that all agents traverse the same graph to find their own path separately, i am trying to parallelize the path-finding action of agents. the task is for each iteration, all agents start from a…
0
votes
1 answer

How to implement brute force travelling salesman with an incomplete graph?

I have an exam coming up, and something we will be tested on is implementing the travelling salesman problem on undirected, weighted graphs. Here are examples of the type of problems we will be asked to solve: Example…
0
votes
1 answer

Neareast Neuighbor Heuristic for Traveling Salesman Problem in Java

I want to write a java program that solves the traveling salesman problem with the nearest neighbor heuristic. The steps of the algorithm would be something like this: Step 1: Start with any random vertex, call it current vertex Step 2:…
0
votes
1 answer

How to print path in the traveling salesman problem

I was trying to solve the traveling salesman problem using C. I was successfully able to calculate the correct minimum distance, but I cannot seem to be able to generate the corresponding path. Note: I don't need to go back to the first city which…
0
votes
0 answers

How to create chain from pairs in R

edit: added current solution I am dabbling with the Travelling Salesman Problem and am using a solver to calculate the most optimal tour. The output of my linear solver gives me a table with arches in a route, however to plot the tour I require…
Mik3000
  • 1
  • 2
0
votes
1 answer

What Would be the Big O Time Complexity of this Greedy Search for TSP?

I just want some clarification/reassurance, looking at the code on this GitHub here, would the Big O notation for the time complexity by On2, as it is directly proportional to the amount of vertices/cities in the problem?
AxleCat
  • 57
  • 2
  • 9
0
votes
1 answer

Using tabu search how are the neighbours selected for travelling salesman?

When trying to understand how tabu search can be applied to travelling salesman, I have struggle understanding how the neighbourhood is generated. If we look at this pseudocode from wikipedia: sNeighborhood ← getNeighbors(bestCandidate) for…
OultimoCoder
  • 244
  • 2
  • 7
  • 24
0
votes
1 answer

Variables are the same but shouldn't be? Python

I am having some trouble with variables being set as the same when they shouldn't be and I can't figure out why they're doing it. In my case, LCT and MCT are being set as the last route generated in the function, but I only have them being set when…
0
votes
1 answer

Simulated annealing algorithm to solve the traveling salesman problem in Python

So im trying to solve the traveling salesman problem using simulated annealing. I am given a 100x100 matrix that contains the distances between each city, for example, [0][0] would contain 0 since the distances between the first city and itself is…