Informed Search. CS 486/686 University of Waterloo May 10. cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart

Similar documents
Informed Search. CS 486/686: Introduction to Artificial Intelligence Fall 2013

A.I.: Informed Search Algorithms. Chapter III: Part Deux

Informed search strategies (Section ) Source: Fotolia

Informed/Heuristic Search

CS 331: Artificial Intelligence Informed Search. Informed Search

CS 331: Artificial Intelligence Informed Search. Informed Search

Heuristic Search. Heuristic Search. Heuristic Search. CSE 3401: Intro to AI & LP Informed Search

Informed Search and Exploration for Agents

Mustafa Jarrar: Lecture Notes on Artificial Intelligence Birzeit University, Chapter 3 Informed Searching. Mustafa Jarrar. University of Birzeit

Outline. Best-first search

CSC384: Intro to Artificial Intelligence Search III

Outline. Best-first search

Informed Search Methods

Lecture 4: Informed/Heuristic Search

Artificial Intelligence

Informed search algorithms. (Based on slides by Oren Etzioni, Stuart Russell)

Informed Search Algorithms

Dr. Mustafa Jarrar. Chapter 4 Informed Searching. Artificial Intelligence. Sina Institute, University of Birzeit

Ar#ficial)Intelligence!!

Informed Search. Xiaojin Zhu Computer Sciences Department University of Wisconsin, Madison

CPS 170: Artificial Intelligence Search

CS 380: Artificial Intelligence Lecture #4

Informed search. Soleymani. CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2016

Solving problems by searching

Chapter 3: Informed Search and Exploration. Dr. Daisy Tang

Informed search algorithms

ARTIFICIAL INTELLIGENCE. Informed search

CS 771 Artificial Intelligence. Informed Search

Artificial Intelligence

Problem Solving and Search

Informed (Heuristic) Search. Idea: be smart about what paths to try.

S A E RC R H C I H NG N G IN N S T S A T T A E E G R G A R PH P S

COMP9414: Artificial Intelligence Informed Search

CS:4420 Artificial Intelligence

Informed search methods

Lecture 5 Heuristics. Last Time: A* Search

ITCS 6150 Intelligent Systems. Lecture 5 Informed Searches

Informed search algorithms. Chapter 4

CSE 473. Chapter 4 Informed Search. CSE AI Faculty. Last Time. Blind Search BFS UC-BFS DFS DLS Iterative Deepening Bidirectional Search

Artificial Intelligence Informed search. Peter Antal

COMP9414/ 9814/ 3411: Artificial Intelligence. 5. Informed Search. Russell & Norvig, Chapter 3. UNSW c Alan Blair,

COMP9414: Artificial Intelligence Informed Search

Informed Search and Exploration

Informed search algorithms. Chapter 4, Sections 1 2 1

Informed search methods

Informed Search A* Algorithm

Lecture 4: Search 3. Victor R. Lesser. CMPSCI 683 Fall 2010

4 INFORMED SEARCH AND EXPLORATION. 4.1 Heuristic Search Strategies

mywbut.com Informed Search Strategies-I

Problem Solving & Heuristic Search

Outline. Informed Search. Recall: Uninformed Search. An Idea. Heuristics Informed search techniques More on heuristics Iterative improvement

Heuris'c Search. Reading note: Chapter 4 covers heuristic search.

Outline. Informed search algorithms. Best-first search. Review: Tree search. A search Heuristics. Chapter 4, Sections 1 2 4

Informed Search. Notes about the assignment. Outline. Tree search: Reminder. Heuristics. Best-first search. Russell and Norvig chap.

Informed Search and Exploration

Dr. Mustafa Jarrar. Chapter 4 Informed Searching. Sina Institute, University of Birzeit

Graphs vs trees up front; use grid too; discuss for BFS, DFS, IDS, UCS Cut back on A* optimality detail; a bit more on importance of heuristics,

DFS. Depth-limited Search

Informed search algorithms. Chapter 3 (Based on Slides by Stuart Russell, Dan Klein, Richard Korf, Subbarao Kambhampati, and UW-AI faculty)

Lecture 2: Fun with Search. Rachel Greenstadt CS 510, October 5, 2017

Informed Search. Best-first search. Greedy best-first search. Intelligent Systems and HCI D7023E. Romania with step costs in km

Heuristic Search. Rob Platt Northeastern University. Some images and slides are used from: AIMA

Informed search algorithms

Today s s lecture. Lecture 3: Search - 2. Problem Solving by Search. Agent vs. Conventional AI View. Victor R. Lesser. CMPSCI 683 Fall 2004

