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

Optimization Algorithm for Trading Items

When you have something that you want to sell or something you want to buy there's basically two options: to use money or to trade it with another item. This happens in real life and also in games where you have a trading system in place (an open…
0
votes
2 answers

How to measure variance of a population of permutations?

I need to compute the variance in a population (array) of permutations, i.e, Let say that I have this array of permutations: import numpy as np import scipy.stats as stats a = np.matrix([[1,2,3,4,5,6], [2,3,4,6,1,5], [6,3,1,2,5,4]]) # distance…
ailauli69
  • 522
  • 6
  • 19
0
votes
1 answer

Time complexity of the travelling salesman problem (Recursive formulation)

According to this recursion formula for dynamic programming (Held–Karp algorithm), the minimum cost can be found. I entered this code in C ++ and this was achieved (neighbor vector is the same set and v is cost matrix): recursion formula : C(i,S) =…
0
votes
0 answers

Time complexity of Tsp using DP

this is the recursion formula for problem : C(i,S) = min { d(i,j) + C(j,S-{j}) } In fact, when I tried to implement it as a code, the following code came to my mind: int TSP(i, S){ if(S.size == 0) return dist(start_vertex,i) min = inf cost =…
Satar
  • 37
  • 7
0
votes
2 answers

Crossover and mutation in Differential Evolution

I'm trying to solve Traveling Salesman problem using Differential Evolution. For example, if I have vectors: [1, 4, 0, 3, 2, 5], [1, 5, 2, 0, 3, 5], [4, 2, 0, 5, 1, 3] how can I make crossover and mutation? I saw something like a+Fx(b-c), but I…
0
votes
1 answer

Find Combinations of middle elements in a vector

I have a vector vectorlist_of_points; that contains the points A B C D A. I want to find all the possible combinations of the vector keeping the outer two elements in the same place. For example, A B C D A -- A B D C A -- A C B D A -- A C D…
CS_12319
  • 1
  • 1
0
votes
0 answers

Traveling Salesman Alternate - How would one code it if the cities were all the same distances from each other?

First time asking question, apologies if incorrect. What would be the best way to approach this problem (Similar to travelling salesman, but I'm not sure if it runs into the same issues). You have a list of "tasks" at certain locations (Cities) and…
0
votes
1 answer

Shortest path algorithm to visit all nodes using k paths

I am trying to code a way to traverse an visit all the nodes with k different paths such that I visit all nodes once. It is possible to reach every node from every another node and we are all starting from the same starting location with non…
0
votes
0 answers

How can I calculate (estimate) miles/kilometers using the Euclidean TSP with latitudes and longitudes with the TSP library in R?

How can I calculate (estimate) miles/kilometers using the Euclidean TSP with latitudes and longitudes with the TSP library in R? The follow results in a tour length of 0.2122963 in latitude / longitude This article explains how to convert latitude…
windyvation
  • 497
  • 3
  • 13
0
votes
0 answers

Simulated Annealing + 2opt isn't any better than 2opt

I've been developing a small program that allows you to plot vertices in a graph and compute the shortest path between all of them. i.e. solves the Travelling Salesman Problem. I've programmed in the Simulated Annealing algorithm and the 2-opt…
S-Erase
  • 3
  • 1
0
votes
1 answer

CPLEX-python (3.6) keeps showing a "not list" ERROR

I am using the CPLEX solver with python 3.6 to solve mathematical programming models. I used to do this on my old computer and now reinstall cplex on the new one without problems, however when I try to run models that originally ran without errors,…
0
votes
1 answer

Salesperson greedy algorithm produce strange data in my data

I have a problem with the following definition I have a course with some lessons What Java Is and How It Works Hello World Program Using Variables Strings: Working With Text While Loops For Loops "If" Getting User Input Do ...…
0
votes
1 answer

TSP in Python: Importing a .csv-file in code for randomized data points

im quite the noob when it comes to coding. I am currently trying to code a solution for a traveling salesman problem. I already found functioning code for a set of random values (as seen below or in…
twinks-
  • 1
  • 1
0
votes
1 answer

KDTREE executable in Concorde

I'm trying to use the kdtree executable in Concorde but after installation it isn't in the KDTREE directory(or anywhere else I looked). I've tried rerunning the makefile and reinstalling Concorde but neither helped. The README and Insallation…
abrins
  • 3
  • 1
0
votes
3 answers

Traveling Salesman Problem implementation language

i am trying to develop a web application using HTML, PHP, and java script and i will include the Traveling salesman problem. should i use python for implementation or stick to java script? and what is the difference between them? which one is less…