1 / 16

State Space Search 2 Chapter 3

State Space Search 2 Chapter 3. Three Algorithms. Suppose We are searching depth-first No further progress is possible (i.e., we can only generate nodes we’ve already generated) Backtrack. Backtracking. Pursue path until goal is reached or dead end If goal, quit and return the path

zion
Download Presentation

State Space Search 2 Chapter 3

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. State Space Search 2Chapter 3 Three Algorithms

  2. Suppose • We are searching depth-first • No further progress is possible (i.e., we can only generate nodes we’ve already generated) • Backtrack Backtracking

  3. Pursue path until goal is reached or dead end • If goal, quit and return the path • If dead end, backtrack until you reach the most recent node whose children have not been fully examined The algorithm: First Pass

  4. SL • List of nodes in current path being tried. If goal is found, SL contains the path • NSL • List of nodes whose descendents have not been generated and searched • DE • List of dead end nodes • All lists are treated as stacks • CS • Current state of the search BT maintains Three Lists and A State

  5. The Algorithm

  6. a d b c h j a e i g State Space A as a child of C is intentional

  7. At Home Exercise: Trace with Goal j, Start A Show SL, NSL, DE, CS at each step of the algorithm Trace

  8. Eliminate saved path (SL) • Results in Depth-First search • Goes as deeply as possible • Is not guaranteed to find a shortest path • Maintains two lists • Open List • Contains states generated • Children have not been examined (like NSL) • Open is implemented as a stack • Closed List • Contains states already examined • Union of SL and DE Depth-First: A Simplification of BT

  9. bool Depth-First(Start) { open = [Start]; closed = []; while (!isEmpty.open()) { CS = open.pop(); if (CS == goal) return true; else { generate children of CS; closed.push(CS); eliminate children from CS that are on open or closed; while (CS has more children) open.push(child of CS); } } return false; }

  10. At Home Exercise: Trace graph on slide 6 with Goal j, Start a Show Open, Close, CS at each step of the algorithm Trace

  11. bool Breadth-First(Start) { open = [Start]; closed = []; while (!isEmpty.open()) { CS = open.dequeue(); if (CS == goal) return true; else { generate children of CS; closed.enqueue(CS); eliminate children from CS that are on open or closed; while (CS has more children) open.enqueue(child of CS); } } return false; } Breadth-First Search: DF but with a Queue

  12. At Home Exercise: Trace graph on slide 6 with Goal j, Start a Show Open, Close, CS at each step of the algorithm Trace

  13. Open forms frontier of search • Path can be easily reconstructed • Each node is an ordered pair (x,y) • X is the node name • Y is the parent • When goal is found, search closed for parent, the parent of the parent, etc., until start is reached. Both Algorithms

  14. Breadth-First • Finds shortest solution • If branching factor is high, could require a lot of storage Depth-First • If it is known that the solution path is long, DF will not waste time searching shallow states • DF can get lost going too deep and miss a shallow solution • DF and BF follow for the 8-puzzle

  15. Depth First Search of 8-Puzzle (p. 105) Depth Bound = 5 8 Puzzle—DF (p. 105)

More Related