Uninformed Search. Hal Daumé III. Computer Science University of Maryland CS 421: Introduction to Artificial Intelligence 31 Jan 2012

Similar documents
CS 188: Artificial Intelligence Fall 2008

AI Adjacent Fields. This slide deck courtesy of Dan Klein at UC Berkeley

CSEP 573 Artificial Intelligence Winter 2016

CSCI 446: Artificial Intelligence

Today. Search Problems. Uninformed Search Methods. Depth-First Search Breadth-First Search Uniform-Cost Search

Search Gone Wrong? CS 188: Artificial Intelligence Fall Today. Announcements. General Tree Search. Recap: Search. Lecture 3: A* Search 9/3/2009

Solving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence Winter 2016

CS 221: Artificial Intelligence Fall 2011

Solving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence

Today. CS 188: Artificial Intelligence Fall Recap: Search. Example: Pancake Problem. Example: Pancake Problem. General Tree Search.

Announcements. CS 188: Artificial Intelligence Fall Recap: Search. Today. Example: Pancake Problem. Example: Pancake Problem

Announcements. CS 188: Artificial Intelligence Fall Recap: Search. Today. General Tree Search. Uniform Cost. Lecture 3: A* Search 9/4/2007

CS 188: Artificial Intelligence Fall Search Gone Wrong?

CS 5522: Artificial Intelligence II

Announcements. CS 188: Artificial Intelligence

CS321 Languages and Compiler Design I. Winter 2012 Lecture 5

Announcements. Project 0: Python Tutorial Due last night

2 Computing all Intersections of a Set of Segments Line Segment Intersection

CSCI 104. Rafael Ferreira da Silva. Slides adapted from: Mark Redekopp and David Kempe

CSC 2114: Artificial Intelligence Search

Ma/CS 6b Class 1: Graph Recap

Ma/CS 6b Class 1: Graph Recap

ITEC2620 Introduction to Data Structures

Fig.25: the Role of LEX

Regular Expression Matching with Multi-Strings and Intervals. Philip Bille Mikkel Thorup

Dr. D.M. Akbar Hussain

Pointer Analysis. CSE 501 Spring 15

COMP 423 lecture 11 Jan. 28, 2008

In the last lecture, we discussed how valid tokens may be specified by regular expressions.

CSE 473: Ar+ficial Intelligence

What are suffix trees?

Languages. L((a (b)(c))*) = { ε,a,bc,aa,abc,bca,... } εw = wε = w. εabba = abbaε = abba. (a (b)(c)) *

Lexical Analysis: Constructing a Scanner from Regular Expressions

Definition of Regular Expression

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus

CS 343: Artificial Intelligence

CS 241. Fall 2017 Midterm Review Solutions. October 24, Bits and Bytes 1. 3 MIPS Assembler 6. 4 Regular Languages 7.

CS 4100 // artificial intelligence

CS 188: Ar)ficial Intelligence

Page. Harsh Reality. Dynamic Memory Allocation. Malloc Package. Process Memory Image. Assumptions. Malloc Example

CSCI 446: Artificial Intelligence

Pointer Analysis. What is Points-to Analysis? Outline. What is Points-to Analysis? What is Points-to Analysis? What is Pointer Analysis? Rupesh Nasre.

If you are at the university, either physically or via the VPN, you can download the chapters of this book as PDFs.

Algorithm Design (5) Text Search

Today. Informed Search. Graph Search. Heuristics Greedy Search A* Search

521495A: Artificial Intelligence

CS311H: Discrete Mathematics. Graph Theory IV. A Non-planar Graph. Regions of a Planar Graph. Euler s Formula. Instructor: Işıl Dillig

CS143 Handout 07 Summer 2011 June 24 th, 2011 Written Set 1: Lexical Analysis

Informed Search A* Algorithm

Compression Outline :Algorithms in the Real World. Lempel-Ziv Algorithms. LZ77: Sliding Window Lempel-Ziv

Homework. Context Free Languages III. Languages. Plan for today. Context Free Languages. CFLs and Regular Languages. Homework #5 (due 10/22)

Context-Free Grammars

CS 188: Artificial Intelligence

Context-Free Grammars

Hyperbolas. Definition of Hyperbola

2-3 search trees red-black BSTs B-trees

CS201 Discussion 10 DRAWTREE + TRIES

