1 / 15

Ch. 3 – Search

Ch. 3 – Search. Supplemental slides for CSE 327 Prof. Jeff Heflin. 8-Puzzle Transition Model. state s. actions a. blank-right. blank-left. blank-up. blank-down. RESULT( s , a ). 8-puzzle Search Tree. initial state. Tree Search Algorithm.

qiana
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. 8-Puzzle Transition Model state s actions a blank-right blank-left blank-up blank-down RESULT(s,a)

  3. 8-puzzle Search Tree initial state

  4. Tree Search Algorithm functionTree-Search(problem) returns a solution, or failure initialize the frontier using the initial state of problemloopdoif the frontier is empty then return failure choose a leaf node and remove it from the frontierif the node contains a goal state then return the corresponding solution expand the chosen node, adding the resulting nodes to the frontier From Figure 3.7, p. 77

  5. functionSimple-Problem-Solving-Agent(percept)returns an action persistent: 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 thengoal  Formulate-Goal(state)problem Formulate-Problem(state,goal)seq  Search(problem) ifseq = failurethen return a null actionaction  First(seq)seq  Rest(seq)returnaction From Figure 3.1, p. 67 Problem Solving Agent Algorithm

  6. 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

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

  9. Uniform Cost Search State space Search tree 1 10 I G g(n)=0 I 4 B 5 2 3 C g(n)=4 B G g(n)=10 not generated 4 3 on frontier G C g(n)=9 g(n)=7 in memory deleted

  10. Repeated States State space Search tree A B A C G B C initial state goal state A C A B G B C A B G

  11. Uninformed Search Summary

  12. A* Example • Use A* to solve the 8-puzzle: goal state: initial state: path cost is the total number of moves made • Consider these heuristics • H1: The number of tiles out of place • H2: Sum of distances of tiles from goal positions • Ignore moves that return you to the previous state

  13. A* on 8-puzzle 1 f=0+3=3 Heuristic = H1 2 f=1+3=4 3 f=1+3=4 4 f=2+2=4 f=2+3=5 f=2+4=6 f=2+4=6 Whether or not this node is expanded depends on how you break ties. It could be expanded at any time or not at all. f=3+3=6 f=3+3=6 5 f=3+1=4 f=4+2=6 6 f=4+0=4

  14. A* on 8-puzzle 1 f=0+4=4 Heuristic = H2 2 f=1+3=4 f=1+5=6 3 f=2+2=4 f=2+4=6 f=3+3=6 f=3+3=6 4 f=3+1=4 f=4+2=6 5 f=4+0=4

  15. Summary of Search Algorithms • a – if step costs are identical • b – if step costs > 0 • c – if heuristic is admissible and consistent

More Related