Search: The Core of Planning

Similar documents
CS 188: Artificial Intelligence Spring 2007

DATA Search I 魏忠钰. 复旦大学大数据学院 School of Data Science, Fudan University. March 7 th, 2018

Uninformed Search Lecture 4

Closure Properties of Regular Languages

Convert the NFA into DFA

Bellman Optimality Equation for V*

Nondeterminism and Nodeterministic Automata

19 Optimal behavior: Game theory

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Module 6 Value Iteration. CS 886 Sequential Decision Making and Reinforcement Learning University of Waterloo

KNOWLEDGE-BASED AGENTS INFERENCE

This lecture covers Chapter 8 of HMU: Properties of CFLs

Administrivia CSE 190: Reinforcement Learning: An Introduction

Minimal DFA. minimal DFA for L starting from any other

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.

Module 9: Tries and String Matching

Module 9: Tries and String Matching

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

1.4 Nonregular Languages

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

Faster Regular Expression Matching. Philip Bille Mikkel Thorup

Regular expressions, Finite Automata, transition graphs are all the same!!

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

Finite-State Automata: Recap

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Deterministic Finite Automata

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Chapter 5 Plan-Space Planning

Section: Other Models of Turing Machines. Definition: Two automata are equivalent if they accept the same language.

Where did dynamic programming come from?

Reinforcement Learning

Chapter 4 State-Space Planning

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

We will see what is meant by standard form very shortly

Theory of Computation Regular Languages

Reinforcement learning II

CMSC 330: Organization of Programming Languages

Java II Finite Automata I

CS 314 Principles of Programming Languages

NFAs continued, Closure Properties of Regular Languages

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Formal Methods in Software Engineering

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

Balanced binary search trees

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Formal Languages and Automata

Bayesian Networks: Approximate Inference

CS 267: Automated Verification. Lecture 8: Automata Theoretic Model Checking. Instructor: Tevfik Bultan

. Double-angle formulas. Your answer should involve trig functions of θ, and not of 2θ. sin 2 (θ) =

Lexical Analysis Part III

First Midterm Examination

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Lecture 6 Regular Grammars

Good-for-Games Automata versus Deterministic Automata.

Lecture 12: Numerical Quadrature

First Midterm Examination

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

{ } = E! & $ " k r t +k +1

Chapter 4: Dynamic Programming

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

1 Nondeterministic Finite Automata

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Decision Networks. CS 188: Artificial Intelligence Fall Example: Decision Networks. Decision Networks. Decisions as Outcome Trees

Efficient Planning. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction

On Determinisation of History-Deterministic Automata.

NFAs continued, Closure Properties of Regular Languages

The Knapsack Problem. COSC 3101A - Design and Analysis of Algorithms 9. Fractional Knapsack Problem. Fractional Knapsack Problem

Part 5 out of 5. Automata & languages. A primer on the Theory of Computation. Last week was all about. a superset of Regular Languages

Review of Gaussian Quadrature method

Introduction To Matrices MCV 4UI Assignment #1

Chapter 14. Matrix Representations of Linear Transformations

2D1431 Machine Learning Lab 3: Reinforcement Learning

Math& 152 Section Integration by Parts

Uses of transformations. 3D transformations. Review of vectors. Vectors in 3D. Points vs. vectors. Homogeneous coordinates S S [ H [ S \ H \ S ] H ]

Goals: Determine how to calculate the area described by a function. Define the definite integral. Explore the relationship between the definite

. Double-angle formulas. Your answer should involve trig functions of θ, and not of 2θ. cos(2θ) = sin(2θ) =.

Can the Phase I problem be unfeasible or unbounded? -No

Formal languages, automata, and theory of computation

Supervisory Control (4CM30)

Concepts of Concurrent Computation Spring 2015 Lecture 9: Petri Nets

CSC 473 Automata, Grammars & Languages 11/9/10

Math 520 Final Exam Topic Outline Sections 1 3 (Xiao/Dumas/Liaw) Spring 2008

Automata and Languages

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

