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).

654 questions
37
votes
2 answers

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

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…
A-letubby
  • 6,440
  • 8
  • 34
  • 46
29
votes
8 answers

Travelling Salesman with multiple salesmen?

I have a problem that has been effectively reduced to a Travelling Salesman Problem with multiple salesmen. I have a list of cities to visit from an initial location, and have to visit all cities with a limited number of salesmen. I am trying to…
dustin ledezma
  • 585
  • 2
  • 5
  • 10
27
votes
1 answer

Travelling salesman with a directional constraint

I am trying to order an array of 3D coordinates by their order along a path. A sample: points = np.array([[ 0.81127451, 0.22794118, 0.52009804], [ 0.62986425, 0.4546003 , 0.12971342], [ 0.50666667, …
kwinkunks
  • 4,650
  • 1
  • 15
  • 31
24
votes
6 answers

Travelling salesman with repeat nodes & dynamic weights

Given a list of cities and the cost to fly between each city, I am trying to find the cheapest itinerary that visits all of these cities. I am currently using a MATLAB solution to find the cheapest route, but I'd now like to modify the algorithm to…
del
  • 5,560
  • 8
  • 38
  • 44
23
votes
14 answers

Have you used a traveling salesman algorithm to solve a problem?

I studied TSP in college in the context of NP Completeness. I have never actually had a situation where it would apply to a practical problem. A little bit of research shows that it has been used to pick the cheapest path to move a drill…
EvilTeach
  • 26,577
  • 21
  • 79
  • 136
21
votes
6 answers

Using A* to solve Travelling Salesman

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…
Puppy
  • 138,897
  • 33
  • 232
  • 446
18
votes
7 answers

What's the difference between traveling salesman and chinese traveling?

What's the Difference between traveling-salesman problem and chinese postman problem? For me both wants go to a destination, and then back.
alansiqueira27
  • 6,707
  • 15
  • 52
  • 99
17
votes
5 answers

Optimal map routing with Google Maps

Is there a way using the Google Maps API to get back an "optimized" route given a set of waypoints (in other words, a "good-enough" solution to the traveling salesman problem), or does it always return the route with the points in the specified…
Soldarnal
  • 6,948
  • 9
  • 44
  • 65
16
votes
3 answers

traveling salesman problem, 2-opt algorithm c# implementation

Can someone give me a code sample of 2-opt algorithm for traveling salesman problem. For now im using nearest neighbour to find the path but this method is far from perfect, and after some research i found 2-opt algorithm that would correct that…
TAB
  • 177
  • 1
  • 2
  • 9
14
votes
6 answers

Finding the shortest path to visit all non-blocked squares on a grid

Let's say you have a grid like this (made randomly): Now let's say you have a car starting randomly from one of the while boxes, what would be the shortest path to go through each one of the white boxes? You can visit each white box as many times…
Laz
  • 5,236
  • 9
  • 37
  • 53
13
votes
7 answers

Crossover operation in genetic algorithm for TSP

I'm trying to solve the Travelling Salesman Problem (TSP) with Genetic algorithm. My genome is a permutation of a vertex in graph (path for salesman). How should I perform the crossover operation over my genomes? Where can I find implementations…
12
votes
1 answer

What's wrong with my Hopfield Neural Network solution to the Traveling Salesman Problem?

First off, this is homework. I think it's clear I've made an effort and I'm looking for hints, not code. The problem is the following. The equation of operation has four components for altering a given neuron. A) One part to ensure each city is…
David Kanarek
  • 12,439
  • 5
  • 43
  • 61
12
votes
1 answer

Travelling Salesman in scipy

How do I solve a Travelling Salesman problem in python? I did not find any library, there should be a way using scipy functions for optimization or other libraries. My hacky-extremelly-lazy-pythonic bruteforcing solution is: tsp_solution = min(…
Gioelelm
  • 2,174
  • 2
  • 23
  • 44
12
votes
2 answers

How to fix the start and end points in Travelling Salesmen Problem?

I have a solver that solves normal symmetric TSP problems. The solution means the shortest path via all the nodes with no restriction on which nodes are the first and the last ones in the path. Is there a way to transform the problem so that a…
Jānis Elmeris
  • 1,794
  • 21
  • 39
10
votes
5 answers

Why does adding Crossover to my Genetic Algorithm gives me worse results?

I have implemented a Genetic Algorithm to solve the Traveling Salesman Problem (TSP). When I use only mutation, I find better solutions than when I add in crossover. I know that normal crossover methods do not work for TSP, so I implemented both the…
1
2 3
43 44