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

Program hangs in console while giving large input size in c++

I am trying to solve the travelling salesman problem using Brute Force procedure by checking all possible permutations. I have done it in c++. The main problem is this: the code works well for small input size. But when I am giving a file containing…
user6663837
0
votes
1 answer

Optimal search path strategy

I am trying to determine the optimal search strategy for the problem stated below. I have to search a raster in order to localize an object with unknown position. I assume that the optimal route to search for this object can be solved using TSP, if…
Niko
  • 341
  • 1
  • 8
0
votes
1 answer

converting 2 opt swap to 3 opt swap

I'm writing a 3-opt algorithm for the travelling salesman problem, i already got 2-opt working and im trying to convert it to 3-opt. I don't get how to swap the 3 points, can anyone help me? my code: private void ThreeOptSwap(int i, int k, int l) { …
David M
  • 198
  • 1
  • 5
0
votes
1 answer

TSP matrix why is my result always 0?

I'm working on my traveling sales program(without the use of the STL) I know this shouldn't be giving me the correct answer. I'm trying to make sure my matrix is being loaded correctly first. Can anyone see the problem here? I always get 0 for the…
Remixt
  • 597
  • 6
  • 28
0
votes
1 answer

How do I take in "standard input commands" and then know when to continue running the program?

I'm working on a traveling sales person program in C++. I'm very new to C++ and its so much different from Java that the simple things really get confusing. How do I use standard input to accept commands from a file (apparently I don't open the…
Remixt
  • 597
  • 6
  • 28
0
votes
1 answer

Algorithm Query - Multiple Drivers, Multiple Locations

I'm honestly not sure where / what to post this as, but I will be very grateful to anyone for any advice that you may be able to provide. I am looking to create an algorithm which will calculate the most optimal schedule for a taxi (long-distance…
Scott
  • 86
  • 1
  • 12
0
votes
1 answer

Route for appointment locations based on distance and appointment time

I want to develop an algorithm which taken in location and appointment times of different places a person needs to visit starting from his/her office. After completing all the appointment visits, this person must come back to the office. I want to…
0
votes
1 answer

Calculate track from location points without time

I've got a bunch of points [ID, lat, lon, time] but the time is unreliable. The time for a couple points is often mixed up and there are some large gaps. I want to be able to calculate a track (basically just a linear-fit or polyfit) from the points…
RedM
  • 344
  • 2
  • 15
0
votes
1 answer

Close-Enough TSP implementation

I'm looking for a solution to a Close-Enough Traveling Salesman Problem (CETSP) where I have a set of nodes that I need to visit all within a certain distance of optimally. I've found a couple of sources for some approaches towards this TSP variant…
Kev
  • 11
  • 1
  • 4
0
votes
1 answer

Prolog: Recursion on a list with one one-time rule

Most probably I couldn't properly phrase my search keywords. What I'm trying to do is to recursively evaluate difference of consecutive entries in a list and keep adding them to a global counter. The challenge is the circular clause in the end so…
Donbhupi
  • 222
  • 5
  • 18
0
votes
1 answer

How efficient is a common TSP algorithm compared to a random route?

I was just looking at some TSP algorithms the other day and wondered how efficient a common TSP algorithm (like Christofides' algorithm) is compared to a random route for say a thousand points. If I'd know the answer or, even better, knew a way to…
Mastrem
  • 225
  • 2
  • 9
0
votes
1 answer

A* Search implementation for the "Travelling Salesman P"

I've been struggling for a long time after writing my A* Search algorithm with the fact that when the number of cities is greater than 8, the algorithm won't return any answer (or is ridiculously slow). The cities are stored in a 2-d array where…
Jaiymo
  • 9
  • 2
0
votes
1 answer

Diffrence between ATSP and TSP

this might be a slightly foolish question, but what is the exact diffrence in solving TSP and ATSP. I've always thought that in ATSP you need to compute the way back(since the input matrix is assymetric). So the path for ATSP is twice as long as…
Greenmachine
  • 292
  • 1
  • 15
0
votes
1 answer

optimizing Brute-force TSP solution

I'm working on a small project for solving TSP but am experiencing a problem. The idea is to optimize a local part of a non-optimal path by simply finding the best combination. This is accomplished by a simple recursive permutation generating…
Greenmachine
  • 292
  • 1
  • 15
0
votes
1 answer

Why is my Shortest Hamiltonian Path algorithm suboptimal?

I was trying to code up a brute force algorithm in Python from scratch that solves the Shortest Hamiltonian Path problem for a weighted complete graph as follows: def min_route(cities, distances): """Finds the Shortest Hamiltonian Path for a…
Adriano
  • 1,697
  • 24
  • 27