Non-deterministic Finite Automata

Overview HC9. Parsing: Top-Down & LL(1) Context-Free Grammars (1) Introduction. CFGs (3) Context-Free Grammars (2) Vertalerbouw HC 9: Ch.

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

AM1 Mathematical Analysis 1 Oct Feb Exercises Lecture 3. sin(x + h) sin x h cos(x + h) cos x h

Homework 3 Solutions

CHAPTER 1 Regular Languages. Contents

Problem Set 3 Solutions

Finite Automata-cont d

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

CISC 4090 Theory of Computation

Math 4310 Solutions to homework 1 Due 9/1/16

New data structures to reduce data size and search time

Transcription:

Serch: The Core of Plnning Dr. Neil T. Dntm CSCI-498/598 RPM, Colordo School of Mines Spring 208 Dntm (Mines CSCI, RPM) Serch Spring 208 / 75

Outline Plnning nd Serch Problems Bsic Serch Depth-First Serch Bredth-First Serch Properties of Serch nd Plnning More Serch Vritions Itertive-Deepening Serch Bckwrd Serch Bidirectionl Serch Dntm (Mines CSCI, RPM) Serch Spring 208 2 / 75

Plnning nd Serch Problems Outline Plnning nd Serch Problems Bsic Serch Depth-First Serch Bredth-First Serch Properties of Serch nd Plnning More Serch Vritions Itertive-Deepening Serch Bckwrd Serch Bidirectionl Serch Dntm (Mines CSCI, RPM) Serch Spring 208 3 / 75

Plnning nd Serch Problems The Plnning / Serch Problem Given:. Stte spce: Q 2. Trnsition function δ : Q P (Q) 3. Strt stte: q 0 Q 4. Gol set: A Q Find: Pth p = (p 0,..., p n ) from strt to gol such tht: p 0 = q 0 is the strt stte p n A is gol stte Subsequent sttes re vlid trnsitions: p k+ δ(p k ) Dntm (Mines CSCI, RPM) Serch Spring 208 4 / 75

Plnning nd Serch Problems Serch Trees Stte Spce: Q = {, b, c, d, e, f, g, h, i, j, k, l, m} Trnsition Function: δ() = {b, c, d} δ(b) = {e, f, g} δ(c) = {h, i, j} δ(d) = {k, l, m} Explore / construct serch tree until finding the gol Dntm (Mines CSCI, RPM) Serch Spring 208 5 / 75

Plnning nd Serch Problems Exmple Domin 0: Gridworld Crtoon Grph Symbols 2 y 0 0 x 2 0, 2 0, 0, 0 strt, 2,, 0 2,22 2, 2, 0 Stte Spce: Q = {(0, 0), (0, ), (0, 2) (, 0), (, ), (, 2) (2, 0), (2, ), (2, 2)} Trnsitions: δ((0, 0)) = {(0, ), (, 0)} δ((, 0)) = {(0, 0), (, ), (2, 0)} δ((2, 0)) = {(, 0), (2, )}... Strt: q 0 = (0, 0) Gol: A = {(2, 2)} Dntm (Mines CSCI, RPM) Serch Spring 208 6 / 75

Plnning nd Serch Problems Exmple Domin : Towers of Hnoi Strt Gol b c b c. Only one disk cn be moved t time. 2. Ech move consists of tking the upper disk from one of the stcks nd plcing it on top of nother stck. 3. No disk my be plced on top of smller disk. Dntm (Mines CSCI, RPM) Serch Spring 208 7 / 75

Plnning nd Serch Problems Exmple Domin : Towers of Hnoi Trnsition Function Grph b (b), (), () b (), (b), () (), (), (b) b b (, b), (), () b (), (, b), () (), (), (, b) b b (b), (), () b (), (b), () (), (), (b) b Dntm (Mines CSCI, RPM) Serch Spring 208 8 / 75

