Uninformed Search strategies AIMA sections 3.4 Uninformed search - - PowerPoint PPT Presentation

uninformed search strategies
SMART_READER_LITE
LIVE PREVIEW

Uninformed Search strategies AIMA sections 3.4 Uninformed search - - PowerPoint PPT Presentation

Uninformed Search strategies Uninformed Search strategies AIMA sections 3.4 Uninformed search strategies Uninformed Search strategies Uninformed strategies use only the information available in the problem definition Breadth-first


slide-1
SLIDE 1

Uninformed Search strategies

Uninformed Search strategies

AIMA sections 3.4

slide-2
SLIDE 2

Uninformed Search strategies

Uninformed search strategies

Uninformed strategies use only the information available in the problem definition ♦ Breadth-first search ♦ Uniform-cost search ♦ Depth-first search ♦ Depth-limited search ♦ Iterative deepening search

slide-3
SLIDE 3

Uninformed Search strategies

Breadth-first search

Expand shallowest unexpanded node Implementation: frontier is a FIFO queue, i.e., new successors go at the end

slide-4
SLIDE 4

Uninformed Search strategies

Breadth-first search

Expand shallowest unexpanded node Implementation: frontier is a FIFO queue, i.e., new successors go at the end

slide-5
SLIDE 5

Uninformed Search strategies

Breadth-first search

Expand shallowest unexpanded node Implementation: frontier is a FIFO queue, i.e., new successors go at the end

slide-6
SLIDE 6

Uninformed Search strategies

Breadth-first search

Expand shallowest unexpanded node Implementation: frontier is a FIFO queue, i.e., new successors go at the end

slide-7
SLIDE 7

Uninformed Search strategies

Breadth-First Search Algorithm

function BFS( problem) returns a solution, or failure node ← node with State=problem.Initial-State,Path-Cost=0 if problem.Goal-Test(node.State) then return node explored ← empty set frontier ← FIFO queue with node as the only element loop do if frontier is empty then return failure node ← Pop(frontier) add node.State to explored for each action in problem.Actions(node.State) do child ← Child-Node(problem,node,action) if child.State is not in explored or frontier then if problem.Goal-Test(child.State) then return child frontier ← Insert(child) end if end for end loop

slide-8
SLIDE 8

Uninformed Search strategies

Properties of breadth-first search

Complete??

slide-9
SLIDE 9

Uninformed Search strategies

Properties of breadth-first search

Complete?? Yes (if b is finite) Time??

slide-10
SLIDE 10

Uninformed Search strategies

Properties of breadth-first search

Complete?? Yes (if b is finite) Time?? b + b2 + b3 + . . . + bd = O(bd), i.e., exp. in d Space??

slide-11
SLIDE 11

Uninformed Search strategies

Properties of breadth-first search

Complete?? Yes (if b is finite) Time?? b + b2 + b3 + . . . + bd = O(bd), i.e., exp. in d Space?? O(bd) (keeps every node in memory) Optimal??

slide-12
SLIDE 12

Uninformed Search strategies

Properties of breadth-first search

Complete?? Yes (if b is finite) Time?? b + b2 + b3 + . . . + bd = O(bd), i.e., exp. in d Space?? O(bd) (keeps every node in memory) Optimal?? Yes (if cost = 1 per step); not optimal in general

slide-13
SLIDE 13

Uninformed Search strategies

Properties of breadth-first search

Complete?? Yes (if b is finite) Time?? b + b2 + b3 + . . . + bd = O(bd), i.e., exp. in d Space?? O(bd) (keeps every node in memory) Optimal?? Yes (if cost = 1 per step); not optimal in general Space is the big problem; can easily generate nodes at 100MB/sec so 24hrs = 8640GB.

slide-14
SLIDE 14

Uninformed Search strategies

Uniform cost search

