Click here to load reader

Review And Evaluations Of Shortest Path Algorithms

Embed Size (px)

Citation preview

A Review And Evaluations Of Shortest Path Algorithms

Pawan Kumar Tiwari MCA 3 sem Roll NO. 16

A Review And Evaluations Of Shortest Path Algorithms

Introduction The shortest path problem is a problem of finding the shortest path or route from a starting point to a final destination. Shortest path problem we use graphs. A graph is a mathematical abstract object.Lengths of edges are often called weights, and the weights are normally used for calculating the shortest path from one point to another point.For example, in order to represent a map we can use a graph, where vertices represent cities and edges represent routes that connect the cities. If routes are one-way then the graph will be directed; otherwise, it will be undirected.

Different types of algorithms that solve the shortest path problem.

Dijkstras AlgorithmFloyd-Warshall Algorithm Bellman-Ford AlgorithmGenetic Algorithm (GA)

Dijkstras AlgorithmIts a greedy algorithm.Dijkstra's algorithm is called the single-source shortest path. It is also known as the single source shortest path problem. It computes length of the shortest path from the source to each of the remaining vertices in the graph.In Dijkstra's solve the problem on a weighted directed graph from for case in which all edge widths are non negative.Dijkstras algorithm uses the greedy approach to solve the single source shortest problem.Breadth-first-search is an algorithm for finding shortest (link-distance) paths from a single source vertex to all other vertices.BFS has running time O(|V|+|E|)

Algorithm of Dijkstras // a little miss leading since the output is only the distanceAlgorithm:ShortestPath(G,v)input: A simple undirected weighted graphG withnon negative edge weights and a start vertex,v.output:D(u) the distanceuis fromv.

InitializeD(v) = 0 andD(u) =foru!=vInitialize priority queueQof vertices usingDas key.whileQis not emptydou=Q.removeMin()foreach vertexzadjacent touandinQdoifD(u) +w((u,z)) =1

Algorithm //cost [1:n,1:n] is the cost adjacency matrix of the graph with n vertices .//A[i , j] is the cost of the shortest path from vertex i to 1.Cost [i , j ]=0 to n do for i1 to n dofor j 1 to n doA[i , j] cost [i , j] //copy cost into Aend for end forfor k 1 to n dofor i1 to n dofor j 1 to n doA[i ,j] min{A[ i , j ],A[ i , k ]+A[ k ,j ] }end forend forend forreturn (A)end algorithm

n*nn*n*n

Example

124342-1 3 -2

Application

Shortest paths in directed graphs (Floyds algorithm).Finding a regular expression denoting the regular language accepted by a finite automaton (Kleenes algorithm)Fast computation of Pathfinder networks.Maximum Bandwidth Paths in Flow Networks

Kleene's algorithmtransforms a givendeterministic finite automaton(DFA) into aregular expression. Together with other conversion algorithms, it establishes the equivalence of several description formats forregular languages.12

Genetic AlgorithmGenetic Algorithms were invented to mimic some of the processes observed in natural evolution.The idea with GA is to use this power of evolution to solve optimization problems.The father of the original Genetic Algorithm was John Holland who invented it in the early 1970's.Genetic Algorithms (GAs) are adaptive heuristic search algorithm based on the evolutionary ideas of natural selection and genetics.In order to solve the shortest path problem using the GA, we need to generate a number of solutions, and then choose the most optimal one among the provided set of possible solutions.Useful when search space very large or too complex for analytic treatment.

Why genetic algorithm ?It is better than conventional AI in that it is more robust. Unlike older AI systems, they do not break easily even if the inputs changed slightly, or in the presence of reasonable noise. Also, in searching a genetic algorithm may offer significant benefits over more typical search of optimization techniques.GN are also used to graph coloring problem.

Evolutionary Principles of Genetic AlgorithmsSelection or survival of the fittest or giving preference to better outcomesGive preference to better individuals, allowing them to pass on their genes to the next generation.The goodness of each individual depends on its fitness.Fitness may be determined by an objective function or by a subjective judgement.

different types of selection methods Roulette Wheel selection method is chosen in order to solve the shortest path problem

15

Crossover combining portion of good outcomes to create even better outcomesPrime distinguished factor of GA from other optimization techniquesTwo individuals are chosen from the population using the selection operatorA crossover site along the bit strings is randomly chosenThe values of the two strings are exchanged up to this pointIf S1=000000 and s2=111111 and the crossover point is 2 then S1'=110000 and s2'=001111The two new offspring created from this mating are put into the next generation of the populationBy recombining portions of good individuals, this process is likely to create even better individuals

Mutation randomly trying combinations and evaluating the success of each With some low probability, a portion of the new individuals will have some of their bits flipped.Its purpose is to maintain diversity within the population and inhibit premature convergence.Mutation alone induces a random walk through the search spaceMutation and selection (without crossover) create a parallel, noise-tolerant, hill-climbing algorithms

Hill climbing is use a TSP17

Advantage It can solve every optimisation problem which can be described with the chromosome encoding.It solves problems with multiple solutions.Structural genetic algorithm gives us the possibility to solve the solution structure and solution parameter problem at the same time by means of genetic algorithm.Genetic algorithm are easily transferred to existing simulation and models.Disadvantages Certain optimisation problems(they are called variant problems) can not be solved by means of GA, this occurs due to poorly known fitness function which generate bad chromosome block in spite of the fact that only good chromosome blocks cross-over.There is no absolute assurance that a GA will find a global optimum . It happens very often when the populations have a lot of subject

If you have enough memory and time, Floyd-Warshall is clearly better because it takes much less time to code. But if you don't want every possible path, Floyd-Warshall may waste time by calculating too many unwanted shortest paths .In that case, you can go with Dijkstra.Take thousands or even millions of possible solutions and combining and recombining them until it finds the optimal solution.Conclusion