Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TSP - Branch and bound

I'm trying to solve the TSP with Branch and bound algorithm.

I must build a matrix with costs but I have this problem: I have city with coordinates x and y.

The cost of traveling is ceil(ceil(sqrt((x1-x2)^2+(y1-y2)^2))/v) + days spent in the city. V is speed.

Days spent in the city depends from day when w comes to the city. For example if we arrived on Monday(t1) to city 1, we stay for 9 days but if we arrived on Tuesday, then we stay in the city for 4 days.

         x   y   t1 .        t7
city 1. 79 -36   9 4 8 5 5 7 8
city 2. 8  67    6 9 2 1 9 9 1
city 3. 29 57    7 5 10 8 10 9 4

How can I solve this problem using branch and bound algorithm?

like image 682
gummmibear Avatar asked Jan 28 '10 11:01

gummmibear


People also ask

What is branch and bound algorithm for TSP?

The branch-and-bound algorithm for the traveling salesman problem uses a branch-and-bound tree, like the branch-and-bound algorithms for the knapsack problem and for solving integer programs. The node at the top of the tree is called the root. All edges (arrows) in the tree point downward.

What is the time complexity of TSP using branch and bound?

The time complexity of the program is O(n^2) as explained above for the row and column reduction functions.

What is lower bound in TSP?

A lower bound can be found by removing a vertex, then finding a minimum spanning tree: Use Prim's or Kruskal's algorithm to find the length of the minimum spanning tree. Add to this the lengths of the two shortest edges connected to the missing vertex.

What is the path of the given TSP?

TSP can be modelled as an undirected weighted graph, such that cities are the graph's vertices, paths are the graph's edges, and a path's distance is the edge's weight. It is a minimization problem starting and finishing at a specified vertex after having visited each other vertex exactly once.


3 Answers

Here you go: http://lcm.csa.iisc.ernet.in/dsa/node187.html - it seems to explain fairly well how this should be approached.

Archive.org link

like image 122
laura Avatar answered Nov 17 '22 17:11

laura


This PDF document gives a more detailed explanation of the Branch and Bound implementation for the Traveling Salesperson Problem:

Part 1: A solution with nodes containing partial tours with constraints http://www.jot.fm/issues/issue_2003_03/column7.pdf

Part 2 PDF can also be found. http://www.jot.fm/issues/issue_2003_05/column7/

like image 23
juejiang Avatar answered Nov 17 '22 15:11

juejiang


Step by step explanation of branch and bound method:

  • video: https://www.youtube.com/watch?v=RR7GXoWiUw4
  • book: https://archive.org/details/algorithmfortrav00litt (link to download in pdf)
  • implementation (C++): https://github.com/karepker/little-tsp

I hope my answer will be useful for somebody.

like image 21
artamonovdev Avatar answered Nov 17 '22 16:11

artamonovdev