Uninformed Search Lecture 4 What are common search strategies that - - PowerPoint PPT Presentation

uninformed search
SMART_READER_LITE
LIVE PREVIEW

Uninformed Search Lecture 4 What are common search strategies that - - PowerPoint PPT Presentation

Wentworth Institute of Technology COMP3770 Artificial Intelligence | Spring 2016 | Derbinsky Uninformed Search Lecture 4 What are common search strategies that operate only given the search problem formalism? How do they compare?


slide-1
SLIDE 1

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Uninformed Search

Lecture 4

What are common search strategies that

  • perate only given the search problem

formalism? How do they compare?

January 29, 2016 Uninformed Search 1

slide-2
SLIDE 2

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Agenda

  • A quick refresher
  • DFS, BFS, ID-DFS, UCS
  • Unification!

January 29, 2016 Uninformed Search 2

slide-3
SLIDE 3

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Search Problem Formalism

Defined via the following components:

  • The initial state the agent starts in
  • A successor/transition function

– S(x) = {action+cost->state}

  • A goal test, which determines whether a given state is

a goal state

  • A path cost that assigns a numeric cost to each path

A solution is a sequence of actions leading from initial state to a goal state. (Optimal = lowest path cost.) Together the initial state and successor function implicitly define the state space, the set of all reachable states

January 29, 2016 Uninformed Search 3

slide-4
SLIDE 4

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

State Space Graph

  • State space graph: A

mathematical representation of a search problem

– Nodes are (abstracted) world configurations – Arcs represent successors (action results) – The goal test is a set of goal node(s)

  • In a search graph, each state
  • ccurs only once!
  • We can rarely build this full

graph in memory (it’s too big), but it’s a useful idea

January 29, 2016 Uninformed Search 4

S

G d b p q c e h a f r

slide-5
SLIDE 5

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Search Tree

  • A “what if” tree of plans and

their outcomes

  • The start state is the root node
  • Children correspond to

successors

  • Nodes show states, but

correspond to PLANS that achieve those states

  • For most problems, we can

never actually build the whole tree

January 29, 2016 Uninformed Search 5

“E”, 1.0 “N”, 1.0

slide-6
SLIDE 6

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Searching for Solutions

Basic idea: incrementally build a search tree until a goal state is found

  • Root = initial state
  • Expand via transition function to

create new nodes

  • Nodes that haven’t been

expanded are leaf nodes and form the frontier (open list)

  • Different search strategies (next

lecture) choose next node to expand (as few as possible!)

  • Use a closed list to prevent

expanding the same state more than once

January 29, 2016 Uninformed Search 6

slide-7
SLIDE 7

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

General Algorithm

January 29, 2016 Uninformed Search 7

Queue (FIFO) Stack (LIFO) Priority Queue

slide-8
SLIDE 8

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Evaluating a Search Strategy

  • Completeness: does it

always find a solution if

  • ne exists?
  • Optimality: does it

always find a least-cost solution?

  • Time Complexity:

number of nodes generated/expanded

  • Space Complexity:

maximum number of nodes in memory

January 29, 2016 Uninformed Search 8

Solution Efficiency

slide-9
SLIDE 9

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Depth-First Search (DFS)

January 29, 2016 Uninformed Search 9

slide-10
SLIDE 10

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

DFS Example

January 29, 2016 Uninformed Search 10

S

a b d p a c e p h f r q q c

G

a q e p h f r q q c

G

a S G

d b p q c e h a f r q p h f d b a c e r

Strategy: expand a deepest node first Implementation: Fringe is a LIFO stack

slide-11
SLIDE 11

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Let’s Evaluate!

January 29, 2016 Uninformed Search 11

slide-12
SLIDE 12

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Search Tree

Number of nodes in the tree?

  • 1 + b + b2 + …. bm = O(bm)

January 29, 2016 Uninformed Search 12

… b 1 node b nodes b2 nodes bm nodes m tiers

Properties

  • Branching factor
  • Maximum depth
  • Solutions at

various depths

slide-13
SLIDE 13

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

DFS Evaluation

Time

  • Expands left

– Could be whole tree!

  • Assuming finite depth,

O(bm) Space

  • Only siblings on path,

O(bm) Complete

  • Only if finite

Optimal

  • No, ”left-most” w/o

regard to cost/depth

January 29, 2016 Uninformed Search 13

… b 1 node b nodes b2 nodes bm nodes m tiers

slide-14
SLIDE 14

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Breadth-First Search (BFS)

January 29, 2016 Uninformed Search 14

slide-15
SLIDE 15

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

BFS Example

January 29, 2016 Uninformed Search 15

S

