Presentation is loading. Please wait.

Presentation is loading. Please wait.

Search: Heuristic &Optimal Artificial Intelligence CMSC 25000 January 16, 2003.

Similar presentations


Presentation on theme: "Search: Heuristic &Optimal Artificial Intelligence CMSC 25000 January 16, 2003."— Presentation transcript:

1 Search: Heuristic &Optimal Artificial Intelligence CMSC 25000 January 16, 2003

2 Agenda Heuristic Search –Local: Hill-climbing, Beam Search Limitations of local heuristics –Global: Best first Optimal Search –A* search Admissible, consistent heuristics Dynamic programming Problem representation –Configuration space

3 Searches Blind search: Find ANY path to goal –Know something about search space: Most paths reach goal or terminate quickly: DFS Low branching factor, possible long paths: BFS Always ready to act: ID-DFS

4 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 S D A E BC FG 4.0 6.7 10.4 11.0 8.9 6.9 3.0

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

6 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

7 Beam Search ● Breadth-first search of fixed width - top w – Guarantees limited branching factor, E.g. w=2 S A D BD AE 10.48.9 6.7 8.910.4 6.9 CE BF 4.0 6.9 6.73 ACG

8 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

9 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

10 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!!

11 Search Costs

12 Searches Heuristic search: Any path, but find faster –Estimate remaining distance to goal –Best from current node: Hill-climbing –Best from any node: Best first –Best w at this depth: Beam search

13 Optimal Search Find BEST path to goal –Find best path EFFICIENTLY Exhaustive search: –Try all paths: return best Optimal paths with less work: –Expand shortest paths –Expanded shortest expected paths –Eliminate repeated work - dynamic programming

14 Efficient Optimal Search Find best path without exploring all paths –Use knowledge about path lengths Maintain path & path length –Expand shortest paths first –Halt if partial path length > complete path length

15 Underestimates Improve estimate of complete path length –Add (under)estimate of remaining distance –u(total path dist) = d(partial path)+u(remaining) –Underestimates must ultimately yield shortest –Stop if all u(total path dist) > d(complete path) Straight-line distance => underestimate Better estimate => Better search No missteps

16 Search with Dynamic Programming Avoid duplicating work –Dynamic Programming principle: Shortest path from S to G through I is shortest path from S to I plus shortest path from I to G No need to consider other routes to or from I

17 A* Search Algorithm Combines good optimal search ideas –Dynamic programming and underestimates 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 For all paths with same terminal node, keep only shortest –Add new paths to queue –Sort all paths by total length underestimate, shortest first (d(partial path) + u(remaining)) If goal found=>success; else, failure

18 A* Search Example SAD 13.412.9 AE 19.412.9 BF 17.7 13 G

19 Heuristics A* search: only as good as the heuristic Heuristic requirements: –Admissible: UNDERESTIMATE true remaining cost to goal –Consistent: h(n) <= c(n,a,n') + h(n') Some heuristics better than others –0?

20 Constructing Heuristics Relaxation: –State problem –Remove one or more constraints What is the cost then? Example: –8-square: Move A to B if 1) A &B horizontally or vertically adjacent, and 2) B is empty –Ignore 1) -> Manhattan distance –Ignore 1) & 2): # of misplaced squares

21 Navigation

22 Application: Configuration Space Problem: Robot navigation –Move robot between two objects without changing orientation –Possible? Complex search space: boundary tests, etc First step: Problem transformation –Model robot as point –Model obstacles by combining their perimeter + path of robot around it –“Configuration Space”: simpler search

23 Navigation

24

25 Navigation as Simple Search Replace funny robot shape in field of funny shaped obstacles with –Point robot in field of configuration shapes All movement is: –Start to vertex, vertex to vertex, or vertex to goal Search: Start, vertices, goal, & connections A* search yields efficient least cost path

26 Online Search Offline search: –Think a lot, then act once Online search: –Think a little, act, look, think,.. –Necessary for exploration, (semi)dynamic env –Components: Actions, step-cost, goal test –Compare cost to optimal if env known Competitive ratio (possibly infinite)

27 Online Search Agents Exploration: –Perform action in state -> record result –Search locally Why? DFS? BFS? Backtracking requires reversibility –Strategy: Hill-climb Use memory: if stuck, try apparent best neighbor Unexplored state: assume closest –Encourages exploration

28 Lozano-perez, 2000 B&B + DynProg Analysis Algorithm: Select best partial path from Q Test for completion Add path extensions to Q Assume that we are using an Expanded “list” to implement Dynamic Prog. (implemented as a hash table – constant access time). Paths taken from Q ? Assume we have a graph with N nodes and L links. We call a graph where nodes have O(N) links are dense. Graphs where the nodes have a nearly constant number of links are sparse. For dense graphs L is O(N 2 ). O(N) Cost of adding path extension to front of Q ? O(L) Total cost ? O(N 2 + L) Cost of picking path from Q (& cleanup), using linear scan? O(N) Attempts to add path to Q (many are rejected)? O(1)

29 lozano-perez, 2000 Cost and Performance Searching a tree with branching factor b and depth d L = N= b d+1 Worst case time is proportional to number of nodes visited Worst case space is proportional to maximal length of Q (and Expanded) Searching a tree with N nodes and L links Yes Guaranteed to find shortest path O(N) O(N log N) O(N 2 ) Branch & Bound A* Worst Space Worst Time (Sparse) Worst Time (Dense) Search Method


Download ppt "Search: Heuristic &Optimal Artificial Intelligence CMSC 25000 January 16, 2003."

Similar presentations


Ads by Google