Product of polynomials. Introduction to Programming (in C++) Numerical algorithms. Product of polynomials. Product of polynomials

CS 430 Spring Mike Lam, Professor. Parsing

Compilers Spring 2013 PRACTICE Midterm Exam

LING/C SC/PSYC 438/538. Lecture 21 Sandiway Fong

Registering as an HPE Reseller

Artificial Intelligence Informed Search

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών

Stack Manipulation. Other Issues. How about larger constants? Frame Pointer. PowerPC. Alternative Architectures

Graphing Conic Sections

CS481: Bioinformatics Algorithms

Distributed Systems Principles and Paradigms

1.5 Extrema and the Mean Value Theorem

CSCI 3130: Formal Languages and Automata Theory Lecture 12 The Chinese University of Hong Kong, Fall 2011

Suffix Tries. Slides adapted from the course by Ben Langmead

COMBINATORIAL PATTERN MATCHING

HDAR: Hole Detection and Adaptive Geographic Routing for Ad Hoc Networks

10.5 Graphing Quadratic Functions

Suffix trees, suffix arrays, BWT

Lecture T1: Pattern Matching

6.3 Volumes. Just as area is always positive, so is volume and our attitudes towards finding it.

ECE 468/573 Midterm 1 September 28, 2012

Very sad code. Abstraction, List, & Cons. CS61A Lecture 7. Happier Code. Goals. Constructors. Constructors 6/29/2011. Selectors.

Implementing Automata. CSc 453. Compilers and Systems Software. 4 : Lexical Analysis II. Department of Computer Science University of Arizona

Reducing a DFA to a Minimal DFA

The Greedy Method. The Greedy Method

PARALLEL AND DISTRIBUTED COMPUTING

Allocator Basics. Dynamic Memory Allocation in the Heap (malloc and free) Allocator Goals: malloc/free. Internal Fragmentation

Graph Search. Chris Amato Northeastern University. Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA

9.1 apply the distance and midpoint formulas

From Dependencies to Evaluation Strategies

CS 343H: Artificial Intelligence

Integration. September 28, 2017

Network Interconnection: Bridging CS 571 Fall Kenneth L. Calvert All rights reserved

Greedy Algorithm. Algorithm Fall Semester

CSc 453. Compilers and Systems Software. 4 : Lexical Analysis II. Department of Computer Science University of Arizona

Unit 5 Vocabulary. A function is a special relationship where each input has a single output.

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,

521495A: Artificial Intelligence

LECT-10, S-1 FP2P08, Javed I.

TO REGULAR EXPRESSIONS

CS 321 Programming Languages and Compilers. Bottom Up Parsing

EECS150 - Digital Design Lecture 23 - High-level Design and Optimization 3, Parallelism and Pipelining

Rational Numbers---Adding Fractions With Like Denominators.

Transcription:

1 Hl Dumé III (me@hl3.nme) Uninformed Serch Hl Dumé III Comuter Science University of Mrylnd me@hl3.nme CS 421: Introduction to Artificil Intelligence 31 Jn 2012 Mny slides courtesy of Dn Klein, Sturt Russell, or Andrew Moore

2 Hl Dumé III (me@hl3.nme) Announcements Forgot to tell you login informtion for we ge: User nme = cs421 (ut no uotes) Pssword = (still no uotes) (this will e used for osting solutions) Junkfood mchines: You my develo t home, ut must run on Junkfood Homework 1 hs een osted Project 1 will e osted soon

3 Hl Dumé III (me@hl3.nme) Tody Agents tht Pln Ahed Serch Prolems Uniformed Serch Methods Deth-First Serch Bredth-First Serch Uniform-Cost Serch

4 Hl Dumé III (me@hl3.nme) Serch Prolems A serch rolem consists of: A stte sce A successor function N, 1.0 A strt stte nd gol test E, 1.0 A solution is seuence of ctions ( ln) which trnsforms the strt stte to gol stte

5 Hl Dumé III (me@hl3.nme) Reflex Agents Reflex gents: Choose ction sed on current ercet nd memory My hve memory or model of the world s current stte Do not consider the future conseuences of their ctions Cn reflex gent e rtionl? [demo: reflex ]

6 Hl Dumé III (me@hl3.nme) Gol Bsed Agents Gol-sed gents: Pln hed Decisions sed on (hyothesized) conseuences of ctions Must hve model of how the world evolves in resonse to ctions [demo: ln fst / slow ]

