Docstoc

TRAVELING SALES PERON PROBLEM

Document Sample
TRAVELING SALES PERON PROBLEM Powered By Docstoc
					Traveling Sales Person Problem Dynamic Programming

AOA
Ch. Muhammad Imran Razzak Lecture, Federal Urdu University of Arts, Science and Technology, Islamabad.

Dynamic Programming and Principle of Optimality
• Dynamic programming is based on the principle of optimality
That principle can be stated as The principle of optimality is said to apply in a problem if an optimal solution to an instance of a problem optimal solutions to all substances.

• For example the Principe of optimality holds in the case of finding the sortest path but fails in the case of finding the longest distance. 50 • Consider the shortest distance from A A to D is A to B to C to D is 35. • Further the shortest distance
Form A to C is 25 and from A to B is 20 Thus this hold the principle of optimality.
20 10 5 B

D

C 2

Principle of Optimality
• Now for longest distance
A 50 D

– Longest distance from C to A 20 10 is 60 while the longest distance 5 C from C to D is not longest path, B because the longest path form C to B to A to D is 75 thus this does not hold the principle of optimality.

3

Traveling Sales Person Problem

•Salesperson is planning a sales trip that includes 20 cities. • Each city is connected to some of the other cities by a road. • To minimize travel time, we want to determine a shortest route that starts at the salesperson's home city, visits each of the cities once, and ends up at the home city. •This problem of determining a shortest route is called the Traveling Salesperson problem. • represented by the Weighted Graph •weights are nonnegative numbers

4

TSP

Know the distance b/w each city
5

Traveling Sales Person Problem
Hamiltonian circuit A tour (also called a Hamiltonian circuit) in a directed graph is a path from a vertex to itself that passes through each of the other vertices exactly once. An optimal tour in a weighted, directed graph is such a path of minimum length. Traveling Salesperson problem is to find an optimal tour in a weighted, directed graph when at least one tour exists.

6

Traveling Sales Person Problem
• • solved this instance by simply considering all possible tours there can be an edge from every vertex to every other vertex. If we consider all possible tours, the second vertex on the tour can be any of n − 1 vertices, the third vertex on the tour can be any of n − 2 vertices, …, the nth vertex on the tour can be only one vertex. Therefore, the total number of tours is

7

Traveling Sales Person Problem
(Dynamic Programming)

V is the set of all vertices While A is the subset of V D[vi][ A]=length of the shortest path from vi to v1 passing through each vertix in A exactly onece

From graph V={v1,v2,v3,v4}

8

TSP

9

10


				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:15
posted:8/25/2009
language:English
pages:10