traveling-salesman

a variation of TSP : limit time, visit as many nodes as possible

試著忘記壹切 提交于 2019-12-07 12:19:45
问题 again let's use the salesman context: if the salesman is not required to visit ALL customers, but is given a time constraint, in which he must vist as many customers as possible. how can we find the best route? an even more slightly advanced version is, say each customer is marked with a monetary gain, so our salesman wants to maximize the total monetary gain from those customers that he actually visits, as long as he finishes visiting them within the time constraint I tried to search for

Using Bitmasking in dynamic programming [closed]

拈花ヽ惹草 提交于 2019-12-07 11:26:02
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I am learning about TSP and i came across bit masking to represent all the combination of cities. I don't understand the logic behind it. Please help me in this. #define size 10 //maximum 10 cities #define min(a,b) a>b?b:a #define sizePOW 1024 // 2^10 int n,npow,g[size][sizePOW],p

Looking for an open source Traveling Salesman function / library in c / c++? [closed]

霸气de小男生 提交于 2019-12-07 03:12:28
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I know there are a few different Traveling Salesman projects out there and I've played with LKH a bit, but I was wondering if anyone had any recommendations on any other ones? My project is GPL'ed so I would need something that is compatible with that license. 回答1: In general, Space Filling Fractals will give

Implementation of a particular Travelling-Salesman variation

自闭症网瘾萝莉.ら 提交于 2019-12-06 16:32:18
I'm looking for an algorithm(C/C++/Java - doesn't matter) which will resolve a problem which consists of finding the shortest path between 2 nodes (A and B) of a graph. The catch is that the path must visit certain other given nodes(cities). A city can be visited more than once. Example of path( A -H-D-C-E- F - G - F - B ) (where A is source, B is destination, F and G are cities which must be visited). I see this as a variation of the Traveling Salesman Problem but I couldn't find or write a working algorithm based on my searches. I was trying to find a solution starting from these topics but

Java: Traveling Salesman - Found polynomial algorithm

ぃ、小莉子 提交于 2019-12-06 16:29:43
问题 Edit : An improvement to this algorithm been found. Your are welcome to see it. This question is the an improvement of my old question. Now I want to show you Java code sample, and explain my algorithm in more details. I think that I found a polynomial algorithm to get an exact solution to the Traveling Salesman Problem. My implementation is build from 5 steps: 1) Quick setup 2) Search for solution 3) Stop condition 1 4) Stop condition 2 5) Stop condition 3 I want to start from step 2 and 3,

How to turn TSP into minimum hamiltonian path?

↘锁芯ラ 提交于 2019-12-06 10:29:42
问题 I'm trying to solve this problem http://coj.uci.cu/24h/problem.xhtml?abb=1368. After a lot of research, and spending a lot of time i was able to implement a Branch and Bound algorithm for TSP, which gets a path passing all points and returning to start. I was thinking that removing the longest edge from that path i would get the answer, but just when i finished my algorithm, i discovered that this isn't true in all cases, reading this question: Minimal Distance Hamiltonian Path Javascript I

Palmer's Algorithm for Hamiltonian cycles

。_饼干妹妹 提交于 2019-12-06 06:30:50
问题 In a "dense" graph, I am trying to construct a Hamiltonian cycle using Palmer's Algorithm. However, I need more explanation for this algorithm because it does not work with me when I implement it. It seems that there is an unclear part in Wikipedia's explanation. I would be thankful if someone explains it more clearly or give me some links to read. Here's the algorithm statement: Palmer (1997) describes the following simple algorithm for constructing a Hamiltonian cycle in a graph meeting Ore

Dynamic programming approach to TSP in Java

大城市里の小女人 提交于 2019-12-06 03:04:34
I'm a beginner, and I'm trying to write a working travelling salesman problem using dynamic programming approach. This is the code for my compute function: public static int compute(int[] unvisitedSet, int dest) { if (unvisitedSet.length == 1) return distMtx[dest][unvisitedSet[0]]; int[] newSet = new int[unvisitedSet.length-1]; int distMin = Integer.MAX_VALUE; for (int i = 0; i < unvisitedSet.length; i++) { for (int j = 0; j < newSet.length; j++) { if (j < i) newSet[j] = unvisitedSet[j]; else newSet[j] = unvisitedSet[j+1]; } int distCur; if (distMtx[dest][unvisitedSet[i]] != -1) { distCur =

Why does adding Crossover to my Genetic Algorithm gives me worse results?

做~自己de王妃 提交于 2019-12-05 17:43:02
问题 I have implemented a Genetic Algorithm to solve the Traveling Salesman Problem (TSP). When I use only mutation, I find better solutions than when I add in crossover. I know that normal crossover methods do not work for TSP, so I implemented both the Ordered Crossover and the PMX Crossover methods, and both suffer from bad results. Here are the other parameters I'm using: Mutation : Single Swap Mutation or Inverted Subsequence Mutation (as described by Tiendil here) with mutation rates tested

Looking for an open source Traveling Salesman function / library in c / c++? [closed]

耗尽温柔 提交于 2019-12-05 08:07:27
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I know there are a few different Traveling Salesman projects out there and I've played with LKH a bit, but I was wondering if anyone had any recommendations on any other ones? My project is GPL'ed so I would need something that is compatible with that license. In general, Space Filling Fractals will give you some of the best results at the lowest costs. In particular, I would recommend the Sierpiński curve .