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

how to find great examples of ortools vrp

I have to code a vehicle routing with multiple constraint by pywrapcp Module but I couldn't find proper documentation or explanation about functions. there are some examples of codes that used ortools.constraint_solver but they are simple and don't…
k_afr
  • 127
  • 1
  • 11
0
votes
0 answers

Algorithm : travelling salesman problem collect items

I have a question about traveling salesman problem. I have distance matrix between cities. Each city has different amount of beers. I need to collect as many items as I can and return to the starting point. I have a car that can drive 1000km. Could…
0
votes
2 answers

Competitions on the Traveling Salesman Problem and Testsets

I want to try some methods on the TSP and need some testsets. I know there are certain competitions on exact and approximate solutions for the TSP, and I would like to test some ideas I have on some testsets used in such competitions. However I was…
George
  • 3,765
  • 21
  • 25
0
votes
1 answer

What is the point of matrix reduction in Branch & Bound problems?

Pretty much as the title says. This is done in branch & bound problems, specifically the travelling salesperson. I understand how matrix reduction works, but I don't really get why you need to do it. Thanks.
0
votes
1 answer

which one is more time complexity between TSP or CPP?

What's the difference between traveling-salesman problem and Chinese postman problem From a Time complexity perspective? I mean which one is more time complexity between TSP and CPP ?
0
votes
1 answer

Drawing and Clearing several lines in Tkinter

So I'm working on developing a genetic algorithm for Traveling Salesman Problem in Python currently using Tkinter to display my results. The algorithm is going well, but I need to figure out some issues with displaying the results. Basically, I…
0
votes
1 answer

"Not a Number" being returned in distance formula for TSP

I'm trying to build a basic TSP solution in Python and I'm running into a bit of an issue when trying to calculate the total distance of each order of cities. The cities are created and stored as a randomly generated 2-Dimensional list; the inner…
Jordan Lejman
  • 87
  • 1
  • 7
0
votes
0 answers

Modelling an IF-THEN statement with multiple conditions in Mixed Integer Linear Programming (MILP)

I need some help modelling the following logic as a mixed integer linear programming constraints for a vehicle routing problem. The Variables involved are the following: Xij, SDVlmj, and MDVhkbj are binary decision variables. They equal to 1…
0
votes
3 answers

How to solve: UnboundLocalError: local variable 't' referenced before assignment? in python?

I am trying to implement the Simulated Annealing (SA) algorithm to solve a random instance of the Traveling Salesman Problem (TSP) in python. In my code, I have a function that computes the total longitude of the tour, given a list with the route…
0
votes
3 answers

Multi-path traveling salesman optimization

I am trying to solve variant of a multi-path traveling salesman with an incomplete graph. EDIT: changed the description (twice) based on feedback from @daniel_junglas. In more words: Only 1 salesperson The salesperson can only visit every city…
Thomas Hubregtsen
  • 449
  • 1
  • 5
  • 22
0
votes
1 answer

TSPLIB Name of locations

is there a source for the names of the locations contained within TSPLIB at http://www2.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/tsp/. For illustration purposes it would be nice to know where point 31 is on the Berlin52…
robkuz
  • 9,488
  • 5
  • 29
  • 50
0
votes
1 answer

How do I get rid of subtours and force a specific order in visiting points using gurobipy?

I am aware that there is a TSP example on the Gurobi website. I took a great amount of time understanding it, however I was not able to (completely). Therefor I decided to make a more simple one by my self. The problem: I am not able to get rid of…
Umbstick
  • 1
  • 3
0
votes
1 answer

How to obtain the path from a traveling salesman problem in R using TSP package

Let's suppose I have the following cost matrix, and I would like the path (and total cost) starting from node 20 from the perspective of Traveling salesman problem via nearest insertion method. ds.ex <- structure(c(0, Inf, Inf, 1.9, 1.7, Inf, 0,…
0
votes
0 answers

Unable to convert list into readable format in R

I'm using TSP package built by Professor M. Hahsler in R. The function is giving the results but when converted to a data frame, it's shuffling the results. How do I save the results in a dataframe? data <- data.frame( "lat" =…
Shanks07
  • 1
  • 2
0
votes
0 answers

Traveller Salesman like problem with dynamic programming

I have been searching quite a while without success, getting headaches ;-). Consider the TSP (traveling salesman problem), with a list of nodes 0, 1....n-1 BUT: trip must start at 0 and end at 0 there is just a known distance between all nodes trip…
Jeremie
  • 399
  • 4
  • 11