CS 343: Artificial Intelligence

3 SOLVING PROBLEMS BY SEARCHING

Introduction to Artificial Intelligence. Informed Search

Informed search algorithms

Informed search algorithms. Chapter 4

Outline for today s lecture. Informed Search. Informed Search II. Review: Properties of greedy best-first search. Review: Greedy best-first search:

CS 4700: Foundations of Artificial Intelligence

Artificial Intelligence p.1/49. n-queens. Artificial Intelligence p.2/49. Initial state: the empty board or a board with n random

Artificial Intelligence

Announcements. CS 188: Artificial Intelligence

TDDC17. Intuitions behind heuristic search. Recall Uniform-Cost Search. Best-First Search. f(n) =... + h(n) g(n) = cost of path from root node to n

CS 188: Artificial Intelligence

Solving problems by searching

Solving problems by searching

CS 4700: Foundations of Artificial Intelligence

Informed Search and Exploration

CE 473: Artificial Intelligence. Autumn 2011

Informed Search and Exploration

Informed Search CS457 David Kauchak Fall 2011

Artificial Intelligence. Informed search methods

521495A: Artificial Intelligence

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

2006/2007 Intelligent Systems 1. Intelligent Systems. Prof. dr. Paul De Bra Technische Universiteit Eindhoven

CS 343H: Artificial Intelligence

Problem Solving: Informed Search

HW#1 due today. HW#2 due Monday, 9/09/13, in class Continue reading Chapter 3

Artificial Intelligence Informed Search

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

TDDC17. Intuitions behind heuristic search. Best-First Search. Recall Uniform-Cost Search. f(n) =... + h(n) g(n) = cost of path from root node to n

CSCI 446: Artificial Intelligence

Informed search algorithms

Informed search algorithms. (Based on slides by Oren Etzioni, Stuart Russell)

Informed Search. CMU Snake Robot. Administrative. Uninformed search strategies. Assignment 1 was due before class how d it go?

Informed search algorithms

Artificial Intelligence

Heuristic (Informed) Search

Transcription:

Informed Search CS 486/686 University of Waterloo May 0

Outline Using knowledge Heuristics Best-first search Greedy best-first search A* search Other variations of A* Back to heuristics 2

Recall from last lecture Uninformed search methods expand nodes based on distance from start node Never look ahead to the goal E.g. in uniform cost search expand the cheapest path. We never consider the cost of getting to the goal Advantage is that we have this information But, we often have some additional knowledge about the problem E.g. in traveling around Romania we know the distances between cities so can measure the overhead of going in the wrong direction 3

Informed Search Our knowledge is often on the merit of nodes Value of being at a node Different notions of merit If we are concerned about the cost of the solution, we might want a notion of how expensive it is to get from a state to a goal If we are concerned with minimizing computation, we might want a notion of how easy it is to get a state to a goal We will focus on cost of solution 4

Informed search We need to develop a domain specific heuristic function, h(n) h(n) guesses the cost of reaching the goal from node n The heuristic function must be domain specific We often have some information about the problem that can be used in forming a heuristic function (i.e. heuristics are domain specific) 5

Informed search If h(n)<h(n2) then we guess that it is cheaper to reach the goal from n than it is from n2 We require h(n)=0 when n is a goal node h(n)>= 0 for all other nodes 6

Greedy best-first search Use the heuristic function, h(n), to rank the nodes in the fringe Search strategy Expand node with lowest h-value Greedily trying to find the least-cost solution 7

Greedy best-first search: Example Heuristic function h=4 h=3 h=2 h= h=0 S A B C 2 2 G Path cost 4 8

Example cont h=4 h=3 h=2 h= h=0 S A B C 2 2 G 4 9

Example cont h=4 h=3 h=2 h= h=0 S A B C 2 2 G 4 0

Example cont h=4 h=3 h=2 h= h=0 S A B C 2 2 G 4

Example cont h=4 h=3 h=2 h= h=0 S A B C 2 2 G 4 2

Example cont h=4 h=3 h=2 h= h=0 S A B C 2 2 G Found the goal Path is S, A, C, G Cost of the path is 2+4+2=8 4 But cheaper path is S, A, B, C, G With cost 2+++2=6 Greedy best-first is not optimal 3

Another Example h=4 h=3 h=4 h=0 S A B G 2 2 C h= 4

Another Example h=4 h=3 h=4 S A B 2 2 h=0 G C h= Greedy best-first can get stuck in loops Not complete 5