a b d p a c e p h f r q q c

G

a q e p h f r q q c

G

a

S

G d b p q c e h a f r Search Tiers Strategy: expand a shallowest node first Implementation: Fringe is a FIFO queue

slide-16
SLIDE 16

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

BFS Evaluation

Time

  • Processes all nodes

above shallowest solution, O(bs) Space

  • Has roughly the last

tier, so O(bs) Complete

  • Yes!

Optimal

  • Only if all costs are 1

(more later)

January 29, 2016 Uninformed Search 16

… b 1 node b nodes b2 nodes bm nodes s tiers bs nodes

slide-17
SLIDE 17

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

DFS vs. BFS

January 29, 2016 Uninformed Search 17

Empty-DFS Empty-BFS Maze-DFS Maze-BFS

slide-18
SLIDE 18

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Grounding the Branching Factor

Depth Nodes Time Memory 2 110 0.11 msecs 107 KB 4 11,110 11 msecs 10.6 MB 6 106 1.1 secs 1 GB 8 108 2 mins 103 GB 10 1010 3 hours 10 TB 12 1012 13 days 1 PB 14 1014 3.5 years 99 PB 16 1016 350 years 10 EB

January 29, 2016 Uninformed Search 18

Assumptions

  • b = 10
  • 1 million nodes/second
  • 1000 bytes/node

Memory often becomes the limiting factor

slide-19
SLIDE 19

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Iterative Deepening DFS

  • Basic idea: DFS

memory with BFS time/shallow solution

– DFS up to 1 – DFS up to 2 – ….

  • Generally most work

happens in the lowest level searched, so not too wasteful

January 29, 2016 Uninformed Search 19

… b

slide-20
SLIDE 20

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Cost-Sensitive Search

  • BFS finds the shortest path in terms of number of actions, but it

does not find the least-cost path.

  • We will now cover a similar algorithm which does!

January 29, 2016 Uninformed Search 20

START

GOAL

d b p q c e h a f r 2 9 2 8 1 8 2 3 2 4 4 15 1 3 2 2

slide-21
SLIDE 21

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Uniform-Cost Search (UCS)

January 29, 2016 Uninformed Search 21

slide-22
SLIDE 22

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

UCS Example

January 29, 2016 Uninformed Search 22

S

a b d p a c e p h f r q q c

G

a q e p h f r q q c

G

a Strategy: expand a cheapest node first: Fringe is a priority queue (priority: cumulative cost) S G

d b p q c e h a f r

3 9 1 16 4 11 5 7 13 8 10 11 17 11 6 3 9 1 1 2 8 8 2 15 1 2 Cost contours 2

slide-23
SLIDE 23

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

UCS Evaluation

Time

  • O(bC*/𝜁)

Space

  • O(bC*/𝜁)

Complete

  • Yes!

Optimal

  • Yes!

January 29, 2016 Uninformed Search 23

… b C*/ε “tiers” (effective depth) c ≤ 3 c ≤ 2 c ≤ 1 Assume solution costs C* and arcs cost at least 𝜁

slide-24
SLIDE 24

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

UCS vs. DFS vs. BFS

  • UCS is good and
  • ptimal
  • However, it still

moves in every direction – it’s not informed about goal direction…

January 29, 2016 Uninformed Search 24

Empty-UCS Maze-UCS MazeCost-DFS MazeCost-BFS MazeCost-UCS … c ≤ 3 c ≤ 2 c ≤ 1 Start Goal

slide-25
SLIDE 25

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Unification

  • All these search

algorithms are the same except for fringe strategies

  • Conceptually, all fringes

are priority queues (i.e. collections of nodes with attached priorities)

  • Practically, for DFS and

BFS, you can avoid the log(n) overhead from an actual priority queue, by using stacks and queues

January 29, 2016 Uninformed Search 25

slide-26
SLIDE 26

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

A Reminder

  • Search operates over

models of the world

  • The agent doesn’t

actually try all the plans

  • ut in the real world!
  • Planning is all “in

simulation”

  • Your search is only as

good as your models…

January 29, 2016 Uninformed Search 26

slide-27
SLIDE 27

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Search Gone Wrong

January 29, 2016 Uninformed Search 27

slide-28
SLIDE 28

Wentworth Institute of Technology COMP3770 – Artificial Intelligence | Spring 2016 | Derbinsky

Summary

  • We evaluated several uninformed

strategies to solve a search problem

– DFS, ID-DFS, BFS, UCS

  • DFS, BFS, and UCS can all be

implemented via a generic graph-search algorithm over a search tree by simply changing how the fringe is organized

January 29, 2016 Uninformed Search 28