Expand least-cost unexpanded node (i.e., minimum step cost) Implementation: frontier = queue ordered by path cost, lowest first Equivalent to breadth-first if step costs all equal Complete?? Yes, if step cost ≥ ǫ Time?? # of nodes with g ≤ cost of optimal solution, O(b⌈C ∗/ǫ⌉) where C ∗ is the cost of the optimal solution Space?? # of nodes with g ≤ cost of optimal solution, O(b⌈C ∗/ǫ⌉) Optimal?? Yes—nodes expanded in increasing order of g(n)

slide-15
SLIDE 15

Uninformed Search strategies

Depth-first search

Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front

slide-16
SLIDE 16

Uninformed Search strategies

Depth-first search

Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front

slide-17
SLIDE 17

Uninformed Search strategies

Depth-first search

Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front

slide-18
SLIDE 18

Uninformed Search strategies

Depth-first search

Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front

slide-19
SLIDE 19

Uninformed Search strategies

Depth-first search

Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front

slide-20
SLIDE 20

Uninformed Search strategies

Depth-first search

Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front

slide-21
SLIDE 21

Uninformed Search strategies

Depth-first search

Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front

slide-22
SLIDE 22

Uninformed Search strategies

Depth-first search

Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front

slide-23
SLIDE 23

Uninformed Search strategies

Depth-first search

Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front

slide-24
SLIDE 24

Uninformed Search strategies

Depth-first search

Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front

slide-25
SLIDE 25

Uninformed Search strategies

Depth-first search

Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front

slide-26
SLIDE 26

Uninformed Search strategies

Depth-first search

Expand deepest unexpanded node Implementation: frontier = LIFO queue, i.e., put successors at front

slide-27
SLIDE 27

Uninformed Search strategies

Properties of depth-first search

Complete??

slide-28
SLIDE 28

Uninformed Search strategies

Properties of depth-first search

Complete?? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path ⇒ complete in finite spaces Time??

slide-29
SLIDE 29

Uninformed Search strategies

Properties of depth-first search

Complete?? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path ⇒ complete in finite spaces Time?? O(bm): terrible if m is much larger than d but if solutions are dense, may be much faster than breadth-first Space??

slide-30
SLIDE 30

Uninformed Search strategies

Properties of depth-first search

Complete?? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path ⇒ complete in finite spaces Time?? O(bm): terrible if m is much larger than d but if solutions are dense, may be much faster than breadth-first Space?? O(bm), i.e., linear space! Optimal??

slide-31
SLIDE 31

Uninformed Search strategies

Properties of depth-first search

Complete?? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path ⇒ complete in finite spaces Time?? O(bm): terrible if m is much larger than d but if solutions are dense, may be much faster than breadth-first Space?? O(bm), i.e., linear space! Optimal?? No!

slide-32
SLIDE 32

Uninformed Search strategies

Depth-limited search

DFS + depth limit l: nodes at depth l have no successors Recursive implementation:

function DLS(problem,limit) returns soln/fail/cutoff R-DLS(Make-Node(problem.Initial-State),problem,limit) function R-DLS(node,problem,limit) returns soln/fail/cutoff if problem.Goal-Test(node.State) then return node else if limit = 0 then return cutoff else cutoff-occurred? ← false for each action in problem.Actions(node.State) do child ← Child-Node(problem,node,action) result ← R-DLS(child,problem,limit-1) if result = cutoff then cutoff-occurred? ← true else if result = failure then return result end for if cutoff-occurred? then return cutoff else return failure end else

slide-33
SLIDE 33

Uninformed Search strategies

Iterative deepening search

function IDS(problem) returns a solution inputs: problem, a problem for depth ← 0 to ∞ do result ← DLS(problem, depth) if result = cutoff then return result end

slide-34
SLIDE 34

Uninformed Search strategies

Iterative deepening search

slide-35
SLIDE 35

Uninformed Search strategies

Iterative deepening search

slide-36
SLIDE 36

Uninformed Search strategies

Iterative deepening search

slide-37
SLIDE 37

Uninformed Search strategies

Iterative deepening search

slide-38
SLIDE 38

Uninformed Search strategies

Properties of iterative deepening search

Complete??

slide-39
SLIDE 39

Uninformed Search strategies

