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

Optimizing a Traveling Salesman Algorithm (Time Traveler Algorithm)

I try to optimize a simple python algorithm I made that approximately solve the Traveling Salesman Problem : import math import random import matplotlib.pyplot as plt import datetime #Distance between two point def distance(point1, point2): …
4
votes
1 answer

OR-Tools solve traveling salesman (TSP) without returning to the home node

I'm using Google Or-Tools to solve a Traveling Salesman Problem by using this example (basically I just replaced the distances matrix with mine). As in the example, I set data['depot'] = 0. For my application it is not important to return to the…
gilad
  • 426
  • 1
  • 5
  • 15
4
votes
2 answers

Pickup and Delivery Problem Algorithm Help

Let's assume food delivery for multiple restaurants (say 20). There are (say 10) drivers available. Further, let's say we get 100 orders over a 4 hour period to deliver food from these restaurants to homes. So drivers have to be coordinated to…
pmah
  • 157
  • 1
  • 2
  • 8
4
votes
1 answer

TSP, algorithm gets stuck in local minimum

I am struggling to implement a program based on simulated annealing to solve the traveling salesman problem. All solutions I got are not satisfying and i have no clue how to improve my implementation. Obviously I'm not focusing on benchmarks, but…
4
votes
1 answer

CVRPTW with Precedences amd vehicle failure in OptaPlanner

I have a problem and it is really hard for me to manage it. I want to use OptaPlanner to solve a CVRPTW with Precedences and vehicle failures. What I have done so far is to get the standard example and solve it in the GUI, and then save the results.…
4
votes
0 answers

Vehicle Routing(VRP) with Optaplanner

I'm customizing provided Optaplanner VRP example to my needs. I'm stuck with the Vehicle Capacity problem. Capacity = Maximum hours available to a vehicle in a day(X hours) Overview - Vehicles need to be scheduled for Time Windowed Customers. We…
4
votes
4 answers

Reading in TSP file Python

I need to figure out how to read in this data of the filename 'berlin52.tsp' This is the format I'm using NAME: berlin52 TYPE: TSP COMMENT: 52 locations in Berlin (Groetschel) DIMENSION : 52 EDGE_WEIGHT_TYPE : EUC_2D NODE_COORD_SECTION 1 565.0…
Leggerless
  • 321
  • 4
  • 16
4
votes
2 answers

Traveling salesman library using approximation algorithm

I'm currently doing a project that requires some fast TSP solving (about 50-100 nodes in 2 seconds). There are a lots of approximation algorithms out there, but I don't have time nor will to analyze them and code them myself. Are there any free…
bezmax
  • 25,562
  • 10
  • 53
  • 84
4
votes
1 answer

Is generating all strings permutation NP Complete?

Calculating all string permutations of a given string can be solved in O(n!) by trying all possibilities. Now, looking at the Travel Salesman Problem, we can solve it by trying all permutations of cities. Lets say we have cities A, B and C. Lets say…
fredcrs
  • 3,558
  • 7
  • 33
  • 55
4
votes
3 answers

Algorithm to generate TSP solutions randomly

The most common heuristics to solve the TSP problem (in particular the Kernighan–Lin heuristic) require to work on a randomly generated tour and to improve the solution starting from that. However, the only way I came up with to do that is to…
skd
  • 1,865
  • 1
  • 21
  • 29
4
votes
2 answers

PTAS implementation for Euclidian TSP?

I'm willing to implement an algorithm to solve the 2-dimensional Euclidian version of the Traveling Salesman Problem in the most efficient way (i.e. most accurate result + least time). While doing my research I found plenty of algorithms but Arora's…
4
votes
1 answer

TSP for Complete Directed Graph

Does there exist a polynomial time algorithm for Travelling Salesman Problem on complete directed graph?
Unknown
  • 53
  • 1
  • 5
4
votes
2 answers

TSP Where Vertices Can be Visited Multiple Times

I am looking to solve a problem where I have a weighted directed graph and I must start at the origin, visit all vertices at least once and return to the origin in the shortest path possible. Essentially this would be a classic example of TSP,…
Alk
  • 5,215
  • 8
  • 47
  • 116
4
votes
1 answer

Which approach produces the shorter tour in the TSP problem: nearest neighbour or genetic algorithms?

Over the last few days I have noted a few web sites that demonstrated TS solution using genetic algorithms. Which is approach produces the shorter tour in the TSP problem: nearest neighbour or genetic algorithms?
4
votes
1 answer

Google Directions API One Way instead of Origin and Destination

I'm using google's directions API to solve TSP. Is there any way to take advantage of google's route optimization without providing an origin AND destination. For my purposes, I only care to set the origin. The destination can be whatever is best…