Plnning nd Serch Problems Exmple Domin : Towers of Hnoi Symbolic Trnsition Function b (, b), (), () b (b), (), () b (b), (), () Trnsition Function: ( ) { } δ (, b), (), () = (b), (), (), (b), (), () ( δ (b), (), () ) { = (b), (), (), (), (), (b), (b), (), () } ( δ (b), (), () ) { = (b), (), (), (b), (), (), (), (b), () }... Strt: q 0 = (, b), (), () { } Gol: A = (), (), (, b) Dntm (Mines CSCI, RPM) Serch Spring 208 9 / 75

Plnning nd Serch Problems Exercise Domin 2: Auto Nvigtion Dntm (Mines CSCI, RPM) Serch Spring 208 0 / 75

Plnning nd Serch Problems Exercise Domin 2: Auto Nvigtion Dntm (Mines CSCI, RPM) Serch Spring 208 / 75

Plnning nd Serch Problems Exercise Domin 2: Auto Nvigtion Dntm (Mines CSCI, RPM) Serch Spring 208 2 / 75

Bsic Serch Outline Plnning nd Serch Problems Bsic Serch Depth-First Serch Bredth-First Serch Properties of Serch nd Plnning More Serch Vritions Itertive-Deepening Serch Bckwrd Serch Bidirectionl Serch Dntm (Mines CSCI, RPM) Serch Spring 208 3 / 75

Bsic Serch Depth-First Serch Depth-First Serch Step 0 W = () Step W = (b, c, d) Step 2 W = (e, f, g, c, d) Step 3 W = (f, g, c, d) Dntm (Mines CSCI, RPM) Serch Spring 208 4 / 75

Bsic Serch Depth-First Serch Depth-First Serch continued Step 4 W = (g, c, d) Step 5 W = (c, d) Step 6 W = (h, i, j, d) Step 7 W = (i, j, d) Dntm (Mines CSCI, RPM) Serch Spring 208 5 / 75

Bsic Serch Depth-First Serch Depth-First Serch continued 2 Step 8 W = (j, d) Step 9 W = (d) Step 0 W = (k, l, m) Step W = (l, m) Dntm (Mines CSCI, RPM) Serch Spring 208 6 / 75

Bsic Serch Depth-First Serch Depth-First Serch continued 3 Step 2 W = (m) Step 3 W = () Dntm (Mines CSCI, RPM) Serch Spring 208 7 / 75

Bsic Serch Depth-First Serch DFS Outline Recursive Procedurl Trck serch progress vi function cll stck:. Visit node x. Visit ech neighbor of node x.2 Return Trck serch progress vi stck dt structure:. Pop node x from stck 2. Push ll neighbors of x onto stck 3. Repet Dntm (Mines CSCI, RPM) Serch Spring 208 8 / 75

Bsic Serch Depth-First Serch DFS Algorithm Recursive Procedure dfs(q 0, δ, A) T [q 0 ] nil ; // Serch Tree 2 function visit(q) is 3 if q A then 4 return tree-pth (T, q); 5 else 6 forech q δ(q) do 7 if contins(t,q ) then 8 T [q ] q; 9 let p = visit (q ) in 0 if p then return p ; return nil; 2 return visit (q 0 ); Dntm (Mines CSCI, RPM) Serch Spring 208 9 / 75

Bsic Serch Depth-First Serch Tree-Pth Procedure tree-pth(t, q) function rec(q,pth) is 2 if q then // Recursive Cse prent of q {}}{ 3 return rec T [q], cons (q, pth) ; 4 else // Bse Cse: t the root 5 return pth; 6 return rec (q, nil);. rec(m, ()) 2. rec(d, (m)) 3. rec(, (d, m)) 4. rec(nil, (, d, m)) 5. (, d, m) Dntm (Mines CSCI, RPM) Serch Spring 208 20 / 75

Bsic Serch Depth-First Serch DFS Algorithm Procedurl Procedure dfs(q 0, δ, A) W (q 0 ) ; // Stck 2 T [q 0 ] nil ; // Serch Tree 3 while W do 4 let q = pop(w) in 5 if q A then 6 return tree-pth (T, q); 7 else 8 forech q δ(q) do 9 if contins(t,q ) then 0 T [q ] q; W push (q, W ); 2 return nil; Dntm (Mines CSCI, RPM) Serch Spring 208 2 / 75