Properties of iterative deepening search

Complete?? Yes Time??

slide-40
SLIDE 40

Uninformed Search strategies

Properties of iterative deepening search

Complete?? Yes Time?? db1 + (d − 1)b2 + . . . + bd = O(bd) Space??

slide-41
SLIDE 41

Uninformed Search strategies

Properties of iterative deepening search

Complete?? Yes Time?? db1 + (d − 1)b2 + . . . + bd = O(bd) Space?? O(bd) Optimal??

slide-42
SLIDE 42

Uninformed Search strategies

Properties of iterative deepening search

Complete?? Yes Time?? db1 + (d − 1)b2 + . . . + bd = O(bd) Space?? O(bd) Optimal?? Yes, if step cost = 1 Can be modified to explore uniform-cost tree

slide-43
SLIDE 43

Uninformed Search strategies

BFS Vs IDS

Numerical comparison for b = 10 and d = 5, solution at far right leaf: N(IDS) = 50 + 400 + 3, 000 + 20, 000 + 100, 000 = 123, 450 N(BFS) = 10 + 100 + 1, 000 + 10, 000 + 100, 000 = 111, 101 IDS repeats dome nodes but it does not do much worse than BFS because complexity is dominated by exponential growth of nodes.

slide-44
SLIDE 44

Uninformed Search strategies

Summary of algorithms

♦ Considering tree-search versions Criterion BF UC DF DL ID Complete? Yes∗ Yes∗,† No Yes∗, if l ≥ d Yes∗ Time bd b⌈C ∗/ǫ⌉ bm bl bd Space bd b⌈C ∗/ǫ⌉ bm bl bd Optimal? Yes⋆ Yes No Yes⋆, if l ≥ d Yes⋆ *: complete if branching factor is finite †: complete if step cost is ≥ ǫ ⋆: optimal if step costs are all identical

slide-45
SLIDE 45

Uninformed Search strategies

Summary

♦ Variety of uninformed search strategies ♦ Iterative deepening search uses only linear space and not much more time than other uninformed algorithms ♦ Graph search can be exponentially more efficient than tree search

slide-46
SLIDE 46

Uninformed Search strategies

Exercise: Search Space Dimension

BFS vs IDS Assume: i) a well balanced search tree; ii) the goal state is the last one to be expanded in its level (e.g., the rightmost). ♦ if the branching factor is 3, the shallowest goal state is at depth 3 (root has depth 0) and we proceed breadth first how many nodes are generated ? ♦ if the branching factor is 3, the shallowest goal state is at depth 3 (root has depth 0) we proceed with an iterative deepening approach, how many nodes are generated ?

slide-47
SLIDE 47

Uninformed Search strategies

Exercise: formalizing and solving problem through search

The Wolf Sheep and Cabbage Problem A man owns a wolf, a sheep and a cabbage: He is on a river bank with a boat that can carry him with only one of his goodies at a time. The man wants to reach the other bank with his wolf, sheep and cabbage, but he knows that wolves eat sheeps, and sheeps eat cabbages, so he cannot leave them alone on a bank. ♦ Formalize the WSC problem as a search problem ♦ Use breadth first to find a solution

slide-48
SLIDE 48

Uninformed Search strategies

Exercise: formalizing and solving problem through search

The Missionaries and Cannibals Three missionaries and three cannibals are on the same river bank, and want to cross it. They have a boat that can carry two people at most. Cannibals should never outnumber missionaries, on any bank, as they could eat them. ♦ Formalize the MC problem as a search problem ♦ Give a solution

slide-49
SLIDE 49

Uninformed Search strategies

Exercise: Optimality for Graph Search

Differences between different search strategies Consider the state space graph in the figure, all moves cost 1.

S G S2 S3 S1 S0 U D R R

Answer to the following questions: State whether a Graph Search version of BFS would always return the optimal solution for this problem, if not provide an execution where this is not the case. State whether a Graph Search version of IDS would always return the optimal solution for this problem, if not provide an execution where this is not the case.