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 for TSP - library in python

I was trying to find the shortest path in TSP using genetic algorithm. Is there any library in the python for this problem? Is there any code for this problem? Is there any steps or hint for how to solve the problem?
Jack
  • 181
  • 10
0
votes
1 answer

Prevent that the ant visit a already visited vertex

I'm trying to implement the ant colony method to solve TSP problem, and I'm having trouble creating the paths for the ants. The ant need to visit all the vertex and return to the origin vertex, without repeating the vertices. I tried to do a…
0
votes
0 answers

Can I use a greedy method as an heuristic for an A* algorithm?

I am trying to find a heuristic to solve a travel salesman problem but with more restrictions. Using the greedy is giving me a total cost of 3.839. Using A* with some estimation as a heuristic is giving me results of 4.0 to 5.35. Using A* while…
0
votes
0 answers

How would I make an algorithm to order colors from red to purple so that similar colors are next to each other?

Imagine I have random colors with their hue, saturation and value. How would I make an algorithm to order those colors from red to purple so that similar colors are next to each other? Sorting them by hue would not be enough because I could have…
0
votes
2 answers

Reason for a gurobipy.GurobiError appearing in line "m.optimize(subtourelim)" while solving a TSP?

I am solving a TSP with an academic Gurobi licence and and I pretty much used the following code for my solution.(from gurobi itself) https://gurobi.github.io/modeling-examples/traveling_salesman/tsp.html About 25 minutes after I start running I get…
0
votes
1 answer

Java: Local search for a TSP error

I'm coding a simple local search algorithms for TSP in java. Here's the method: public Permutation localSearch(Permutation best, int maxnoimprov) { int count = 0 ; Permutation candidate; do { candidate = stochastic_2_opt(best); …
user855520
0
votes
0 answers

Is there a solution to the TSP problem that is effective and not limited to space?

Is there any method of solving the traveling salesman problem effective and that is not limited by space (as is the case of the Held-Karp algorithm), excepting brute force? If we use algorithms based on dynamic programming, it solves the problem…
Juan
  • 1
  • 1
0
votes
1 answer

Exporting CPLEX TSP example solution to csv/excel

This might be a simple question but I have been struggling with this for a while. I am using flow control to introduce lazy constraints when solving a problem that is very similar to a TSP. I found the CPLEX TSP example which I can follow well and…
0
votes
2 answers

Searching for a minimum cycle in a graph containing a set of nodes

If i have an undirected weighted graph G = (V, e) and a set of nodes P, how do i find the minimum cycle containing all the nodes in P? I have a large graph G and a set of nodes P based on user input. After I get the user input i want to find the…
0
votes
3 answers

Reduce size of alternate solutions in optimization

We have a supplier/depot (index d) and several factories (index f) with demand known for different products (p) during T month (index t) ahead. There is a fleet of trucks (index v) with different truck types (index k) (e.g., some of them have…
0
votes
1 answer

Travelling Salesman with Momentum?

I have a task that is very similar to travelling salesman problem (TSP), but I'm not sure if it's easily mappable to TSP. I'm wondering if this variant has a name and known solvers already, or can be just reduced to TSP somehow. I have a graph…
Peter
  • 12,274
  • 9
  • 71
  • 86
0
votes
0 answers

Dynamic Programming for TSP with constraints

I am trying to solve the following problem: There are several cities in the map. We know the distance between each city. We would like to build a road to connect these cities. However, the maximum distance of the road is x. So, what algorithm should…
0
votes
1 answer

How to make a distance matrix for traveling salesman problem using most cost effective way?

We are trying find the optimum route for given sets of addresses. Here optimum route meanibg going every address using shortest distance, We are using Traveling salesman approach to solve this, the problem is to work this algorithm perfectly we need…
0
votes
1 answer

Estimating the Run Time for the "Traveling Salesman Problem"

The "Traveling Salesman Problem" is a problem where a person has to travel between "n" cities - but choose the itinerary such that: Each city is visited only once The total distance traveled is minimized I have heard that if a modern computer were…
stats_noob
  • 5,401
  • 4
  • 27
  • 83
0
votes
1 answer

Iterating over dictionary and performing function

Currently attempting the Travelling Salesman Problem with a simulated annealing solution. All points are stored in a dictionary with the point name as the key and co-ordinates as the value. Having trouble writing a for loop(path_tour function) that…
X13Theo
  • 19
  • 4