A * Search A* (pronounced "A star") is a best first, graph search algorithm that finds the least-cost path from a given initial node to one goal node out.

Slides:



Advertisements
Similar presentations
Longest Common Subsequence
Advertisements

Traveling Salesperson Problem
Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
Greedy Algorithms Amihood Amir Bar-Ilan University.
Discrete Math for Computer Science. Mathematical Model Real-world Problem Computerized Solution Abstract Model Transformed Model picture of the real worldpicture.
22C:19 Discrete Structures Trees Spring 2014 Sukumar Ghosh.
Graphs Chapter 12. Chapter Objectives  To become familiar with graph terminology and the different types of graphs  To study a Graph ADT and different.
Graphs Graphs are the most general data structures we will study in this course. A graph is a more general version of connected nodes than the tree. Both.
Chapter 3 The Greedy Method 3.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Applied Discrete Mathematics Week 12: Trees
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
CS 206 Introduction to Computer Science II 11 / 10 / 2008 Instructor: Michael Eckmann.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Sequence Alignment Bioinformatics. Sequence Comparison Problem: Given two sequences S & T, are S and T similar? Need to establish some notion of similarity.
Multiple Sequence alignment Chitta Baral Arizona State University.
Algorithms All pairs shortest path
Fall 2007CS 2251 Graphs Chapter 12. Fall 2007CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs To.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
1 GRAPHS - ADVANCED APPLICATIONS Minimim Spanning Trees Shortest Path Transitive Closure.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
Dijkstra’s Algorithm. Announcements Assignment #2 Due Tonight Exams Graded Assignment #3 Posted.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
COMP261 Lecture 7 A* Search. A* search Can we do better than Dijkstra's algorithm? Yes! –want to explore more promising paths, not just shortest so far.
Graphs. Graphs Similar to the graphs you’ve known since the 5 th grade: line graphs, bar graphs, etc., but more general. Those mathematical graphs are.
State space representations and search strategies - 2 Spring 2007, Juris Vīksna.
1 Directed Graphs Chapter 8. 2 Objectives You will be able to: Say what a directed graph is. Describe two ways to represent a directed graph: Adjacency.
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Fall 2008Simple Parallel Algorithms1. Fall 2008Simple Parallel Algorithms2 Scalar Product of Two Vectors Let a = (a 1, a 2, …, a n ); b = (b 1, b 2, …,
Graph Theory. undirected graph node: a, b, c, d, e, f edge: (a, b), (a, c), (b, c), (b, e), (c, d), (c, f), (d, e), (d, f), (e, f) subgraph.
Lossless Decomposition and Huffman Codes Sophia Soohoo CS 157B.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
1 8puzzle. 2 A* search algorithm A* is a best-first, graph search algorithm that finds the least-cost path from a given initial node to one goal node.
Minimum Edit Distance Definition of Minimum Edit Distance.
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
CSE 326: Data Structures Lecture #17 Heuristic Graph Search Henry Kautz Winter Quarter 2002.
Discrete Structures Li Tak Sing( 李德成 ) Lectures
Spell checking. Spelling Correction and Edit Distance Non-word error detection: – detecting “graffe” “ سوژن ”, “ مصواک ”, “ مداا ” Non-word error correction:
1 A* search Outline In this topic, we will look at the A* search algorithm: –It solves the single-source shortest path problem –Restricted to physical.
Definition of Minimum Edit Distance
Chapter 5 : Trees.
Greedy Technique.
The Greedy Method and Text Compression
Courtsey & Copyright: DESIGN AND ANALYSIS OF ALGORITHMS Courtsey & Copyright:
The Greedy Method and Text Compression
Distance Functions for Sequence Data and Time Series
Algorithms and Data Structures Lecture XIII
Advanced Algorithms Analysis and Design
Single-Source All-Destinations Shortest Paths With Negative Costs
Enumerating Distances Using Spanners of Bounded Degree
Greedy Algorithms / Dijkstra’s Algorithm Yin Tat Lee
Single-Source All-Destinations Shortest Paths With Negative Costs
Intro to Alignment Algorithms: Global and Local
Dynamic Programming Computation of Edit Distance
Algorithms and Data Structures Lecture XIII
Applied Combinatorics, 4th Ed. Alan Tucker
Minimum Spanning Tree Algorithms
CSE 589 Applied Algorithms Spring 1999
COMPS263F Unit 2 Discrete Structures Li Tak Sing( 李德成 ) Room A
Lecture 8. Paradigm #6 Dynamic Programming
Dynamic Programming-- Longest Common Subsequence
Important Problem Types and Fundamental Data Structures
New Jersey, October 9-11, 2016 Field of theoretical computer science
Analysis of Algorithms CS 477/677
Fragment Assembly 7/30/2019.
More Graphs Lecture 19 CS2110 – Fall 2009.
Presentation transcript:

A * Search A* (pronounced "A star") is a best first, graph search algorithm that finds the least-cost path from a given initial node to one goal node out of one or more possible goals.

Definitions A * uses a distance-plus-estimate heuristic function denoted by f(x) to determine the order in which the search visits nodes in the tree induced by the search. The distance-plus-estimate heuristic is a sum of two functions: the path-cost function denoted g(x) from the start node to the current node and an admissible "heuristic estimate" of the distance to the goal denoted h(x). an admissible h(x) must not overestimate the distance to the goal. For an application like routing, h(x) might represent the straight-line distance to the goal, since that is physically the smallest possible distance between any two points (or nodes for that matter).

An A * algorithm for Edit Distance Edit Distance D E (X,Y) measures how close string X is to string Y. D E (X,Y) is the cost of the minimum cost transformation t : X  t Y where t is a sequence of operations (insertion, equal substitution, unequal substitution, and deletion). The cost of t is the sum of the operation costs where each operation costs 1 except for equal substitution which costs 0. ABBAC BAACA The cost of this transformation is 3 which happens to be minimal.

Dynamic programming Solution (an O(mn) solution) Decomposition : Last Operation Delete, Substitute, or Insert Atomic Problems : X prefix or Y prefix empty Table : Rows for 0.. M for X prefix characters, Columns 0.. N for Y prefix characters Table Entry : D E (Xi, Yj) Composition :  = cost(Substitution) = 1 if x i != y j and 0 otherwise. D E (X i,Y j ) = min{ D E (X i-1,Y j ) + 1, D E (X l-1,Y j-1 ) + , D E (X i,Y j-1 ) + 1 }

Edit Distance as a Shortest Path Problem Define a transformation graph G XY = (V,E) as follows: The set V of nodes (vertices) = {0.. M}  {0.. N} where node n pq represents the state of transforming a p length prefix of X into a q length prefix of Y. The set E of edges represent the operations of deletion, connecting node n p,q to n p+1,q with length 1 substitution, connecting node n p,q to n p+1,q+1 with length 0 or 1 depending on whether X p+1 = Y q+1 or not insertion, connecting node n p,q to n p,q+1 with length 1 The start and goal nodes are n 0,0 and n M,N

Introduction Edit Distance – Based on Single Character Edit Operations  Insertion :  a  Inserts an “a” into target without effecting the source; cost = 1  Equal Substitution : a  a  Substitutes an “a” into target for an “a” in source; cost = 0  Unequal Substitution : a  b  Substitutes a “b” into target for an “a” in source; cost = 1  Deletion : a   Deletes an “a” from source without effecting the target; cost = 1

Example of a Transformation Graph The vertices of T correspond to prefix pairs of X and Y. The edges of T are directed and correspond to the single character edit operations which would transform one prefix pair into another. Example of a Transformation Graph X = abbab Y = bbaba

D E (X,Y) = cost of shortest path start vertex to goal vertex = 2

A frequency based Lower Bound function h Let X i be the suffix of X beginning with the ith character and Y j be similarly defined. If X = abbab and Y = bbaba X 2 = bbab and Y 2 = baba Excess(X 2,Y 2,a) = 0 Def(X 2,Y 2,a) =1 Excess(X 2,Y 2,b) = 0 Def(X 2,Y 2,b) =0 Excess(X 2,Y 2 ) is sum of excesses over alphabet and Def(X 2,Y 2 ) is sum of deficiencies. h( X 2,Y 2 ) = max{Excess(X 2,Y 2 ),Def(X 2,Y 2 )} is a lower bound to the length of the shortest path from vertex to goal.

Classification and Strings

Applications of Edit Distance DNA analysis Classification of heart beats. Handwriting recognition. Spelling correction. Error correction of variable length codes. Speech recognition.

Discrete Directional Alphabet

Mapping EKG’s to Strings

Classification as Path Problem LB(Start,Goal-1) = 0 LB(Start,Goal-2) = 3

Lower Bounds to Edit Distance Lower Bound Based on Frequency  Let f a (X) and f a (Y) be the frequencies of a in X and Y.  Define Ex(a,X,Y) = f a (X) – f a (Y) if f a (X) > f a (Y) else 0  Define Def(a,X,Y) = f a (Y) – f a (X) if f a (Y) > f a (X) else 0  For any a, both Ex(a,X,Y) and Def(a,X,Y)  D(X,Y)  Ex(a,X,Y) + Ex(b,X,Y)  D(X,Y).  max {  a Ex(a,X,Y),  a Def(a,X,Y) }  D(X,Y)  LB(i,j,X,Y) computed for the ith suffix of X and the jth suffix of Y is a lower bound to the remaining distance after having computed the edit distance for the ith and jth prefixes of X and Y.

Lower Bounds to Edit Distance Lower Bound Based on Frequency Since X has a deficiency of 1 b with Y1 as a target, 1 is a lower bound to D(X,Y1). Since X has a deficiency of 2 a’s with Y2 as a target and an excess of 1 b, 2 is a lower bound to D(X,Y2). Since X has a deficiency of 3 b’s with Y3 as a target and an excess of 2 a’s, 3 is a lower bound to D(X,Y3). Consequently the initial vertices of the 3 transformation graphs are organized into a priority queue as shown to the left.

A * Search for Closest Target f = h + g Keeping track of last operation since insertion cannot be followed by deletion and vise versa

A * Search for Closest Target Finds distance of 1 to Y1 in 3 steps. Y1 must be a closest goal since bnd + dist is minimized.