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
5
votes
2 answers

Using Traveling Salesman Solver to Decide Hamiltonian Path

This is for a project where I'm asked to implement a heuristic for the traveling salesman optimization problem and also the Hamiltonian path or cycle decision problem. I don't need help with the implementation itself, but have a question on the…
5
votes
2 answers

Travelling Salesman and Map/Reduce: Abandon Channel

This is an academic rather than practical question. In the Traveling Salesman Problem, or any other which involves finding a minimum optimization ... if one were using a map/reduce approach it seems like there would be some value to having some…
Jim Dennis
  • 17,054
  • 13
  • 68
  • 116
5
votes
1 answer

Traveling salesman (TSP) with set start and end point

I'm working with a travelling salesman problem using the TSP package in R, but trying to achieve a predetermined start and end point. The package apparently allows setting the start point of the journey, as described here: How to specify a starting…
David Roberts
  • 617
  • 1
  • 11
  • 23
5
votes
1 answer

How to implement a dynamic programming algorithms to TSP in Python?

I want to solve the TSP problem using a dynamic programming algorithm in Python.The problem is: Input: cities represented as a list of points. For example, [(1,2), (0.3, 4.5), (9, 3)...]. The distance between cities is defined as the Euclidean…
5
votes
3 answers

Using Bitmasking in dynamic programming

I am learning about TSP and i came across bit masking to represent all the combination of cities. I don't understand the logic behind it. Please help me in this. #define size 10 //maximum 10 cities #define min(a,b) a>b?b:a #define sizePOW 1024 //…
Bad Coder
  • 866
  • 1
  • 12
  • 27
5
votes
3 answers

A detail question when applying genetic algorithm to traveling salesman

I read various stuff on this and understand the principle and concepts involved, however, none of paper mentions the details of how to calculate the fitness of a chromosome (which represents a route) involving adjacent cities (in the chromosome)…
Simon Hughes
  • 4,739
  • 4
  • 19
  • 12
5
votes
1 answer

If I shortcut an optimal TSP solution, is still optimal?

Let's have a complete undirected metric graph with k nodes; metric graph is a graph that satisfy the triangle inequality, so being w the weight function the for all nodes a, b, c it is true that w(a, c) is less or equal to w(a,b) + w(b,c). Wlog…
Paolo.Bolzoni
  • 2,416
  • 1
  • 18
  • 29
5
votes
3 answers

Suggested GA operators for a TSP problem?

I'm building a genetic algorithm to tackle the traveling salesman problem. Unfortunately, I hit peaks that can sustain for over a thousand generations before mutating out of them and getting better results. What crossover and mutation operators…
5
votes
1 answer

Traveling Salesman with Held and Karp Algorithm

I am well aware of the DP solution to the traveling salesman problem; also known as the Held and Karp algorithm for TSP. I have implemented it with bitmask, and it's something like this: int TSP(int pos, int bitmask) { if (bitmask ==…
boxme
  • 187
  • 1
  • 6
  • 14
5
votes
2 answers

Simulated Annealing TSP

I'm looking to implement the simulated annealing algorithm in Java to find an optimal route for the Travelling Salesman Problem, so far I have implemented brute force and am looking to modify that code in order to use simulated annealing. Obviously…
5
votes
5 answers

Travelling salesman with a few constraints

I'm trying to find the most optimal way to driving through points say A, B, C and D with some additional constraints - certain points have to be reached before others. Say D has to be reached before B. In other words ordering for some of the…
5
votes
4 answers

Travelling Salesman Shipping Depreciating Items to Different Markets

What would be a good heuristic to use to solve the following challenge? Quality Blimps Inc. is looking to expand their sales to other cities (N), so they hired you as a salesman to fly to other cities to sell blimps. Blimps can be expensive to…
Ari
  • 1,974
  • 19
  • 30
5
votes
1 answer

Brute force algorithm for the Traveling Salesman Problem in Java

I'm working on a project for a math class at school, and I chose to do mine on the Traveling Salesman Problem, something I've always wanted to investigate more. However, I'm having problems with my brute force solving algorithm. *Please go to the…
null
  • 153
  • 1
  • 3
  • 16
4
votes
1 answer

The Travelling Salesman Problem Using Genetic Algorithm

I was looking to learn about AI and found the traveling salesman problem very interesting. I also wanted to learn about genetic algorithms, so it was a fantastic combo. The task is to find the shortest distance traveling from id 1 to each location…
4
votes
2 answers

Traveling Salesman Problem with additional partial ordering

I am looking for a name for this problem or any leads on an algorithm or source code: Example: You want to find the best route to visit the 100 largest cities in the US (classic TSP) but before you can visit any given city you must visit the…
Ben Jackson
  • 90,079
  • 9
  • 98
  • 150