7 Hl Dumé III (me@hl3.nme) Serch Trees N, 1.0 E, 1.0 A serch tree: This is wht if tree of lns nd outcomes Strt stte t the root node Children corresond to successors Nodes leled with sttes, corresond to PLANS to those sttes For most rolems, cn never uild the whole tree So, hve to find wys to use only the imortnt rts!

8 Hl Dumé III (me@hl3.nme) Stte Sce Grhs u.hl3.nme/ic.l?= There s some ig grh in which Ech stte is node Ech successor is n outgoing rc Imortnt: For most rolems we could never ctully uild this grh How mny sttes in Pcmn? S d c h Lughly tiny serch grh for tiny serch rolem e r f G

9 Hl Dumé III (me@hl3.nme) Exmle: Romni

10 Hl Dumé III (me@hl3.nme) Another Serch Tree Serch: Exnd out ossile lns Mintin fringe of unexnded lns Try to exnd s few tree nodes s ossile

11 Hl Dumé III (me@hl3.nme) Sttes vs. Nodes Prolem grhs hve rolem sttes Reresent n strcted stte of the world Hve successors, redecessors, cn e gol / non-gol Serch trees hve serch nodes Reresent ln (th) which results in the node s stte Hve 1 rent, length nd cost, oint to rolem stte Exnd uses successor function to crete new tree nodes The sme rolem stte in multile serch tree nodes

12 Hl Dumé III (me@hl3.nme) Generl Tree Serch Imortnt ides: Fringe Exnsion Exlortion strtegy Detiled seudocode is in the ook! Min uestion: which fringe nodes to exlore?

13 Hl Dumé III (me@hl3.nme) Exmle: Tree Serch c G S d h e f r

Stte Grhs vs Serch Trees S d c h e G f Ech NODE in in the serch tree is n entire PATH in the rolem grh. r S We lmost lwys construct oth on demnd nd we construct s little s ossile. 14 Hl Dumé III (me@hl3.nme) d c h e r f c G e h r f c G

15 Hl Dumé III (me@hl3.nme) Review: Deth First Serch S d c e h f r c G e h f r c G S G d c e h f r h f d c e r Strtegy: exnd deeest node first Imlementtion: Fringe is LIFO stck

Review: Bredth First Serch Strtegy: exnd shllowest node first Imlementtion: Fringe is FIFO ueue S d c h e r G f S Serch Tiers d c h e r h e r f f c G c G 16 Hl Dumé III (me@hl3.nme)

17 Hl Dumé III (me@hl3.nme) Serch Algorithm Proerties Comlete? Gurnteed to find solution if one exists? Otiml? Gurnteed to find the lest cost th? Time comlexity? Sce comlexity? Vriles: n Numer of sttes in the rolem The verge rnching fctor B (the verge numer of successors) C* Cost of lest cost solution s Deth of the shllowest solution m Mx deth of the serch tree

18 Hl Dumé III (me@hl3.nme) DFS n # sttes vg rnch C* lest cost s shllow gol m mx deth Algorithm Comlete Otiml Time Sce DFS Deth First Serch N N N N O(B Infinite LMAX ) O(LMAX) Infinite START GOAL Infinite ths mke DFS incomlete How cn we fix this?

19 Hl Dumé III (me@hl3.nme) DFS With cycle checking, DFS is comlete. 1 node nodes 2 nodes m tiers n # sttes vg rnch C* lest cost s shllow gol m mx deth u.hl3.nme/ic.l?=dfs m nodes Algorithm Comlete Otiml Time Sce DFS w/ Pth Checking N N O(B LMAX ) O(LMAX) Y

20 Hl Dumé III (me@hl3.nme) BFS n # sttes vg rnch C* lest cost s shllow gol m mx deth s tiers 1 node nodes 2 nodes s nodes m nodes

21 Hl Dumé III (me@hl3.nme) Itertive Deeening Itertive deeening uses DFS s suroutine: 1. Do DFS which only serches for ths of length <=1 (DFS gives u on th of length 2) 2. If 1 filed, do DFS which only serches ths of length 2 or less. 3. If 2 filed, do DFS which only serches ths of length 3 or less..nd so on. n # sttes vg rnch C* lest cost s shllow gol m mx deth Algorithm Comlete Otiml Time Sce DFS w/ Pth Y BFS ID Checking Y Y

