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
4
votes
1 answer

python tsp travelling salesman undirected graph

In other posts Networkx was suggested as "my friend". But there doesn't seem to be a ready to use function for a certain solution for the TSP problem. i.e. Creating undirected graphs in Python I have an undirected graph, the suggested solutions are…
lode
  • 504
  • 6
  • 21
3
votes
3 answers

Google Maps create route

I have been searching for some time if it is possible to create route on Google Maps without having start and endpoint, only with way points. I'm trying to show/calculate full route on points user have to visit in right, economic order, but I don't…
johnnyGor
  • 161
  • 1
  • 3
  • 16
3
votes
3 answers

Need help to adapt a genetic algorithm to "solve" Traveling Salesman on Ruby

I just downloaded ai4r library http://ai4r.rubyforge.org/ and i am using the genetic algorithm to get a good route from multiple places, just like this: http://ai4r.rubyforge.org/geneticAlgorithms.html But i need to be able to set a start city. Any…
Bernardo Mendes
  • 1,220
  • 9
  • 15
3
votes
1 answer

How to implement the shortcutting step in the Christofides algorithm?

I am implementing the Christofides algorithm for getting a 3/2-approximation to TSP in graphs that obey the triangle inequality. I already have code for computing a minimum spanning tree using Kruskal's algorithm and an adjacency matrix. Now, I want…
3
votes
1 answer

what does n^O(1/ε) means?

I often find n^O(1/ε) in approximation algorithms. for example, in euclidean tsp, the number of portals(with its possible state) is equal to n^O(1/ε). here is the link to the…
ryan chandra
  • 321
  • 3
  • 11
3
votes
2 answers

How to verify if a graph has crossing edges in networkx?

I am creating a genetic algorithm to solve the traveling salesman problem using python and networkx. And I'm adding a condition to converge to a satisfactory solution: the path must not have crossing edges. I wonder if there's a quick function in…
3
votes
1 answer

Still can't find a way to return to the origin city in the TSP problem

Problem Description : The travelling salesman problem (also called the travelling salesperson problem or TSP) asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route…
3
votes
2 answers

Traveling salesman problem when not all cities are connected and with the possibility of multiple visits

I have a problem to solve that I think is the Traveling Salesman type. I know that the traveling salesman problem most commonly discussed restricts the number of visits in each city to just one visit and that the city must all be accessible from any…
jassis
  • 416
  • 2
  • 12
3
votes
0 answers

2 Shortest Paths in Weighted Directed Graph without Intersection

I will try to make clear analogy: There is a city with N destinations. It is represented by weighted and directed graph where weights are distances as minutes. There are 2 people which don't want to be in same destination at same time. They are…
3
votes
0 answers

Adding 2-opt algorithm to solve the Travelling Salesman Problem in Python

I couldn't find any complete implementation of the 2-opt algorithm in Python so I am trying to add the missing parts in the this project..I want to get best solution.But in this project gives final route with cross path. To fix this I implement two…
3
votes
1 answer

Travelling salesman problem for a tree graph (no hamiltonian path)

Almost broken my head while trying to find algorithm that finds fastest route in graph that pass through ALL graph vertices from start vertex (with no need to return to start edge). I have checked all the main algorithms for graphs and similar…
3
votes
1 answer

List all TSP route combinations (5 vertices)

I want to list all TSP route combinations. There are 5 vertices and thus 10 edges: All the edges are as follows: edges = [('A', 'B'), ('A', 'C'), ('A', 'D'), ('A', 'E'), ('B', 'C'), ('B', 'D'), ('B', 'E'), ('C', 'D'), ('C', 'E'), ('D', 'E')] Note:…
3
votes
1 answer

How to solve a TSP using Concorde?

I have 12 nodes and distance between every pair of nodes (in meters). The nodes refer to different streets in a city. I need to obtain an exact solution of the TSP (not heuristic) so I'd like to solve the TSP problem with the program Concorde, but I…
ollie
  • 33
  • 5
3
votes
4 answers

Branch And Bound Implementation for TSP in Java

I wonder if there is a useful Java implementation of a Branch And Bound algorithm for the TSP or in general a OR framework which includes a BnB for TSP. Thanks for your help! Marco
user212926
3
votes
0 answers

Least roads required for shortest path: Multisource, single destination with shortest path from each source

I have a problem that looks like this: partial solution found I want to calculate the minimum number of roads required to connect all sources (yellow) to the destination (green). However, I also want to ensure that there is the minimum path length…