1 / 22

Search: Basic and Heuristic

Search: Basic and Heuristic. Artificial Intelligence CMSC 25000 January 15, 2002. Agenda. Search - Motivation Blind exhaustive search: Depth-first search Breadth-first search Heuristic search: Hill-climbing Best-first Beam search. Why Search?. Not just city route search

jamesrbrown
Télécharger la présentation

Search: Basic and Heuristic

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. Search: Basic and Heuristic Artificial Intelligence CMSC 25000 January 15, 2002

  2. Agenda • Search - Motivation • Blind exhaustive search: • Depth-first search • Breadth-first search • Heuristic search: • Hill-climbing • Best-first • Beam search

  3. Why Search? • Not just city route search • Many AI problems can be posed as search • Planning: • Vertices: World states; Edges: Actions • Game-playing: • Vertices: Board configurations; Edges: Moves • Speech Recognition: • Vertices: Phonemes; Edges: Phone transitions

  4. Basic Search Algorithm • Form a 1-element queue of 0 cost=root node • Until first path in queue ends at goal or no paths • Remove 1st path from queue; extend path one step • Reject all paths with loops • Add new paths to queue • If goal found=>success; else, failure Paths to extend Order of paths added Position new paths added

  5. Basic Search Problem • Vertices: Cities; Edges: Steps to next, distance • Find route from S(tart) to G(oal) 4 4 A B C 3 S 5 G 4 3 2 4 D E F

  6. Blind Search • Need SOME route from S to G • Assume no information known • Depth-first search, breadth-first search • Convert search problem to search tree • Root=Zero length path at Start • Node=Path: label by terminal node • Child one-step extension of parent path

  7. Search Tree S A D B D A E E B B F C E D F B F D E A C G G C G F G

  8. Depth-first Search • Pick a child of each node visited, go forward • Ignore alternatives until exhaust path w/o goal S A B C E F D G

  9. Depth-first Search Algorithm • Form a 1-element queue of 0 cost=root node • Until first path in queue ends at goal or no paths • Remove 1st path from queue; extend path one step • Reject all paths with loops • Add new paths to FRONT of queue • If goal found=>success; else, failure

  10. Breadth-first Search • Explore all paths to a given depth S D A A E B D B B F C E E D F B F D E A C G

  11. Breadth-first Search Algorithm • Form a 1-element queue of 0 cost=root node • Until first path in queue ends at goal or no paths • Remove 1st path from queue; extend path one step • Reject all paths with loops • Add new paths to BACK of queue • If goal found=>success; else, failure

  12. Search Issues • Branching factor: • Number of children per node • # nodes: depth=d; branching=b: b^d!! • Depth-first search: • Good if: most partial=>complete, not too long • Bad if many (effectively) infinite paths • Breadth-first search: • Good if many (effectively) infinite paths, b<< • Bad if many end at same short depth, b>>

  13. Randomized Search • If REALLY know nothing… • Form a 1-element queue of 0 cost=root node • Until first path in queue ends at goal or no paths • Remove 1st path from queue; extend path one step • Reject all paths with loops • Add new paths to RANDOM parts of queue • If goal found=>success; else, failure

  14. Heuristic Search • A little knowledge is a powerful thing • Order choices to explore better options first • More knowledge => less search • Better search alg?? Better search space • Measure of remaining cost to goal-heuristic • E.g. actual distance => straight-line distance A B C 10.4 6.7 4.0 11.0 S G 3.0 8.9 6.9 D E F

  15. Hill-climbing Search • Select child to expand that is closest to goal S 8.9 A D 10.4 6.9 E 10.4 A B F 3.0 6.7 G

  16. Hill-climbing Search Algorithm • Form a 1-element queue of 0 cost=root node • Until first path in queue ends at goal or no paths • Remove 1st path from queue; extend path one step • Reject all paths with loops • Sort new paths by estimated distance to goal • Add new paths to FRONT of queue • If goal found=>success; else, failure

  17. S 10.4 8.9 D A 8.9 10.4 6.9 6.7 A E B D 6.7 3 4.0 6.9 B F C E A C G Beam Search • Breadth-first search of fixed width - top w • Guarantees limited branching factor, E.g. w=2

  18. Beam Search Algorithm • Form a 1-element queue of 0 cost=root node • Until first path in queue ends at goal or no paths • Extend all paths one step • Reject all paths with loops • Sort all paths in queue by estimated distance to goal • Put top w in queue • If goal found=>success; else, failure

  19. Best-first Search • Expand best open node ANYWHERE in tree • Form a 1-element queue of 0 cost=root node • Until first path in queue ends at goal or no paths • Remove 1st path from queue; extend path one step • Reject all paths with loops • Put in queue • Sort all paths by estimated distance to goal • If goal found=>success; else, failure

  20. Heuristic Search Issues • Parameter-oriented hill climbing • Make one step adjustments to all parameters • E.g. tuning brightness, contrast, r, g, b on TV • Test effect on performance measure • Problems: • Foothill problem: aka local maximum • All one-step changes - worse!, but not global max • Plateau problem: one-step changes, no FOM + • Ridge problem: all one-steps down, but not even local max • Solution (local max): Randomize!!

  21. Summary • Blind search: • Find some path to goal • Depth-first, Breadth-first, Randomized • Heuristically guided search • Use knowledge to find goal FASTER • Hill-climbing • Foothill, plateau, and ridge problems • Randomization escapes local maxima • Beam-search: Bounding branching • Best-first

  22. Search Costs

More Related