Travelling salesman tips - algorithm

I'm developing an application in which I have to face the travelling salesman problem. I did my own tries but the times I'm getting are really bad. I was searching some optimization solutions but I'm not getting anything clear.
Any tips to start a optimization of this process or algorythms? My current algorithm is the basic backtracking one.
My graph satisfy all the typical conditions in a TSP graph (no directional, simetric, conex)...
Thanks

If your metric satisfy the triangle inequality I can suggest you to look for the christofides algorithm. It has a guarantee to be within the optimum solution. IMO the difficult part about christofides algorithm is the perfect matching. If you don't care about a guarantee you can look for the google map tsp solver. It uses the Ant Colony Optimization for large route. If you want really fast solving and less accuracy you can look for a monster curve for example a hilbert curve or a moore curve.

Related

Greedy Algorithm vs Nearest Neighbor Algorithm

I'm doing an assignment on Travelling Salesman and I want to know the difference between the Greedy Algorithm and the Nearest Neighbor algorithm. I looked it up and they seemed almost the same to me. And there weren't any good resources tha compared them. What is their difference?
Actually, I'm having a hard time finding the similarity :) You talk about two very different algorithms here, for different kinds of problems.
Greedy algorithm is being used mainly for graphs, as it's supposed to solve staged-problems, when each stage requires us to make a decision. For example, when trying to find the shortest way from one point to another, it would choose each time the closest point to the current point it stands at.
K-NN is a lazy classification algorithm, being used a lot in machine learning problems. It calculates the class for a value depending on its distance from the k closest points in the set.
Thinking about it, you can actually say that each stage of the greedy algorithm uses a 1-Nearest-Neighbours algorithm to find the closest point, but it's pretty ridiculous... :)
Hope it's understandable!

Solving the TSP in a maze using ACO

I'm writing an algorithm which includes a Traveling salesman problem (TSP) and a maze solving problem. Basically there are points inside the maze and we need to find the most optimal path to all those points and eventually exit the maze.
We started using an ACO algorithm to find the exit of the maze which works fine. But how would one integrate the TSP into it.
Our first guess would be reinforcement learning. Any ideas?
We figured out a way to do it. We decided to use a genetic algorithm where we encoded the order of each point in a chromosome. During each generation we ran the ACO algorithm for each chromosome and looked for the smalles amount of steps taken to reach the end goal.
It eventually converged or an iteration limit was hit.

Graph search algorithm where edges can be blocked by obstacles

I want to find a low-cost path between two vertices on a directed graph where the cost of each edge is the same. Ease of implementing the algorithm and performance time are very important, so I am willing to sacrifice an optimal solution for one that is near-optimal, if the algorithm is simpler and quicker.
An edge can be blocked by an obstacle. The probability that an edge is blocked is known beforehand. Blockages are independent of each other. An edge is found to be unblocked or blocked when the vertex at the head of the edge is reached.
My problem is similar to the Canadian Traveller Problem, but my understanding is that solutions for stochastic programming problems are relatively difficult to implement, and the time taken to find an optimal policy can be relatively high.
At the moment, I am thinking of converting the problem into a deterministic one so that it can be solved using a search algorithm like A*. Is this a good approach, and if so, how can I do this?
This problem is a partially observable Markov decision process (POMDP). POMDPs can be solved deterministically, but usually use a randomized algorithm to find an approximately-optimal solution. Finding the true optimum policy does not have a polynomial time solution, and even approximate solutions can be slow. On the upside, once you've found the policy, following it is fast.
Some of the available solvers:
ZMDP
Symbolic Perseus
APPL
pomdp-solve
SPUDD

Use of Optimization Algorithms for finding shortest path in network

I am new to the subject of algorithm design and graph theory. I am simulating large content based network consisting of thousands of routers. I am using "Learning by reverse path" for routing. Requested content names and contents are propagated in network using flooding. Routers check for matching names in routing tables and either reply back or populate routing table with unmatched requested content name and contents. Will using optimization algorithm like Ant colony optimization, hill climbing etc instead of learning by reverse path improve routing efficiency?
If your graph satisfy the triangle inequality i.e. is an euklidian space then I suggest you to use the christofides approximation algorithm because it has a guarantee to be 3/2 in the optimum. Other heuristic algorithm like ant colony optimization are very fast and efficient but not very safe. A good example for an ant colony optimization (and brute force and dp solution) is the google map tsp solver in javascript. I believe a space-filling-curve is a good approximation too and has a certain guarantee. You may look into a z-curve or a hilbert curve. You can find a good article about the hilbert curve at Nick spatial index quadtree hilbert curve blog or in the book Hacker's delight. I suggest to look into constructing of monotonic n-ary gray codes and hamiltonian path either.

Traversing weighted graph through all vertecies ending up at the same point

Is there an algorithm that will allow me to traverse a weighted graph in the following manner?
Start at a specific node
Go through all vertecies in the graph
Do this in the least amount of time (weights are times)
End up at the starting node
Sounds like the Travelling Salesman Problem to me. An NP-hard problem. There is no polynomial time algorithm that will give you the optimum solution. You could use a search heuristic to get a close to optimal solution though.
As Greg Sexton stated before me, it is a classic example of the Travelling Salesman Problem. There are many advanced algorithms about for handling this style of problem, which is best for your particular situation rather depends on the graph. If the number of vertices is high, you will need substantial computational power to get it done within a realistic time frame.
I am not sure, if any efficient algorithm exists, but a brute force approach would surely give you the answer.
In any case, can you give the constraints on the number of vertices/edges.

Resources