Properties of greedy search Not optimal! Not complete! If we check for repeated states then we are ok Exponential space in worst case since need to keep all nodes in memory Exponential worst case time O(b m ) where m is the maximum depth of the tree If we choose a good heuristic then we can do much better 6

A* Search Greedy best-first search is too greedy It does not take into account the cost of the path so far! Define f(n)=g(n)+h(n) g(n) is the cost of the path to node n h(n) is the heuristic estimate of the cost of reaching the goal from node n A* search Expand node in fringe (queue) with lowest f value 7

A* Example h=4 h=3 h=2 h= h=0 S A B C 2 2 G. Expand S 2. Expand A 4 3. Choose between B (f(b)=3+2=5) and C (f(c)=6+=7) ) expand B 4. Expand C 5. Expand G recognize it is the goal 8

When should A* terminate? As soon as we find a goal state? S B h=3 h=7 A 7 C h=2 G D h= 7 9

When should A* terminate? As soon as we find a goal state? S B h=3 h=7 A 7 C h=2 G D h= A* Terminates only when goal state is popped from the queue 7 20

A* and revisiting states What if we revisit a state that was already expanded? S h=7 A B h=3 C 2 h=2 G 7 2

A* and revisiting states What if we revisit a state that was already expanded? S h=7 A B h=3 C 2 h=2 G 7 If we allow states to be expanded again, we might get a better solution! 22

Is A* Optimal? A h=6 S G 3 No. This example shows why not. 23

Admissible heuristics Let h*(n) denote the true minimal cost to the goal from node n A heuristic, h, is admissible if h(n) h*(n) for all n Admissible heuristics never overestimate the cost to the goal Optimistic 24

Optimality of A* If the heuristic is admissible then A* with tree-search is optimal Let G be an optimal goal state, and f(g) = f* = g(g). Let G 2 be a suboptimal goal state, i.e. f(g 2 ) = g(g 2 ) > f*. Assume for contradiction that A* has selected G 2 from the queue. (This would terminate A* with a suboptimal solution) Let n be a node that is currently a leaf node on an optimal path to G. Because h is admissible, f* f(n). If n is not chosen for expansion over G 2, we must have f(n) f(g 2 ) So, f* f(g 2 ). Because h(g 2 )=0, we have f* g(g 2 ), contradiction. 25

Optimality of A* For searching graphs we require something stronger than admissibility Consistency (monotonicity): h(n) cost(n,n )+h(n ) Almost any admissible heuristic function will also be consistent A* graph-search with a consistent heuristic is optimal 26

Properties of A* Completeif the heuristic is consistent Along any path, f always increases ) if a solution exists somewhere the f value will eventually get to its cost Exponential time complexity in worst case A good heuristic will help a lot here O(bm) if the heuristic is perfect Exponential space complexity 27

Memory-bounded heuristic search A* keeps most generated nodes in memory On many problems A* will run out of memory Iterative deepening A* (IDA*) Like IDS but change f-cost rather than depth at each iteration SMA* (Simplified Memory-Bounded A*) Uses all available memory Proceeds like A* but when it runs out of memory it drops the worst leaf node (one with highest f- value) If all leaf nodes have the same f-value then it drops oldest and expands the newest Optimal and complete if depth of shallowest goal node is less than memory size 28

Heuristic Functions A good heuristic function can make all the difference! How do we get heuristics? One approach is to think of an easier problem and let h(n) be the cost of reaching the goal in the easier problem 29

8-puzzle 7 2 4 2 5 6 3 4 5 8 3 6 7 8 Start State Goal State Relax the game. Can move tile from position A to position B if A is next to B (ignore whether or not position is blank) 2. Can move tile from position A to position B if B is blank (ignore adjacency) 3. Can move tile from position A to position B 30

8-puzzle cont 3 leads to misplaced tile heuristic To solve this problem need to move each tile into its final position Number of moves = number of misplaced tiles Admissible leads to manhattan distance heuristic To solve the puzzle need to slide each tile into its final position Admissible 3

8-puzzle cont h=misplaced tiles h2=manhattan distance Note h2 dominates h h(n) h2(n) for all n Which heuristic is best? 32

Designing heuristics Relaxing the problem (as just illustrated) Precomputing solution costs of subproblems and storing them in a pattern database Learning from experience with the problem class 33

Conclusion What you should now know Thoroughly understand A* and IDA* Be able to trace simple examples of A* and IDA* execution Understand admissibility of heuristics Proof of completeness, optimality Criticize greedy best-first search 34

Next class Local search Russell and Norvig Sections 4.3-4.5 35