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

Time complexity of TSP

Basically I'm not sure how to measure time complexity. I know that TSP is an NP-hard problem, that means that the time complexity of an algorithm used to solve it is exponential: O(2^n) What if I divide into sub-problems and solve the subproblems…
0
votes
1 answer

Genetic Algorithms - Travelling salesman

I am going through a past exam paper and I'm trying to understand the following question: Assume you have N cities. It's possible to go from each city to any of the other cities. Assume that you have full information about the distances between…
7389573987
  • 15
  • 3
0
votes
1 answer

Java - Collection to keep the best results

I have a list of 2D points (a custom Node class). I would like to pick a Node and say "Ehy, the 10 closest node in my list are those ten" Now, what's the problem: I would like to make something like: ArrayList nodes; //list of nodes …
user7244619
0
votes
0 answers

Discrete Invasive Weed Optimization normal distribution to generate seeds

This is a conceptual doubt related to Soft computing and Optimization. I am implementing the Discrete Invasive Weed Optimization (DIWO) to solve the Traveling Salesman Problem. We studied from this research…
annu
  • 1
0
votes
0 answers

Traveling Salesperson Solution from .txt File

I am trying to implement the Traveling Salesperson Algorithm (TSP) using a .txt file. The files read like a .csv with "," between each number. And example of the file content could include: "0,8,6,5,2,9 8,0,14,11,10,17 6,14,0,3,5,6 …
0
votes
2 answers

PriorityQueue poll() throwing NullPointerException

I am working with a priority queue in Java for the first time and I can't for the life of me understand what I am doing that is leading to the exception. I'm attempting to implement an ant colony type solution to the traveling salesman problem. The…
jmon117
  • 65
  • 8
0
votes
1 answer

Using DFS to traverse through MST, starting and finishing at one vertex?

I'm trying to traverse through an MST. I want to be able to start and finish from one vertex and visit every vertex (TSP). I don't care about efficiency, I just want to be able to visit every vertex in the MST and come back to the source vertex. Any…
kennysong
  • 504
  • 2
  • 6
  • 23
0
votes
1 answer

2-opt to 3-opt for Travelling Salesman

I am trying to convert my 2-opt implementation of the travelling salesman problem into a 3-opt. I understand that it is, in comparison to 2-opt, removing 3 edges and replacing them to hopefully get a better distance. I am having issue figuring out…
Georgrio
  • 91
  • 2
  • 14
0
votes
1 answer

Simulated annealing Initial solution

Can we initialise the first best solution in Simulated Annealing with some other optimization algorithm like nearest neighbour algorithm(I am solving TSPTW)?if it is better then what are some other algorithm which i can use for initialisation of…
0
votes
1 answer

How use indices and import data for Python PuLP Mathematical Optimization

I have used optimization modelers in the past, but it's been a while and I am still learning how to do this in python. I have done some online research and am using the open-source version of PuLp https://pythonhosted.org/PuLP/ I have the following…
0
votes
1 answer

Travelling salesman (TSP) getting the actual path

I wonder if there is a way to get the path (not only the distance) chosen by brute force algorithm (TSP)in my solution like i get only the distance. Notice that I started from City Stockholm and ended at Stockholm. The shortest path is city1 -->…
user7766720
0
votes
1 answer

The optimal path in Java (tsp)

I am new to Java and trying to get the shortest path between several cities. Start at some point (city) got through all the other cities and end at the same city Parsing the date from JSON File: { "city": "City1", "latitude": 43.1641506,…
user7717824
0
votes
1 answer

Find safest route in graph but prevent doubling the travel time of the fastest route?

my university project is to design a route planner of the city i live in, calculating the shortest routes between streets. (traveling salesman) In C#, im using a graph to store all the streets. Currently i can find the shortest route between two…
squish
  • 846
  • 12
  • 24
0
votes
0 answers

TSP with max node and time limit

I have to creat a CPLEX model to the GTSP, I have to maximize the visits with a time limit and some obligation visits! Is there a general modeling for this? If not, can anyone help me with this and I will send him my code to catch the error.
BiGBoY
  • 1
0
votes
2 answers

Basic Greedy Search in Python

def basic_greedy(): start = 1 mindist = d_dict[(1,2)] m = 0 while len(tour)!=size: tour.append(start) for k in range(len(cities)): if cities[k] not in tour: if…
singhuist
  • 302
  • 1
  • 6
  • 17