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
1 answer

ga() function giving error when provided with suggestions

I am trying to get an optimized order of 20 as per self-defined function f (see below). So, I am using GA package of R. While using ga() function I want to provide some initial suggestions (population) to the algorithm. The initial suggestion is in…
1
vote
0 answers

Trouble with the implementation of 2-opt and 3-opt search in the resolution of TSP in c++

I have some trouble with my c++ implementation of a solver for TSP. I basically have two problems. The first one regards the comparison in the twoOptSearch() between min_change and change. I need to use that small offset in order to avoid an…
gvgramazio
  • 1,115
  • 3
  • 13
  • 30
1
vote
0 answers

Variant of Dijkstra - no repeat groups

I'm trying to write an optimization process based on Dijkstra's algorithm to find the optimal path, but with a slight variation to disallow choosing items from the same group/family when finding the optimal path. Brute force traversal of all edges…
1
vote
1 answer

A local search heuristic for a subtour in an asynchronous traveling salesman

Assume I want to minimize the distance traveled between a series of cities: starting tour: S-1-2-3-4-5-E optimal tour: S-5-1-2-3-4-E The tour must start at S, must end at E, but can visit the cities in between in any order. In my use case, the…
1
vote
0 answers

How to make a standard Traveling Salesman Solver into a Collect Price Solver for or-tools?

I have set-up a fine solver for *what is the best route to visit 1000 nodes" in my graph. But I would like to solve the question "what is the shortest route to visit any 500 of 1000 given nodes in my graph". I think, I have to add disjunctive…
towi
  • 21,587
  • 28
  • 106
  • 187
1
vote
1 answer

how to convert continuous number to discrete one in pso optimization?

hello everybody i write pso code for optimizing a simple function. it has no problem. now i want to solve tsp problem with pso. for example a swarm vector content is [1 2 4 3 1] and best swarm vector is [2 3 1 4 2]. when i want to update new value…
zara-T
  • 91
  • 11
1
vote
2 answers

Synonym chains - Efficient routing algorithm for iOS/sqlite

A synonym chain is a series of closely related words that span two anchors. For example, the English words "black" and "white" can connected as: black-dark-obscure-hidden-concealed-snug-comfortable-easy-simple-pure-white Or, here's "true" and…
some ideas
  • 64
  • 3
  • 14
1
vote
1 answer

DuplicateFlagError when running Google or-tools TSP constraint solver on multiple graphs

I'm using Google's ortools.constraint_solver to find solutions to the Traveling Salesman Problem. As seen here. Everything works as expected when I run the program on one set of points. Now that I got that working, I'm attempting to solve the TSP…
1
vote
0 answers

Waypoint Optimisation - MapKit / APIs / Traveling Salesman

Many threads on this topic, and finally found a answer that will work - using MapQuest API. But now it is closed. http://devblog.mapquest.com/2015/05/01/looking-for-a-free-open-appkey-read-this/ I tried the Google Maps API, so many keys tried them…
DogCoffee
  • 19,820
  • 10
  • 87
  • 120
1
vote
1 answer

Traveling Salesman in Java

I'm trying to make a Java implementation for the Traveling Salesman Problem. I have read a lot about the different optimal algorithms and I found that the Held-Karp algorithm is a good one to implement. Now my problem is that I'm trying to make an…
nTuply
  • 1,364
  • 19
  • 42
1
vote
1 answer

In a MAX-MIN ant system (MMAS), how does the initial pheromone depend on the best solution if it's not yet been found?

I'm learning how add the max-min ant system into my current ant system. From what I've read the trial pheromone is initialized tMax, tMax is calculated by, tMax = 1 / best tour length But how exactly would it be possible to initialize the trail…
1
vote
2 answers

List reset on every recursion when attempting to permute

I am attempting to generate all the permutations of a list but every time I recurse the list I pass in gets reset back to its original state, what's up with that? public static void PermuteAndSolve(List cities, int recursionLevel, int Length) …
Awia
  • 143
  • 1
  • 1
  • 9
1
vote
0 answers

Genetic Algorithm Crossover Producing Worse Results

The current algorithm used, is a genetic algorithm using, mutation and ordered crossover. We modified the original ordered crossover algorithm by removing the depot (end points) and then performing the crossover and adding them in after. The parent…
1
vote
0 answers

how to optimize numpy code for Markovian path

Below is a python function to generate Markov path (the travelling salesman problem). def generate_travel_path(markov_matrix, n): assert markov_matrix.shape[0] == markov_matrix.shape[1] assert n <= markov_matrix.shape[0] p =…
1
vote
1 answer

Delete path make in android

I have an android application that draws a path of points in an arraylist (named 'test'). An algorithm updates the arraylist to make the path shorter each time (it uses the Travelling Salesman Problem algorithm). The problem I am facing at the…