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

Genetic Algorithm Travelling Salesman

I am trying to understand the terms genotype, phenotype and fitness in the Travelling Salesman Problem. Say I have 4 cities ABCD and their co-ordinates are (0,3)(1,4)(5,6)(2,9) what would be the genotype, phenotype and fitness of that?
0
votes
2 answers

Find the combination of variables in base of their score

I want to solve a problem with Python (like a programming riddle). It isn't an exercise or anything related with this, but something I figure and I want to find a solution for it. Problem description: Let's say that I have a business with 10…
0
votes
0 answers

Travelling Salesman distance miscalculations

just having some issues with the distance calculation in a Traveling Salesman optimized nearest neighbor solution I have been working on in the past week or so in my free time. Basically, what is happening is when I get my result printed, the…
0
votes
0 answers

Travelling Salesman Brute Force Nearest Neighbour Algorithm, looping issues

Been fiddling around with my main method's looping for the last hour or so, to no avail. The issue is coming from Array Out of Bounding in both the values array and the identity matrix. Assume all other methods etc. are functional. public static…
brainiac
  • 41
  • 4
0
votes
0 answers

Travelling salesman (with predefined edges) heuristics?

I'm looking for an algorithm that is faster than exponential which will find ANY cycle in a traveling salesman problem. It doesn't matter how bad the cycle is, it just needs to be a cycle. What I'm really looking for, then, is an algorithm for a…
user1472747
  • 529
  • 3
  • 10
  • 25
0
votes
0 answers

Alghorithm on finding the most profitable path

I have a number of cities. I can travel from any city to any another city but I can't know what cities are in my route. I know only the distance (or traveling time, cost) from start to finish point. Think like it's airway. I also have a list of…
Vlad
  • 3,001
  • 1
  • 22
  • 52
0
votes
2 answers

PHP combination of pairs for a 2D array as part of the solution for Christofides algorithm

I am creating Christofides algorithm for the Traveling Salesman Problem. In part of the algorithm I need to find nodes of a graph that are of odd degree and then calculate the lowest weight. This can be done by the Blossom algorithm, but I am…
jack8627
  • 85
  • 1
  • 5
0
votes
1 answer

Worried if my Ant Colony Optimization is just finding the path using Nearest Neighbour Method

I am trying to solve travelling salesman problem using Ant Colony Optimization Algorithm. I have attached my code with this. This is working fine right now for all test cases (those i have tested) and giving right answers. But still I am not…
0
votes
1 answer

Brute Force Algorithm to solve the TSP in Delphi

I'm writing a program for an extended project to simulate the travelling salesman problem. So far I have written it to allow the user to enter a route, as well as 'solving' a route using a nearest neighbour algorithm. I am now trying to write a…
0
votes
0 answers

Solving TSP using TSPLIB Data Java

basically I got some Symmetric TSP data from TSPLIB http://www.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/tsp/ and then I try to build a path by first clustering the cities, building subtours for each cluster and then connecting the…
MTA
  • 739
  • 2
  • 9
  • 29
0
votes
4 answers

How to use JSON output in java

I am making a program which gets the Json distance matrix from Google Maps API. So far i wrote the program can get the json it looks as below { "destination_addresses" : [ "Paris, France", "Toulon, France", "Nantes, France", …
0
votes
1 answer

traveling salesman without return and with given start and end cities

I am looking for the name of the following problem: traveling salesman problem (visit each city exactly once) but without returning to the start city and with visiting a given city at the end. In other words, I would like to specify the start and…
user3087959
  • 1
  • 1
  • 1
0
votes
3 answers

c++: Access to private variables in abstract base class

long-time lurker, first-time asker. I'm doing a project on the TSP (Traveling Salesman Problem) in c++ and I have a small question. I need to take two nodes (called NodeIDs in this scenario, they are unsigned ints) and add an edge between them in…
0
votes
1 answer

Reading in data for Traveling Salesman c++

I need to figure out how to read this file in: 48 0 3023 1942 1 6734 1453 2 2233 10 3 5530 1424 4 401 841 5 3082 1644 6 7608 4458 7 7573 3716 8 7265 1268 9 6898 1885 10 1112 2049 11 5468 2606 12 5989 2873 13 4706 2674 14 4612 2035 15 6347 2683 16…
user1886597
0
votes
3 answers

Unhandled exception at (memory address) (msvcr110.dll)

I'm having a problem with this code. It's a genetic algorithm I'm writing for the traveling salesman problem. However the program just crashes and doesn't complete, digging around in the debugger I found what I believe the error is however I'm not…