22 Hl Dumé III (me@hl3.nme) Comrisons n # sttes vg rnch C* lest cost s shllow gol m mx deth When will BFS outerform DFS? When will DFS outerform BFS?

Costs on Actions START 2 3 1 1 d 2 c 3 8 2 e 9 8 2 h 4 4 15 r GOAL 2 f 1 Notice tht BFS finds the shortest th in terms of numer of trnsitions. It does not find the lest-cost th. We will uickly cover n lgorithm which does find the lest-cost th. 23 Hl Dumé III (me@hl3.nme)

Uniform Cost Serch Exnd cheest node first: Fringe is riority ueue S 1 2 1 3 d 15 8 9 2 c h e 8 1 r G f 2 1 S 0 Cost contours 4 6 24 Hl Dumé III (me@hl3.nme) d c 3 9 1 11 h e 13 r f 11 c G 5 7 8 10 h e 17 11 r f c G 16

25 Hl Dumé III (me@hl3.nme) Priority Queue Refresher A riority ueue is dt structure in which you cn insert nd retrieve (key, vlue) irs with the following oertions:.ush(key, vlue).o() inserts (key, vlue) into the ueue. returns the key with the lowest vlue, nd removes it from the ueue. You cn romote or demote keys y resetting their riorities Unlike regulr ueue, insertions into riority ueue re not constnt time, usully O(log n) We ll need riority ueues for most cost-sensitive serch methods.

26 Hl Dumé III (me@hl3.nme) Uniform Cost Serch Wht will UCS do for this grh? 0 START 1 0 1 GOAL Wht does this men for comleteness?

27 Hl Dumé III (me@hl3.nme) Uniform Cost Serch Algorithm Comlete Otiml Time Sce DFS BFS UCS w/ Pth Checking Y* Y O(C* C*/ε ) O( C*/ε ) n # sttes vg rnch C* lest cost s shllow gol m mx deth C*/ε tiers We ll tlk more out uniform cost serch s filure cses lter

Uniform Cost Prolems Rememer: exlores incresing cost contours c 1 c 2 The good: UCS is comlete nd otiml! c 3 The d: Exlores otions in every direction No informtion out gol loction Strt Gol 28 Hl Dumé III (me@hl3.nme) [demo: ucs contours ]

29 Hl Dumé III (me@hl3.nme) Heuristics

30 Hl Dumé III (me@hl3.nme) Best First / Greedy Serch Exnd the node tht seems closest Wht cn go wrong?

31 Hl Dumé III (me@hl3.nme) Best First / Greedy Serch START h=12 h=11 2 1 3 d 1 4 15 h=11 h=8 h=8 8 2 c 2 e 9 1 9 h 4 3 h=9 h=5 h=4 h=6 2 f 5 r h=6 GOAL 5 h=0 h=4

32 Hl Dumé III (me@hl3.nme) Best First / Greedy Serch A common cse: Best-first tkes you stright to the (wrong) gol Worst-cse: like dlyguided DFS in the worst cse Cn exlore everything Cn get stuck in loos if no cycle checking Like DFS in comleteness (finite sttes w/ cycle checking)

33 Hl Dumé III (me@hl3.nme) Serch Gone Wrong?

34 Hl Dumé III (me@hl3.nme) Extr Work? Filure to detect reeted sttes cn cuse exonentilly more work. Why?

35 Hl Dumé III (me@hl3.nme) Grh Serch In BFS, for exmle, we shouldn t other exnding the circled nodes (why?) S d e c e h r h r f f c G c G

36 Hl Dumé III (me@hl3.nme) Grh Serch Very simle fix: never exnd stte tye twice Cn this wreck comleteness? Why or why not? How out otimlity? Why or why not?

37 Hl Dumé III (me@hl3.nme) Some Hints Grh serch is lmost lwys etter thn tree serch (when not?) Fringes re sometimes clled closed lists ut don t imlement them with lists (use sets)! Nodes re concetully ths, ut etter to reresent with stte, cost, nd reference to rent node

38 Hl Dumé III (me@hl3.nme) Best First Greedy Serch n # sttes vg rnch C* lest cost s shllow gol m mx deth Algorithm Comlete Otiml Time Sce Greedy Best-First Serch Y* N O( m ) O( m ) m Wht do we need to do to mke it comlete? Cn we mke it otiml? Next clss!