1 / 8

Ch. 3 – Search

Ch. 3 – Search. Supplemental slides for CSE 327 Prof. Jeff Heflin. function SIMPLE-PROBLEM-SOLVING-AGENT( percept ) returns an action

ann
Download Presentation

Ch. 3 – Search

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. function SIMPLE-PROBLEM-SOLVING-AGENT(percept)returns an action static: seq, an action sequence, initially emptystate, some description of the current world stategoal, a goal initially nullproblem, a problem formulation state UPDATE-STATE(state,percept)ifseq is empty then dogoal  FORMULATE-GOAL(state)problem FORMULATE-PROBLEM(state,goal)seq  SEARCH(problem) action  FIRST(seq)seq  REST(seq)returnaction From Figure 3.1, p. 61 Problem Solving Agent Algorithm

  3. 8-puzzle Successor Function blank-right blank-left blank-up blank-down

  4. state: <J12, J8, J3> initial state: <0, 0, 0> goal test: <1, x, y> x and y can be any value path cost: 1 per solution step? 1 per gallon of water moved? actions/successor function let C12=12, C8=8, C3=3 fill-jug-i if Ji < Ci then Ji=Ci empty-jug-i-into-jug-j if Ji <= Cj – Jj thenJj’ = Jj + Ji, Ji’=0 fill-jug-i-from-jug-j if Jj >= Ci – Ji thenJj’ = Jj – (Ci – Ji), Ji’=Ci Water Jug Problem

  5. 8-puzzle Search Tree initial state

  6. Tree Search Algorithm function TREE-SEARCH(problem,fringe)returns a solution, or failure fringe INSERT(MAKE-NODE(INITIAL-STATE[problem],fringe)loopdoif EMPTY?(fringe) then return failurenode  REMOVE-FIRST(fringe)if GOAL-TEST[problem] applied to STATE[node] succeedsthen return SOLUTION(node)fringe  INSERT-ALL(EXPAND(node,problem),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-STATE[problem] is just syntax for accessing an object’s data (think problem.initialState in C++) From Figure 3.9, p. 72

  7. Depth-first Search 1 A not generated on fringe 2 7 B C 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 B C in memory deleted 4 5 6 7 D E F G 8 9 H I

More Related