ppt

advertisement
Parallel TSP with branch
and bound
Presented by
Akshay Patil
Rose Mary George
Roadmap

Introduction

Motivation

Sequential TSP

Parallel Algorithm

Results

References
2
Introduction

What is TSP?

Given a list of cities and the distances between each pair of cities, find the
shortest possible route that visits each city exactly once and returns to the original
city.
3
Introduction

Problem Representation

Undirected weighted graph, such that the cities are graph vertices and paths
are graph edges and a path's distance is the edge's weight.
0
1
2
3
4
0
00
17
04
10
13
1
17
00
01
14
05
2
04
01
00
04
10
3
10
14
04
00
06
4
13
05
10
06
00
4
Roadmap

Introduction

Motivation

Sequential TSP

Parallel Algorithm

Results

References
5
Motivation

Travelling salesperson problem with branch and bound is one of the
algorithms which is difficult to parallelize.

Branch and bound technique can incorporate application specific heuristic
techniques

One of the earliest applications of dynamic programming is the Held-Karp
algorithm that solves the problem in O( n22n)

Greedy algorithm, may or may not obtain the optimal solution with O( n2 logn)
complexity.

Parallel branch and bound optimization problems are large and
computationally intensive.

Increasing availability of multicomputers, multiprocessors and network of
workstations
6
Applications


TSP has several application even in its purest formulation such as :

Planning

Logistics

Manufacture of microchips

Genetics
UPS saves 3 million gallons of gasoline per year.
7
Roadmap

Introduction

Motivation

Sequential TSP

Parallel Algorithm

Results

References
8
Sequential TSP with branch and bound

Best_solution_node = null

Insert start city node into priority queue (Q)

While Q is not empty:

node = Q.top() // Node with least cost

If node.cost >= Best_solution_node.cost // Bound


If node is solution better than Best_solution_node


Best_solution_node = node
Else


continue
Explore children of node and insert in Q //Branch
Display best_solution_node
9
Sequential TSP with branch and bound
noOfVertices = 5
Children Generated = (5-1 )!
With No bounding
10
Sequential TSP with branch and bound
noOfVertices = 5
Children Generated < (5-1 )!
With bounding
11
Lower Bound Estimate

Cost of any node = path_cost + lower_bound_estimate

lower_bound_estimate = MST ( unvisitied cities, startcity, currentcity)

MST is calculated using Prim’s algorithm which takes O(n2) if implemented
using adjacency matrix.

Why MST is a good estimate?
12
Roadmap

Introduction

Motivation

Sequential TSP

Parallel Algorithm

Results

References
13
Parallel Algorithm
Datatype Creation for Solution Node

struct Node{
int nvisited;
MPI_Datatype mpinode;
int cost;
MPI_Datatype type[3] = {MPI_INT,MPI_INT,MPI_INT};
int path[GRAPHSIZE];
MPI_Aint disp[3];
}
// GRAPHSIZE = no.of.vertices
disp[0] = (int)&root.nvisited - (int)&root;

disp[1] = (int)&root.cost - (int)&root;

disp[2] = (int)&root.path[0] - (int)&root;

int blocklen[3] = { 1, 1, GRAPHSIZE };

MPI_Type_create_struct(nodeAttributes,




&mpinode

);
blocklen, disp, type,
// Resulting datatype.
14
Parallel Algorithm

Send & Receive

At sender


MPI_Isend(&node, 1, mpinode,i,50,MPI_COMM_WORLD,&req);

node = variable of type Node

1 = send 1 variable

Dataype = mpinode
At Receiver

MPI_Irecv(buffer, size, mpinode, MPI_ANY_SOURCE, 50, MPI_COMM_WORLD,&req);

MPI_Wait(&req, &status);

MPI_Get_count(&status, mpinode, &noOfNodesReceivedInBuffer);
15
Startup phase

Distribution of initial nodes to processors.

For noOfProcessors = 4

Round 1 (start round = 1)


0 generates children of start city, sends half to 1, keeps half in startupNodes
Round 2 (last round = log(noOfProcessors))

0 generates children nodes in startupNode, sends half to 2

1 generates children nodes in startupNode, sends half to 3
16
Parallel Algorithm
17
Roadmap

Introduction

Motivation

Sequential TSP

Parallel Algorithm

Results

References
18
Results
Processors
1
2
4
8
Time
7.97
10.34
19.82
57.99
For n = 12
Speedup
-0.77
0.4
0.13
Processors
1
2
4
8
Time
9.137
7.83
12.5
44
Speedup
-1.16
0.73
0.2
For n = 12, all edge weights=10 except 1
19
Current State of the Art Algorithms

LKH(Lin-Kernighan heuristic), was used to solve the World TSP problem which
uses data for all the cities in the world.

The best lower bound on the length of a tour for the World TSP
is 7,512,218,268

The tour of length 7,515,778,188 was found on October 25, 2011.
20
References

MPI Dynamic receive and Probe, http://www.mpitutorial.com/dynamicreceiving-with-mpi-probe-and-mpi-status/

TSP Test Data, http://www.tsp.gatech.edu/data/

World TSP, http://www.tsp.gatech.edu/world/index.html

LKH(Lin-Kernighan heuristic), http://www.akira.ruc.dk/~keld/research/LKH/

Used to solved the World TSP problem
21
Download