Bsic Serch Bredth-First Serch Bredth-First Serch Step 0 W = () Step W = (b, c, d) Step 2 W = (c, d, e, f, g) Step 3 W = (d, e, f, g, h, i) Dntm (Mines CSCI, RPM) Serch Spring 208 22 / 75

Bsic Serch Bredth-First Serch Bredth-First Serch continued Step 4 W = (e, f, g, h, i, j, k, l, m) Step 5 W = (f, g, h, i, j, k, l, m) Step 6 W = (g, h, i, j, k, l, m) Step 7 W = (h, i, j, k, l, m) Dntm (Mines CSCI, RPM) Serch Spring 208 23 / 75

Bsic Serch Bredth-First Serch Bredth-First Serch continued 2 Step 8 W = (i, j, k, l, m) Step 9 W = (j, k, l, m) Step 0 W = (k, l, m) Step W = (l, m) Dntm (Mines CSCI, RPM) Serch Spring 208 24 / 75

Bsic Serch Bredth-First Serch Bredth-First Serch continued 3 Step 2 W = (m) Step 3 W = () Dntm (Mines CSCI, RPM) Serch Spring 208 25 / 75

Bsic Serch Bredth-First Serch BFS Outline Procedurl Trck serch progress vi queue:. Dequeue node q from queue 2. Enqueue ll neighbors of q 3. Repet Dntm (Mines CSCI, RPM) Serch Spring 208 26 / 75

Bsic Serch Bredth-First Serch BFS Algorithm Procedurl Procedure bfs(q 0, δ, A) W (q 0 ); // Queue 2 T [q 0 ] nil; // Serch Tree 3 while W do 4 let q = dequeue (W ) in 5 if q A then 6 return tree-pth (T, q); 7 else 8 forech q δ(q) do 9 if contins(t,q ) then 0 T [q ] q; W enqueue (q, W ); 2 return nil; Dntm (Mines CSCI, RPM) Serch Spring 208 27 / 75

Properties of Serch nd Plnning Outline Plnning nd Serch Problems Bsic Serch Depth-First Serch Bredth-First Serch Properties of Serch nd Plnning More Serch Vritions Itertive-Deepening Serch Bckwrd Serch Bidirectionl Serch Dntm (Mines CSCI, RPM) Serch Spring 208 28 / 75

Properties of Serch nd Plnning Plnning Properties Correctness: Do we get right nswer? Completeness: Do we lwys get n nswer? Optimlity: Do we get the best nswer? Dntm (Mines CSCI, RPM) Serch Spring 208 29 / 75

Properties of Serch nd Plnning Correctness Definition (Correctness) A plnning lgorithm is correct if every pln it produces is vlid. Given q 0, δ, A: If P(q 0, δ, A) = (p 0,..., p n ), then: p 0 = q 0 p n A For ll p i, p i δ(p i ) Dntm (Mines CSCI, RPM) Serch Spring 208 30 / 75

Properties of Serch nd Plnning Completeness Definition (Completeness) A plnning lgorithm is complete if: When solution exists, the plnner lwys returns solution, nd when solution does not exists, the plner returns flse. Given q 0, δ, A: Solution Exists There exists solution (p 0,..., p n ) where p 0 = q 0 p n A For ll p i, p i δ(p i ) Then P(q 0, δ, A) returns such. No Solution Exists Does not exist (p 0,..., p n ) where p 0 = q 0 p n A For ll p i, p i δ(p i ) Then P(q 0, δ, A) returns flse. Dntm (Mines CSCI, RPM) Serch Spring 208 3 / 75

