uninformed search ece457 applied artificial intelligence spring 2007 lecture #2

30
Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

Upload: nelson-todd

Post on 18-Jan-2016

219 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

Uninformed Search

ECE457 Applied Artificial IntelligenceSpring 2007 Lecture #2

Page 2: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 2

Outline Problem-solving by searching Uninformed search techniques

Russell & Norvig, chapter 3

Page 3: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 3

Problem-solving by searching An agent needs to perform actions

to get from its current state to a goal.

This process is called searching. Central in many AI systems

Theorem proving, VLSI layout, game playing, navigation, scheduling, etc.

Page 4: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 4

Requirements for searching Define the problem

Represent the search space by states Define the actions the agent can

perform and their cost Define a goal

What is the agent searching for? Define the solution

The goal itself? The path (i.e. sequence of actions) to

get to the goal?

Page 5: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 5

Assumptions Goal-based agent Environment

Fully observable Deterministic Sequential Static Discrete Single agent

Page 6: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 6

Formulating problems A well-defined problem has:

An initial state A set of actions A goal test A concept of cost

Page 7: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 7

Example: 8-puzzle Initial state Action

Move blank left, right, up or down, provided it does not get out of the game

Goal test Are the tiles in the “goal

state” order? Cost

Each move costs 1 Path cost is the sum of

moves

Page 8: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 8

Example: 8-puzzle

left down

leftright

down downleftup

Page 9: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 9

Search TreeParent

Child

Edge (action)

Node (state)

Expanding a node

Root

Leaf

Fringe

Branching factor (b)

Maximum depth (m)

Page 10: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 10

Properties of Search Algos. Completeness

Is the algorithm guaranteed to find a goal node, if one exists?

Optimality Is the algorithm guaranteed to find the best

goal node, i.e. the one with the cheapest path cost?

Time complexity How many nodes are generated?

Space complexity What’s the maximum number of nodes

stored in memory?

Page 11: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 11

Types of Search Uninformed Search

Only has the information provided by the problem formulation (initial state, set of actions, goal test, cost)

Informed Search Has additional information that allows

it to judge the promise of an action, i.e. the estimated cost from a state to a goal

Page 12: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 12

Breath-First Search

Page 13: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 13

Breath-First Search Complete, if b is finite Optimal, if path cost is equal to depth

Guaranteed to return the shallowest goal (depth d)

Number of generated nodes:1+b+b²+b³+…+bd+(bd+1-b) = O(bd+1)

Time complexity = O(bd+1) Space complexity = O(bd+1)

Page 14: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 14

Uniform-Cost Search Expansion of Breath-First Search Explore the cheapest node first (in

terms of path cost) Condition: No zero-cost or

negative-cost edges. Minimum cost is є

Page 15: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 15

Uniform-Cost Search Complete given a finite tree Optimal Time complexity = O(bC*/є) ≥

O(bd+1) Space complexity = O(bC*/є) ≥

O(bd+1)

Page 16: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 16

Depth-First Search

Page 17: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 17

Depth-First Search Complete, if m is finite Not optimal Time complexity = O(bm) Space complexity = bm+1 =

O(bm) Can be reduced to O(m)

Page 18: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 18

Depth-Limited Search Depth-First Search with depth limit

l Avoids problems of Depth-First

Search when trees are unbounded Depth-First Search is Depth-

Limited Search with l =

Page 19: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 19

Depth-Limited Search Complete, if l > d Not optimal Time complexity = O(bl) Space complexity = O(bl)

Page 20: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 20

Iterative Deepening Search Depth-First Search with increasing

depth limit l Repeat depth-limited search over and

over, with l = l + 1 Avoids problems of Depth-First

Search when trees are unbounded

Page 21: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 21

Iterative Deepening Search Complete , if b is finite Optimal, if path cost is equal to

depth Guaranteed to return the shallowest

goal Time complexity = O(bd) Space complexity = O(bd) Nodes on levels above d are

generated multiple times

Page 22: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 22

Repeated States

left down

leftright

down downleftup

Example: 8-puzzle

Page 23: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 23

Repeated States Unavoidable in problems where:

Actions are reversible Multiple paths to the same state are

possible Can greatly increase the number of

nodes in a tree Or even make a finite tree infinite!

Maintain a closed list of visited states Detect repeated states Increase space complexity

Page 24: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 24

Summary / Example Going from Arad to Bucharest

Page 25: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 25

Summary / Example Initial state

Being in Arad Action

Move to a neighbouring city, if a road exists.

Goal test Are we in Bucharest?

Cost Move cost = distance between cities Path cost = distance travelled since

Arad

Page 26: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 26

Summary / Example Breath-First Search

Page 27: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 27

Summary / Example Uniform-Cost Search

Page 28: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 28

Summary / Example Depth-First Search

Page 29: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 29

Summary / Example Depth-Limited Search, l = 4

Page 30: Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2

ECE457 Applied Artificial Intelligence R. Khoury (2007) Page 30

Summary / Example Iterative Deepening Search