Ch. 3 - PowerPoint PPT Presentation

About This Presentation
Title:

Ch. 3

Description:

Water Jug Problem. state: J12, J8, J3 initial state: 0, ... fill-jug-i-from-jug-j. if Jj = Ci Ji then. Jj' = Jj (Ci Ji), Ji'=Ci. 8-puzzle Search Tree ... – PowerPoint PPT presentation

Number of Views:22
Avg rating:3.0/5.0
Slides: 10
Provided by: JeffH47
Category:
Tags: jug

less

Transcript and Presenter's Notes

Title: Ch. 3


1
Ch. 3 Search
  • Supplemental slides for CSE 327
  • Prof. Jeff Heflin

2
Problem Solving Agent Algorithm
  • function SIMPLE-PROBLEM-SOLVING-AGENT(percept) r
    eturns an action
  • static seq, an action sequence, initially
    empty state, some description of the current
    world state goal, a goal initially
    null problem, a problem formulation
  • state ? UPDATE-STATE(state,percept) if seq is
    empty then do goal ? FORMULATE-GOAL(state) pro
    blem ?FORMULATE-PROBLEM(state,goal) seq ?
    SEARCH(problem) action ? FIRST(seq) seq ?
    REST(seq) return action
  • From Figure 3.1, p. 61

3
8-puzzle Successor Function
7 2 4
5 6
8 3 1
blank-right
blank-down
blank-left
blank-up
7 2 4
5 6
8 3 1
7 2 4
5 6
8 3 1
7 4
5 2 6
8 3 1
7 2 4
5 3 6
8 1
4
Water Jug Problem
  • state ltJ12, J8, J3gt
  • initial state lt0, 0, 0gt
  • goal test lt1, x, ygt
  • x and y can be any value
  • path cost
  • 1 per solution step?
  • 1 per gallon of water moved?
  • actions/successor function
  • let C1212, C88, C33
  • fill-jug-i
  • if Ji lt Ci then JiCi
  • empty-jug-i-into-jug-j
  • if Ji lt Cj Jj thenJj Jj Ji, Ji0
  • fill-jug-i-from-jug-j
  • if Jj gt Ci Ji thenJj Jj (Ci Ji),
    JiCi

5
8-puzzle Search Tree
7 2 4
5 8 6
3 1
initial state
7 2 4
8 6
5 3 1
7 2 4
5 8 6
3 1
2 4
7 8 6
5 3 1
7 2 4
8 6
5 3 1
7 2 4
5 8 6
3 1
7 2 4
5 6
3 8 1
7 2 4
5 8 6
3 1
7 2 4
5 8 6
3 1
6
Tree Search Algorithm
function TREE-SEARCH(problem,fringe) returns a
solution, or failure fringe ? INSERT(MAKE-NODE(IN
ITIAL-STATEproblem,fringe) loop do if
EMPTY?(fringe) then return failure node ?
REMOVE-FIRST(fringe) if GOAL-TESTproblem
applied to STATEnode succeeds then return
SOLUTION(node) fringe ? INSERT-ALL(EXPAND(node,p
roblem),fringe)
Notes 1. fringe argument should be an empty
queue. The type of the queue (e.g., LIFO, FIFO,
etc.) will affect the order of the search 2.
INITIAL-STATEproblem is just syntax for
accessing an objects data (think
problem.initialState in C) From Figure
3.9, p. 72
7
Depth-first Search
1
A
not generated
on fringe
2
7
C
B
in memory
deleted
3
8
6
9
D
E
F
G
4
5
H
I
8
Breadth-first Search
1
A
not generated
on fringe
2
3
C
B
in memory
deleted
4
7
6
5
D
E
F
G
8
9
H
I
9
Uninformed Search Summary
depth-first breadth-first uniform cost
queuing add to front (LIFO) add to back (FIFO) by path cost
complete? no yes yes
optimal? no yes, if identical step costs yes, if all step costs are greater than 0
time expensive expensive expensive
space modest expensive expensive
Write a Comment
User Comments (0)
About PowerShow.com