CSE 326: Data Structures Lecture #17 Heuristic Graph Search Henry Kautz Winter Quarter 2002.

Slides:



Advertisements
Similar presentations
Review: Search problem formulation
Advertisements

Single Source Shortest Paths
Weighted graphs Example Consider the following graph, where nodes represent cities, and edges show if there is a direct flight between each pair of cities.
CSE 326: Data Structures Lecture #19 Approaches to Graph Exploration Bart Niswonger Summer Quarter 2001.
Graphs CSC 220 Data Structure. Introduction One of the Most versatile data structures like trees. Terminology –Nodes in trees are vertices in graphs.
CS344: Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture– 4, 5, 6: A* properties 9 th,10 th and 12 th January,
Artificial Intelligence Chapter 9 Heuristic Search Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
1 Searching in a Graph Jeff Edmonds York University COSC 3101 Lecture 5 Generic Search Breadth First Search Dijkstra's Shortest Paths Algorithm Depth First.
5-1 Chapter 5 Tree Searching Strategies. 5-2 Satisfiability problem Tree representation of 8 assignments. If there are n variables x 1, x 2, …,x n, then.
CS171 Introduction to Computer Science II Graphs Strike Back.
CSC 282: Design & Analysis of Efficient Algorithms Graph Algorithms Shortest Path Algorithms Fall 2013.
Heuristic State Space Seach Henry Kautz. Assignment.
State Space Search Algorithms CSE 472 Introduction to Artificial Intelligence Autumn 2003.
Review: Search problem formulation
Branch and Bound Searching Strategies
Graphs CS-240/341. Uses for Graphs computer networks and routing airline flights geographic maps course prerequisite structures tasks for completing a.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
CSE 326: Data Structures Lecture #21 Graphs II.5 Alon Halevy Spring Quarter 2001.
Using Search in Problem Solving
Lecture 3 Informed Search CSE 573 Artificial Intelligence I Henry Kautz Fall 2001.
Pathfinding Algorithms Josh Palmer Rachael Beers.
Minimal Spanning Trees. Spanning Tree Assume you have an undirected graph G = (V,E) Spanning tree of graph G is tree T = (V,E T E, R) –Tree has same set.
Problem Solving and Search in AI Heuristic Search
CSE 326: Data Structures Lecture #19 More Fun with Graphs Henry Kautz Winter Quarter 2002.
Class of 28 th August. Announcements Lisp assignment deadline extended (will take it until 6 th September (Thursday). In class. Rao away on 11 th and.
CSE 326: Data Structures Part 8 Graphs
Informed Search Idea: be smart about what paths to try.
Introduction to Routing. The Routing Problem Apply after placement Input: –Netlist –Timing budget for, typically, critical nets –Locations of blocks and.
CMU Snake Robot
Dijkstra’s Algorithm and Heuristic Graph Search David Johnson.
Graphs II Robin Burke GAM 376. Admin Skip the Lua topic.
CMPSCI Computer Science 187 Introduction to Introduction to Programming with Data Structures Introduction to Introduction to Programming with Data.
COSC 2007 Data Structures II Chapter 14 Graphs III.
Informed (Heuristic) Search
Informed search algorithms
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
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.
CSE 2331 / 5331 Topic 12: Shortest Path Basics Dijkstra Algorithm Relaxation Bellman-Ford Alg.
CS344: Introduction to Artificial Intelligence (associated lab: CS386)
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
1 Branch and Bound Searching Strategies Updated: 12/27/2010.
Advanced Artificial Intelligence Lecture 2: Search.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 3 - Search.
Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.
SPANNING TREES Lecture 20 CS2110 – Fall Spanning Trees  Definitions  Minimum spanning trees  3 greedy algorithms (incl. Kruskal’s & Prim’s)
Informed Search II CIS 391 Fall CIS Intro to AI 2 Outline PART I  Informed = use problem-specific knowledge  Best-first search and its variants.
State space representations and search strategies - 2 Spring 2007, Juris Vīksna.
Graph Algorithms GAM 376 Robin Burke Fall Outline Graphs Theory Data structures Graph search Algorithms DFS BFS Project #1 Soccer Break Lab.
Informed Search CSE 473 University of Washington.
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
SPANNING TREES Lecture 21 CS2110 – Fall Nate Foster is out of town. NO 3-4pm office hours today!
Searching for Solutions
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Artificial Intelligence Lecture No. 8 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Review: Tree search Initialize the frontier using the starting state
Heuristic Search A heuristic is a rule for choosing a branch in a state space search that will most likely lead to a problem solution Heuristics are used.
Heuristic Search Henry Kautz.
I206: Lecture 15: Graphs Marti Hearst Spring 2012.
Minimal Spanning Trees
Shortest Path Algorithms
Artificial Intelligence
CSE 473 University of Washington
HW 1: Warmup Missionaries and Cannibals
Informed Search Idea: be smart about what paths to try.
HW 1: Warmup Missionaries and Cannibals
CS621: Artificial Intelligence
Informed Search Idea: be smart about what paths to try.
Presentation transcript:

CSE 326: Data Structures Lecture #17 Heuristic Graph Search Henry Kautz Winter Quarter 2002

Huge Graphs Consider some really huge graphs… –All cities and towns in the World Atlas –All stars in the Galaxy –All ways 10 blocks can be stacked Huh???

Implicitly Generated Graphs A huge graph may be implicitly specified by rules for generating it on-the-fly Blocks world: –vertex = relative positions of all blocks –edge = robot arm stacks one block stack(blue,red) stack(green,red) stack(green,blue) stack(blue,table) stack(green,blue)

Blocks World Source = initial state of the blocks Goal = desired state of the blocks Path source to goal = sequence of actions (program) for robot arm! n blocks  n n vertices 10 blocks  10 billion vertices!

Problem: Branching Factor Cannot search such huge graphs exhaustively. Suppose we know that goal is only d steps away. Dijkstra’s algorithm is basically breadth-first search (modified to handle arc weights) Breadth-first search (or for weighted graphs, Dijkstra’s algorithm) – If out-degree of each node is 10, potentially visits 10 d vertices –10 step plan = 10 billion vertices visited!

An Easier Case Suppose you live in Manhattan; what do you do? 52 nd St 51 st St 50 th St 10 th Ave 9 th Ave 8 th Ave 7 th Ave6 th Ave5 th Ave4 th Ave 3 rd Ave 2 nd Ave S G

Best-First Search The Manhattan distance (  x+  y) is an estimate of the distance to the goal –a heuristic value Best-First Search –Order nodes in priority to minimize estimated distance to the goal h(n) Compare: BFS / Dijkstra –Order nodes in priority to minimize distance from the start

Best First in Action Suppose you live in Manhattan; what do you do? 52 nd St 51 st St 50 th St 10 th Ave 9 th Ave 8 th Ave 7 th Ave6 th Ave5 th Ave4 th Ave 3 rd Ave 2 nd Ave S G

Problem 1: Led Astray Eventually will expand vertex to get back on the right track 52 nd St 51 st St 50 th St 10 th Ave 9 th Ave 8 th Ave 7 th Ave6 th Ave5 th Ave4 th Ave 3 rd Ave 2 nd Ave S G

Problem 2: Optimality With Best-First Search, are you guaranteed a shortest path is found when –goal is first seen? –when goal is removed from priority queue (as with Dijkstra?)

Sub-Optimal Solution No! Goal is by definition at distance 0: will be removed from priority queue immediately, even if a shorter path exists! 52 nd St 51 st St 9 th Ave 8 th Ave 7 th Ave6 th Ave5 th Ave4 th Ave S G (5 blocks) h=2 h=1 h=4 h=5

Synergy? Dijkstra / Breadth First guaranteed to find optimal solution Best First often visits far fewer vertices, but may not provide optimal solution –Can we get the best of both?

A* (“A star”) Order vertices in priority queue to minimize (distance from start) + (estimated distance to goal) f(n) = g(n) + h(n) f(n) = priority of a node g(n) = true distance from start h(n) = heuristic distance to goal

Optimality Suppose the estimated distance (h) is always less than or equal to the true distance to the goal –heuristic is a lower bound on true distance Then: when the goal is removed from the priority queue, we are guaranteed to have found a shortest path!

Problem 2 Revisited 52 nd St 51 st St 9 th Ave 8 th Ave 7 th Ave6 th Ave5 th Ave4 th Ave S G (5 blocks) 50 th St vertexg(n)h(n)f(n) 52 nd & 9 th 055

Problem 2 Revisited 52 nd St 51 st St 9 th Ave 8 th Ave 7 th Ave6 th Ave5 th Ave4 th Ave S G (5 blocks) 50 th St vertexg(n)h(n)f(n) 52 nd & 4 th st & 9 th 145

Problem 2 Revisited 52 nd St 51 st St 9 th Ave 8 th Ave 7 th Ave6 th Ave5 th Ave4 th Ave S G (5 blocks) 50 th St vertexg(n)h(n)f(n) 52 nd & 4 th st & 8 th th & 9 th 257

Problem 2 Revisited 52 nd St 51 st St 9 th Ave 8 th Ave 7 th Ave6 th Ave5 th Ave4 th Ave S G (5 blocks) 50 th St vertexg(n)h(n)f(n) 52 nd & 4 th st & 7 th th & 9 th th & 8 th 347

Problem 2 Revisited 52 nd St 51 st St 9 th Ave 8 th Ave 7 th Ave6 th Ave5 th Ave4 th Ave S G (5 blocks) 50 th St vertexg(n)h(n)f(n) 52 nd & 4 th st & 6 th th & 9 th th & 8 th th & 7 th 437

Problem 2 Revisited 52 nd St 51 st St 9 th Ave 8 th Ave 7 th Ave6 th Ave5 th Ave4 th Ave S G (5 blocks) 50 th St vertexg(n)h(n)f(n) 52 nd & 4 th st & 5 th th & 9 th th & 8 th th & 7 th 437

Problem 2 Revisited 52 nd St 51 st St 9 th Ave 8 th Ave 7 th Ave6 th Ave5 th Ave4 th Ave S G (5 blocks) 50 th St vertexg(n)h(n)f(n) 52 nd & 4 th th & 9 th th & 8 th th & 7 th 437 DONE!

What Would Dijkstra Have Done? 52 nd St 51 st St 9 th Ave 8 th Ave 7 th Ave6 th Ave5 th Ave4 th Ave S G (5 blocks) 50 th St 49 th St 48 th St 47 th St

Proof of A* Optimality A* terminates when G is popped from the heap. Suppose G is popped but the path found isn’t optimal: priority(G) > optimal path length c Let P be an optimal path from S to G, and let N be the last vertex on that path that has been visited but not yet popped. There must be such an N, otherwise the optimal path would have been found. priority(N) = g(N) + h(N)  c So N should have popped before G can pop. Contradiction. S N G non-optimal path to G portion of optimal path found so far undiscovered portion of shortest path

What About Those Blocks? “Distance to goal” is not always physical distance Blocks world: –distance = number of stacks to perform –heuristic lower bound = number of blocks out of place # out of place = 2, true distance to goal = 3

Other Real-World Applications Routing finding – computer networks, airline route planning VLSI layout – cell layout and channel routing Production planning – “just in time” optimization Protein sequence alignment Many other “NP-Hard” problems –A class of problems for which no exact polynomial time algorithms exist – so heuristic search is the best we can hope for

Coming Up How to make Depth First Search optimal Other graph problems –Connected components –Spanning trees –Max-Flow Other cool data structures & algorithms –Search trees for graphical data –Huffman codes –Mergeable heaps