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

Travelling Salesman (Brute Force)

I am writing a travelling salesman program, which is to calculate distance between all the points and determine the shortest distance using the BRUTE Force method. This is not homework :) My approach is to generate all the possible points…
Lim Zheng Yue
  • 51
  • 2
  • 6
-2
votes
2 answers

Travelling Salesman : How could one preprocess a graph?

Say we wanna compute the TSP for a given, complete graph G with V vertices and E edges (by complete I mean : every vertex is connected with every other vertex). I'll try to ask the question again. Hopefully I'll get it right this time. My goal is…
Fatso
  • 1,190
  • 15
  • 44
-2
votes
1 answer

Rust: branch and bound in TSP elusive bug

I could use your help once again. I implemented a branch and bound solution to TSP problem and stumbled up a bug... been few hours now and I still dont understand it. The strangest thing is: city 0 is visited first and yet at the end of the log it…
ArekBulski
  • 3,197
  • 2
  • 26
  • 44
-2
votes
1 answer

Travel Sales man algorithm without returning to the starting point

Hi i have found the travelling salesman algorithm in python. But i want a different version where salesman will not return to the starting position. The path should be the shortest. Please suggest the solution. I also tried the Held-Karp (this uses…
dev21
  • 470
  • 2
  • 7
  • 21
-2
votes
1 answer

What is the best algorithm for travelling sales man problem in case of there is few cites(lower than 6)?

i have seen many solution that try to solve the problem of travelling salesman problem if p!=np ,but i want to know the optimum solution if there is 6 or 5 cities only,which algorithm will give the optimum solution in this case?
-2
votes
1 answer

A function does not take all values of a list when I pass it as a parameter

I have two lists l=[0,1,7,10] and ll=[1,7,10], I want to use this lists as parameters of a function, the function uses this lists, ll, and l, in "for" cycles to iterate. When I pass the list my function does not take all the elements, specifically…
Héctor Alonso
  • 91
  • 1
  • 2
  • 10
-2
votes
1 answer

Useful algorithms for TSP

I'm currently working on TSP which has been given to me as my end of year project in my computer science course. In this problem we are given a list of the top 1000 colleges in the world. Then starting at our own colleges, we have to travel to all…
user7010212
-2
votes
1 answer

How do I access this variable in my code?

This is my code for simulated annealing to solve the travelling salesman problem. The comments should describe what's going on. For some reason, the algorithm prints out the best tour LENGTH it finds, but not the actual tour itself. If I were to add…
Sid Jones
  • 35
  • 1
  • 7
-2
votes
2 answers

How to design an unsupervised neural network that does not do input classification?

I've read a lot about neural networks working against a specific output value but I haven't seen unsupervised networks optimize against a less specific goal (e.g. minimize the cost, but we don't know what the ideal value looks like). Let's discuss a…
Gili
  • 76,473
  • 85
  • 341
  • 624
-2
votes
1 answer

Today's algorithmic challenge

I'm currently working on an algorithm to schedule pub-crawling (it can be much more generic applied, though). This is what is known: There is a certain number of teams and bars, the amount of teams never exceeding the amount of bars The teams must…
zniwalla
  • 367
  • 3
  • 17
-2
votes
1 answer

JAVA Genetic Algorithm initialization

I am trying to work on a TSP genetic algorithm. I am new to GA and i have read lots of documents about it. I know it need to create initialization then find out the fitness of each individual then do mutation and so on. However, I am really new to…
-2
votes
1 answer

Traveling Salesman with different destination

I'm working on a question required to solve a variation of traveling salesman problem. What's different is that the origin can be different from destination, I would like to ask if there is any good implementation of this problem because most of the…
user2534365
  • 205
  • 2
  • 10
-2
votes
1 answer

When does MST-based approximation algorithm not return optimal solution to TSP?

Given a complete, weighted graph G,such that its edge weights satisfy the triangle inequality but the MST-based approximation algorithm for TSP does not find an optimal solution.
Daniel Kobe
  • 7,696
  • 11
  • 44
  • 94
-2
votes
1 answer

TSP using Dynamic Programming

I am learning TSP and found this recursive solution to TSP int compute(int start,int set) { int masked,mask,result=INT_MAX,temp,i;//result stores the minimum if(g[start][set]!=-1)//memoization DP top-down,check for repeated subproblem …
user4392540
  • 101
  • 1
  • 1
  • 6
-2
votes
1 answer

Java code for traveling salesman with time windows

I am searching some open-source Java code that can be used to solve Traveling Salesman Problem with Time Windows for a single vehicle. Since the problem is very typical, I hope that some open-source libraries are available. Probably, something…
Klausos Klausos
  • 12,932
  • 43
  • 120
  • 206
1 2 3
43
44