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
1
vote
2 answers

Solving a simple TSP using Z3

I am new to SMT solvers. I would like to know that how could I encode a simple TSP problem having 4/6 nodes? I am confused how to set my constraints using the Z3pay APA. Any kind of hint or help would be highly appreciated.
user1770051
  • 131
  • 1
  • 7
1
vote
1 answer

TSP/ TSPTW with different seed

I would like to ask is it possible to run the GA with different seed to generate the initial solution and make analysis ?. However, at the beginning of applying GA, you have to produce number of population solutions. For example, You run the genetic…
Yasmin
  • 931
  • 3
  • 14
  • 35
1
vote
1 answer

Finding cycles in a graph (not necessarily Hamiltonian or visiting all the nodes)

I have graph like one in Figure 1 (the first image) and want to connect the red nodes to have cycle, but cycles do not have to be Hamiltonian like Figure 2 and Figure 3 (the last two images). The problem has much bigger search space than TSP since…
1
vote
2 answers

Travelling salesman with time limit

I'm trying to make an application to calculate a daily route to visit my clients. I can solve whole way by using Genetic Algorithms so far. But I need to limit solution by distance. When I just "cut" the solution path at some point, it becomes a bad…
EvanBlack
  • 759
  • 8
  • 25
1
vote
1 answer

Local search algorithm, complete confusion

In (a) and (b), assuming a 2-exchange transformation operator, connect solutions A and B, which are TSP tours in path representation, to their possible neighbors among tours C, D, E, F, G (a) A: 1 2 3 4 5 6 7 C: 1 3 5 7 2 4 6 D: 1 2 5 4 3 6 7 E: 2…
kylex
  • 14,178
  • 33
  • 114
  • 175
1
vote
2 answers

Simulated annealing cost function for TSP

How does the cost function work for the TSP? Say I have a tour which has a distance of 100, and I change the tour slightly, making 4 changes to the original and it now has a distance of 50. Would the cost function give me 4, because that's the…
1
vote
1 answer

How to use sets of numbers as array indices?

I want to implement the Travelling Salesman Problem (Dynamic Programming) in C. I have the following pseudocode: ** Ignoring the base cases** ** C[i][j] is cost of the edge from i to j** for m = 2,3,4..n: for each set S of size m which is subset…
2147483647
  • 1,177
  • 3
  • 13
  • 33
1
vote
1 answer

Dynamic programming: iteration order of subsets in TSP

Question: How does one go about the correct iteration order of all city subsets {1,2,...,n} in the traveling salesman problem? In my solution, subsets are represented by a bitmask (simply an integer for now). All results are stored in 2-dimensional…
tman
  • 89
  • 1
  • 8
1
vote
2 answers

Flawed 2-opt Search Implementation?

I'm trying to design a 2-opt local search heuristic for the TSP in Java, but my algorithm seems to be flawed. Given a nearest neighbor circuit as in input, it somehow makes the circuit worse. Nearest neighbor: http://goo.gl/uI5X6; After ten seconds…
James
  • 45
  • 6
1
vote
2 answers

2-Opt Local Search Implementation

I am trying to implement local search (with 2-opt) to solve the traveling salesman problem. However, I am having trouble correctly re-creating a complete circuit (tour of the nodes). I think my algorithm may be flawed. This is my implementation of…
Jojo Jonas
  • 225
  • 2
  • 4
  • 15
0
votes
1 answer

Matlab: Removing redundant "shifted" entries of matrix

I have a problem I need to solve, but I can't think of any easy and more important: fast solution. It's a bit like a part of a multiple traveling salesman problem. First I have a matrix with X rows and N columns, N is a static variable of my…
tim
  • 9,896
  • 20
  • 81
  • 137
0
votes
2 answers

ModIfied Traveling Salesman

Given a graph structure that has asymmetric costs on the edges, is there a way to traverse a certain set of nodes at lowest cost if you can visit each node only once? Problem is formulated such that such a path must exist.
amatsukawa
  • 841
  • 2
  • 10
  • 21
0
votes
0 answers

Using DEAP for TSP with Disconnected Vertices: Seeking Guidance on Penalty Variable Failures

I am trying to use the DEAP package to solve the TSP where the matrix represents the distances between the vertices, taking into account that some of the vertices are not connected. How can I make DEAP work well? I have tried with a penalty variable…
0
votes
0 answers

Traveling Salesman Problem - Eliminating Subtours?

I'm trying to optimize a road trip across the U.S. in an iJulia notebook. I'm currently having issues with subtours. Instead of creating one fluid trip, the solution jumps around from place to place. How could I get rid of the subtours so that my…
0
votes
0 answers

Can I use different cost functions in prior( η) and posterior(τ) functiona in Ant Colony Optimization?

For TSP(Traveling Salesman Problem) solving by ACO(Ant Colony Optimization), I've read something like Ant Colonies for traveling salesman problem, The Ant Colony Optimization Meta Heustic, aco2004.prn.pdf etc. I've got something about ACO including…