Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Q1.

A comparative Analysis of A* and DFS


You have observed that the A* search algorithm performs better than DFS given the same start
and goal state configurations. What is the reason for this? Your comparative analysis should be
between 300-400 words, and should include relevant references if necessary
Ans1: The A* is an informed search which based on the BFS algorithm so it visits the every
nodes once. There is no need to visit the nodes and then retrieve to the base path for revisiting of
the nodes. But on the other hand in DFS is an uninformed search which does not keep record of
the node visited as well as it visit the nodes depth and the retrieve the node till it find the next
path which makes it costly algorithm. A* is far better algorithm in performance in many cases
since it is informed search as well as it does not visit any nodes twice but in the specific cases
where we can find the element at the depth of the graph DFS is better since it searches is depth,
but in most generic cases A* algorithm is better. The reason for A* search algorithm performs
better than DFS given the same start and goal state configurations is that A* search algorithms
uses BFS, and heuristics that keeps track of the cost of each node and expands the nodes which
has less cost, where as Depth first search is a uniformed search that does not use any heuristics
therefore does not know which path would be costly, so it starts from the root node and goes
deep into the branch of the tree while traversing each node until there is no further node, before it
starts backtracking meaning going backwards to where it came from. DFS keeps record of the
visited nodes so that it does not get in to a loop. But, it depends on the system requirements since
there are systems that finds the data in depth end of the node but if talk about the generic solution
for the search a node from graph we can say that A* algorithm is a better solution.
There are situations in which A* is not the best algorithm to solve a problem. However, there are a
number of ways to assess what constitutes the best algorithm for finding a solution.
If you are considering best in terms of performance of multiple searches from a single source to
many destinations, then you should consider using a more suitable approach (Dijkstra's algorithm).
If you are considering best in terms of performance, then in some special cases DFS and BFS will
significantly outperform A*. From past experience, this occurs for very small, almost trivial graphs,
but would require careful testing and profiling to make a stronger statement.
If you are considering best in terms of path-length, that is how long the final path produced by the
algorithm is, then A* is equivalent to any other optimal search algorithm.
If you are considering best in terms of completeness, that is, will the algorithm always find a path to
the goal if such a path exists. If so, then A* is equivalent to any other complete algorithm (for
example, breadth-first-search).
If you are considering best in cases where some of the weights in the graph are negative, then
you will need to use a special algorithm to solve those problems (for example bellman-ford)
If you are considering best in cases where the no heuristic is available then you must fall back
onh(x,y)=0 forall states x and y. In this case A* is equivalent to best first search.
If you are considering best in cases related to motion planning in continuous configuration
spaces, then A* may work adequately in low dimensions, but storage of the search graph starts to
become impractical at high dimensions, and the need to use probabilistically complete algorithms
increases (for example RRT, Bi-RRT, RDT)
If you are considering best in cases where the graph is partially observable, you only know a
subset of all the possible vertices and edges within the graph at any time, and you need to change
state to observe more of the graph, then you need an alternative algorithm designed for this (for
example, Keonig's Lifelong Planning A*, LPA*, does exactly this).
If you are considering best in cases where the graph changes over time, which occurs frequently in
robotics when you incorporate moving obstacles, then you need an algorithm which is designed for
this (for example Stentz's D* or Koenig & Likhachev's D*-Lite).


Before you understand A*, you must first understand Dijkstra's algorithm. Given a graph (a set of
nodes, and edges between nodes) and the (positive) "distance" of each edge (e.g. the road
distance), Dijkstra's algorithm gives the shortest distance between a certain source node and each
destination node. For instance, in your graph, the nodes may be road-intersections, the edges may
be the roads, and the weight/distance you put on an edge may be the length of that road, or the time
it takes to traverse it, or whatever.Dijkstra's algorithm always gives the correct distance according to
the weights you have put on the edges. In fact, the graph need not even be embeddable in a plane,
i.e., there may be no notion of "straight line distance" in the first place. It can be any arbitrary graph.
Now, A* can be thought of as a particular heuristic to speed up Dijkstra's algorithm. You can think of
it as using a heuristic to decide the order in which to consider nodes in the graph.
Formally: you have a graph G, two nodes s and t in it, and you want to find the distance d(s,t)
between s and t. (The distance is according to the graph, e.g. according to road distance in your
example.) To find d(s,t), in A* you use a heuristic function h(x) which satisfies h(x) d(x,t).
For instance (just one possibility), you can choose h(x) to be the straight line distance from x to t.
The better h(x) is as an estimate of d(x,t), the faster the A* algorithm will run, but the choice of h
affects only the speed, not the answer: it will always give the shortest distance according to d, not h.
So to find the road distance s to t, just set d(u,v) to be the road distance for every pair of nodes u
and v with a road between them, run A*, and you'll find the d(s,t) you want.
http://stackoverflow.com/questions/9511118/a-star-a-vs-bfs-dfs-ucs-etc
http://www.oriontransfer.co.nz/research/Inverse%20Kinematics%20A-star.pdf


http://upe.acm.jhu.edu/websites/Benny_Tsai/Introduction%20to%20AStar.htm
http://stackoverflow.com/questions/9511118/a-star-a-vs-bfs-dfs-ucs-etc

References
http://www.cs.rmit.edu.au/AI-Search/Product/
http://upe.acm.jhu.edu/websites/Benny_Tsai/Introduction%20to%20AStar.htm
Artificial Intelligence By Peter Norvig Second Edition.

You might also like