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 calculate all possible cycles (all nodes must be visited once) on a graph? Hamilton circle

I am trying to write a program which outputs all possible cycles starting and ending with node 1 and visiting all other nodes exactly once. Given is a complete undirected unweighted graph with N nodes. For example: n = 4 then 1-2-3-4, 1-2-4-3,…
0
votes
0 answers

Google Geocode returns undefined when used in loop

Problem:1- Hello, I'm developing a small javascript application get the addresses and Geocode it and save to database. I have almost 15000+ addresses which i want to get the lat/long of each. I'm iterating through loop, but the Geocoding function…
0
votes
0 answers

OR-Tools TSP with Multiple time windows on Locations or Vehicle

I'm working on a TSP spanning through multiple days. All the locations can be visited 09:00-17:00 Mon-Fri and 09:00-13:00 on Sat. Sunday is a day off. To achieve this, I have two options in mind and I'm looking for the correct approach. Specify…
Sonnyx
  • 1
  • 1
0
votes
0 answers

traveling salesman problem dynamic programming

I've written a code, that gives the least cost for an array, which stores length of paths from each city to each city. I used recursion in my code. User chooses the first city from which the salesman begins his tour. The salesman has to visit each…
czesiek
  • 3
  • 2
0
votes
0 answers

TSP variant with a different objective

I recently ran across the following problem: There is a complete graph with edge lengths and vertex weights. The edge lengths obey the triangle inequality. There is a source node S. Find the lowest cost tour in the graph where the cost of tour is…
0
votes
0 answers

A problem similar to the travelling salesman problem

I have different Features in my dataset these features names as following A B C D E F G H There is a correlation between these features Features Correlation ---------------------- A B 70 A C 78 B C 96 A G …
asmgx
  • 7,328
  • 15
  • 82
  • 143
0
votes
0 answers

Python - Tree structure - minimum time to end processes with given number of resources (Kind scheduler problem)

hope everything is fine for all of you in the community. I got this problem. I have a tree structure as follows, coding in python: 0 ├── 0.01 │ └── 0.25 │ └── 0.5 │ ├── 3.5 │ │ └── 7 │ ├── 3.5 │ │ …
Andrea T
  • 15
  • 5
0
votes
0 answers

2 opt algorithm providing inconsistent results and no improvements

To summarise the issue I will cover the implementation explanation and results. The problem I am aiming to solve with the algorithm is to correct some results gathered through a Randomised nearest neighbour implementation, for anyone who is…
0
votes
1 answer

adding variables in the case of symmetric TSP

I have to implement a symmetrical TSP. When I go to add the variables: x = m.addVars (Costs.Keys (), vtype = GRB.BINARY, obj = Costs, name = 'x') It gives me the error: 'list' object has no attribute 'Key '. I have the data saved in a list, is there…
lori
  • 1
  • 2
0
votes
1 answer

Using Python bitset to find all combinations of a set of size k

I am trying to speed up my own dynamic programming solution for Travelling Salesman. My original solution memoizes with a dictionary with a python frozenset() as part of the key. However, I believe that this implementation can be improved using…
Peabrain
  • 519
  • 2
  • 12
0
votes
1 answer

TSP: Maximize profit with distance constraint

To keep it as simple as I can, is there a variation of the TSP where I try to maximize benefit with a limitation on how much I can travel with the requirement I make it back home? (I'm quite rusty on these types of algorithms, perhaps requires…
0
votes
1 answer

OR Tools limit visits between two nodes

For example lets say I have something like this: solver().Add(this.solver.ActiveVar(start) == this.solver.ActiveVar(end)); for a specific route. this means that start index must end on end index. What if I want to limit the number of visits that…
ZantAgg
  • 97
  • 3
  • 11
0
votes
0 answers

A special TSP: set of targets to pick exactly one

I am struggling with a special case of TSP (traveling salesmen problem). The context: I have blocks with geographic extension. A block has several entry and exit points. The task is to visit all blocks exactly once by entering a selected entry point…
Balage1551
  • 1,037
  • 1
  • 10
  • 28
0
votes
1 answer

How to get sorted list of nodes for a list of nodes in a NetworkX graph as approximation of TSP

I have an undirected NetworkX graph (not necessarily complete, but connected). Also, I have a list of few nodes from all nodes of the above graph. I want to get the travel distance as per TSP result(or it's approximation). I tried using…
mufassir
  • 406
  • 5
  • 16
0
votes
1 answer

Algorithm to generate routes subject to pickup/delivery

Suppose we have 3 people wanting to go from point p1 to d1, p2 to d2, and p3 to d3. I want to list all possible trips that these people could take, such that every point p1...p3, d1...d3 is on the trip, and that it satisfies pickup delivery…
AndW
  • 726
  • 6
  • 31