Properties of Serch nd Plnning Optimlity Definition (Optimlity) A plnning lgorithm is optiml if it produces the highest rewrd (/ lowest cost) pln. Given p 0, δ, A, stte rewrd function {}}{ V : Q R : pth rewrd ({}}{ n ) P(q 0, δ, A) = rgmx V (p i ) p 0,...,p n i=0 Dntm (Mines CSCI, RPM) Serch Spring 208 32 / 75

Properties of Serch nd Plnning Trde-offs Why ren t we lwys Correct, Complete, nd Optiml? Computtion: Time Spce Incomplete informtion / model limittions Infinite Spces Dntm (Mines CSCI, RPM) Serch Spring 208 33 / 75

More Serch Vritions Outline Plnning nd Serch Problems Bsic Serch Depth-First Serch Bredth-First Serch Properties of Serch nd Plnning More Serch Vritions Itertive-Deepening Serch Bckwrd Serch Bidirectionl Serch Dntm (Mines CSCI, RPM) Serch Spring 208 34 / 75

More Serch Vritions Itertive-Deepening Serch Brnching Fctor Definition (Brnching Fctor) Number of outgoing edges from node of the serch tree.... n i,j n i+,0 n i+,... n i+,b n i+,b............ Dntm (Mines CSCI, RPM) Serch Spring 208 35 / 75

More Serch Vritions Itertive-Deepening Serch BFS Memory Use b: brnching fctor d: current depth W b d W = (j, k, l, m, n, o.p, q, r, s, t, u, b, w, x, y, z, α, β) n o p q r s t u v w x y z α β γ δ ɛ ζ θ ι κ λ µ ν ξ π Memory use dominted by queued next level. Dntm (Mines CSCI, RPM) Serch Spring 208 36 / 75

More Serch Vritions Itertive-Deepening Serch DFS Memory Use b: brnching fctor d: current depth W b d W = (z, α, β, j, d) n o p q r s t u v w x y z α β γ δ ɛ ζ θ ι κ λ µ ν ξ π Smll work list (still hve visited set) Dntm (Mines CSCI, RPM) Serch Spring 208 37 / 75

More Serch Vritions Itertive-Deepening Serch DFS vs. BFS DFS BFS Pro: Compct work list (liner) Con: Not optiml Pro: Optiml (for equl step cost) Con: Exponentil work list Dntm (Mines CSCI, RPM) Serch Spring 208 38 / 75

More Serch Vritions Itertive-Deepening Serch Itertive-Deepening Serch (IDS) Overview. Set depth limit to 0 2. Run depth-first serch up to depth-limit 2. If gol found, return 2.2 Otherwise, increment depth limit nd repet Dntm (Mines CSCI, RPM) Serch Spring 208 39 / 75

More Serch Vritions Itertive-Deepening Serch Itertive-Deepening Serch Strt with depth limit 0 Step 0 W = () Step W = () Dntm (Mines CSCI, RPM) Serch Spring 208 40 / 75

More Serch Vritions Itertive-Deepening Serch Itertive-Deepening Serch Retry with depth limit Step 2 W = () Step 3 W = (b, c, d) Step 4 W = (c, d) Step 5 W = (d) Dntm (Mines CSCI, RPM) Serch Spring 208 4 / 75

More Serch Vritions Itertive-Deepening Serch Itertive-Deepening Serch Retry with depth limit continued Step 6 W = () Dntm (Mines CSCI, RPM) Serch Spring 208 42 / 75

More Serch Vritions Itertive-Deepening Serch Itertive-Deepening Serch Retry with depth limit 2 Step 0 W = () Step W = (b, c, d) Step 2 W = (e, f, g, c, d) Step 3 W = (f, g, c, d) Dntm (Mines CSCI, RPM) Serch Spring 208 43 / 75

More Serch Vritions Itertive-Deepening Serch Itertive-Deepening Serch Retry with depth limit 2 continued Step 4 W = (g, c, d) Step 5 W = (c, d) Step 6 W = (h, i, j, d) Step 7 W = (i, j, d) Dntm (Mines CSCI, RPM) Serch Spring 208 44 / 75

More Serch Vritions Itertive-Deepening Serch Itertive-Deepening Serch Retry with depth limit 2 continued 2 Step 8 W = (j, d) Step 9 W = (d) Step 0 W = (k, l, m) Step W = (l, m) Dntm (Mines CSCI, RPM) Serch Spring 208 45 / 75

More Serch Vritions Itertive-Deepening Serch Itertive-Deepening Serch Retry with depth limit 2 continued 3 Step 2 W = (m) Step 3 W = () Dntm (Mines CSCI, RPM) Serch Spring 208 46 / 75

More Serch Vritions Itertive-Deepening Serch Depth-Limited Serch Algorithm Procedure dls(q 0, δ, A, d mx ) T [q 0 ] nil ; // Serch Tree 2 function visit(q, d) is 3 if q A then return tree-pth (T, q) ; 4 if (d 0) then return nil; 5 else 6 forech q δ(q) do 7 if contins(t,q ) then 8 T [q ] q; 9 let p = visit (q, d ) in 0 if p then return p ; return nil 2 return (visit (q 0, d mx ), T ); Dntm (Mines CSCI, RPM) Serch Spring 208 47 / 75

More Serch Vritions Itertive-Deepening Serch Itertive-Deepening Serch Algorithm Procedure ids(q 0, δ, A) d 0; 2 repet 3 (p, T ) dls (q 0, δ, A, d); 4 d d + ; 5 until p is non-empty or T contins ll nodes; 6 return p Dntm (Mines CSCI, RPM) Serch Spring 208 48 / 75

More Serch Vritions Itertive-Deepening Serch Exmple: IDS Gridworld Depth limit 0 Step 0 W=(0,0) Step W=() 2 2 0,0 0 0 0 2 0 2 Dntm (Mines CSCI, RPM) Serch Spring 208 49 / 75

More Serch Vritions Itertive-Deepening Serch Exmple: IDS Gridworld Depth limit Step 2 W=(0,0) Step 3 W=((,0),(0,)) 2 2 0,0 0 0 0 2 0 2 Step 4 W=((0,)) Step 5 W=() 2 0,0 2 0,0,0,0 0, 0 0 0 2 0 2 Dntm (Mines CSCI, RPM) Serch Spring 208 50 / 75

More Serch Vritions Itertive-Deepening Serch Exmple: IDS Gridworld Depth limit 2 Step 6 W=(0,0) Step 7 W=((,0),(0,)) 2 2 0,0 0 0 0 2 0 2 Step 8 W=((2,0),(,),(0,)) Step 9 W=((,),(0,)) 2 0,0,0 2 0,0,0 0 0 0 2 0 2 2,0 Dntm (Mines CSCI, RPM) Serch Spring 208 5 / 75

More Serch Vritions Itertive-Deepening Serch Exmple: IDS Gridworld Depth limit 2, continued Step 0 W=((0,)) Step W=((0,2)) 2 0,0 2 0,0,0,0 0, 0 0 0 2 2,0, 0 2 2,0, 2 0 Step 2 0 2 W=() 0,0,0 0, 2,0, 0,2 Dntm (Mines CSCI, RPM) Serch Spring 208 52 / 75

More Serch Vritions Itertive-Deepening Serch Exmple: IDS Gridworld Depth limit 3 Step 3 W=(0,0) Step 4 W=((,0),(0,)) 2 2 0,0 0 0 0 2 0 2 Step 5 W=((2,0),(,),(0,)) Step 6 W=((2,),(,),(0,)) 2 0,0,0 2 0,0,0 0 0 0 2 0 2 2,0 Dntm (Mines CSCI, RPM) Serch Spring 208 53 / 75

More Serch Vritions Itertive-Deepening Serch Exmple: IDS Gridworld Depth limit 3, continued Step 7 W=((,),(0,)) Step 8 W=((,2),(0,)) 2 0,0,0 2 0,0,0 0 0 0 2 2,0 0 2 2,0, 2, 2, Step 9 W=((0,)) Step 20 W=((0,2)) 2 0,0 2 0,0,0,0 0, 0 0 0 2 2,0, 0 2 2,0, 2,,2 2,,2 Dntm (Mines CSCI, RPM) Serch Spring 208 54 / 75

More Serch Vritions Itertive-Deepening Serch Exmple: IDS Gridworld Depth limit 3, continued 2 Step 2 W=() 2 0,0 0 0 2 2,0,0, 0, 0,2 2,,2 Dntm (Mines CSCI, RPM) Serch Spring 208 55 / 75

More Serch Vritions Itertive-Deepening Serch Exmple: IDS Gridworld Depth limit 4 Step 22 W=(0,0) Step 23 W=((,0),(0,)) 2 2 0,0 0 0 0 2 0 2 Step 24 W=((2,0),(,),(0,)) Step 25 W=((2,),(,),(0,)) 2 0,0,0 2 0,0,0 0 0 0 2 0 2 2,0 Dntm (Mines CSCI, RPM) Serch Spring 208 56 / 75

More Serch Vritions Itertive-Deepening Serch Exmple: IDS Gridworld Depth limit 4, continued Step 26 W=((2,2),(,),(0,)) Step 27 W=((,),(0,)) 2 0,0,0 2 0,0,0 0 0 0 2 2,0 0 2 2,0 2, 2, 2,2 Dntm (Mines CSCI, RPM) Serch Spring 208 57 / 75

More Serch Vritions Itertive-Deepening Serch Hnoi Grph b (b), (), () b (), (b), () (), (), (b) b (b), (), () (), (b), () (), (), (b) b (, b), (), () b (), (, b), () (), (), (, b) b (b), (), () (), (, b), () (), (), (, b) (b), (), () (), (b), () (), (), (b) b (b), (), () b (), (b), () (), (), (b) b Dntm (Mines CSCI, RPM) Serch Spring 208 58 / 75

More Serch Vritions Itertive-Deepening Serch Exercise: IDS Hnoi Depth limit 0 Dntm (Mines CSCI, RPM) Serch Spring 208 59 / 75

More Serch Vritions Itertive-Deepening Serch Exercise: IDS Hnoi Depth limit Dntm (Mines CSCI, RPM) Serch Spring 208 60 / 75

More Serch Vritions Itertive-Deepening Serch Exercise: IDS Hnoi Depth limit 2 Dntm (Mines CSCI, RPM) Serch Spring 208 6 / 75

More Serch Vritions Itertive-Deepening Serch Exercise: IDS Hnoi Depth limit 2, continued Dntm (Mines CSCI, RPM) Serch Spring 208 62 / 75

More Serch Vritions Itertive-Deepening Serch Exercise: IDS Hnoi Depth limit 3 Dntm (Mines CSCI, RPM) Serch Spring 208 63 / 75

More Serch Vritions Itertive-Deepening Serch Exercise: IDS Hnoi Depth limit 3, continued Dntm (Mines CSCI, RPM) Serch Spring 208 64 / 75

More Serch Vritions Bckwrd Serch Bckwrd Serch Outline. Strt from gol set 2. Follow trnsitions bckwrd to strt 3. End t strt stte Dntm (Mines CSCI, RPM) Serch Spring 208 65 / 75

More Serch Vritions Bckwrd Serch Bckwrd Serch Algorithm Procedure bck-bfs(q 0, δ b, A) forech q A do 2 W b enqueue (q, W b ); // Queue 3 T b [q] nil; // Tree 4 while W b do 5 let q = dequeue (W b ) in 6 if q = q 0 then 7 return reverse-tree-pth (T b, q); 8 else 9 forech q δ b (q) do 0 if contins (T, q ) then T b [q ] q; 2 W b enqueue (q, W b ); 3 return nil; Dntm (Mines CSCI, RPM) Serch Spring 208 66 / 75

More Serch Vritions Bckwrd Serch Reverse-Tree-Pth Procedure reverse-tree-pth(t, q) function rec(q) is 2 if q then // Recursive Cse 3 return cons(q, rec (T [q])) 4 else // Bse Cse: t the root 5 return nil 6 return rec (q);. rec(m) 2. cons(m, rec(d)) 3. cons(m, cons(d, rec())) 4. cons(m, cons(d, cons(, rec(nil)))) 5. cons(m, cons(d, cons(, nil))) 6. (m, d, ) Dntm (Mines CSCI, RPM) Serch Spring 208 67 / 75

More Serch Vritions Bidirectionl Serch Bidirectionl Serch Bredth-First Serch e f g h i j k l m n o p q r s t u v w x y z α β γ δ ɛ ζ θ ι κ λ µ ν ξ π forwrd Bidirectionl Serch bckwrd π m ν ξ Dntm (Mines CSCI, RPM) Serch Spring 208 68 / 75

More Serch Vritions Bidirectionl Serch Bredth-First vs Bidirectionl Serch Trees Bredth-First b d Bidirectionl 2b d/2 Dntm (Mines CSCI, RPM) Serch Spring 208 69 / 75

More Serch Vritions Bidirectionl Serch BDS Algorithm Procedure bds(q 0, δ f, δ b, A) W f (q 0 ); // Init Forwrd Queue 2 T f [q] nil; // Init Forwrd Tree 3 forech q A do // Init Bckwrds 4 W b enqueue (q, W b ); // Bckwrd Queue 5 T b [q] nil; // Bckwrd Tree 6 while W f W b do /* Forwrd Step */ 7 (q, W f ) grow-bds (W f, T f, T b, δ f ) ; 8 if q then return bds-result (T f, T b, q) ; /* Bckwrd Step */ 9 (q, W b ) grow-bds (W b, T b, T f, δ b ) ; 0 if q then return bds-result (T f, T b, q) ; return nil; Dntm (Mines CSCI, RPM) Serch Spring 208 70 / 75

More Serch Vritions Bidirectionl Serch BDS Algorithm Subroutines Procedure bds-grow(w, T, T o, δ) let q = dequeue (W ) in 2 forech q δ(q) do 3 if contins(t,q ) then 4 T [q ] q; 5 if contins(t o,q ) then // Found shred node 6 return (q,w); 7 else 8 W enqueue (q, W ) Procedure bds-result(t f, T b, q) /* Pth from root to q */ p f tree-pth (T f, q); /* Pth from q+ to gol */ 2 p b reverse-tree-pth (T b, T b [q]); 3 return ppend (p f, p b ); 9 return (nil,w); Dntm (Mines CSCI, RPM) Serch Spring 208 7 / 75

More Serch Vritions Bidirectionl Serch Exmple: BDS Gridworld 2 0 Step 0 W f = ((0, 0)) W b = ((2, 2)) 0,0 2,2 0 2 2 0 Step W f = ((, 0), (0, )) W b = ((2, 2)) 0,0 2,2,0 0, 0 2 Step 2 W f = ((, 0), (0, )) Step 3 W f = ((0, ), (2, 0), (, )) 2 W b = ((, 2), (2, )) 0,0 2,2 2 W b = ((, 2), (2, )) 0,0 2,2 0 0 2,0 0,,2 2, 0 0,0 2 2,0, 0,,2 2, Dntm (Mines CSCI, RPM) Serch Spring 208 72 / 75

More Serch Vritions Bidirectionl Serch Exmple: BDS Gridworld 2 0 Step 4 W f = ((0, ), (2, 0), (, )) W b = ((, 2), (2, )) 0,0 2,2,0 0,,2 2, 0 2 2,0, Dntm (Mines CSCI, RPM) Serch Spring 208 73 / 75

More Serch Vritions Bidirectionl Serch Exercise: BDS Hnoi Dntm (Mines CSCI, RPM) Serch Spring 208 74 / 75

More Serch Vritions Bidirectionl Serch Summry Plnning nd Serch Problems Bsic Serch Depth-First Serch Bredth-First Serch Properties of Serch nd Plnning More Serch Vritions Itertive-Deepening Serch Bckwrd Serch Bidirectionl Serch Dntm (Mines CSCI, RPM) Serch Spring 208 75 / 75