Download presentation

Presentation is loading. Please wait.

Published byJamari Braselton Modified over 2 years ago

1
Lights Out Issues Questions? Comment from me 1

2
2 Section – A* Search A* Search employs search with estimates of remaining distance dynamic programming

3
A* search Premise - Avoid expanding paths that are already expansive Evaluation function f(n) = g(n) + h(n) g(n) = cost so far to reach n h(n) = estimated cost to goal from n f(n) = estimated total cost of path through n to goal

4
A* search A* search uses an admissible heuristic i.e., h(n) h*(n) where h*(n) is the true cost from n. (also require h(n) 0, so h(G) = 0 for any goal G.) example, h SLD (n) never overestimates the actual road distance.

5
Romania with step costs in km

6
A * search example Open List: Arad We start with our initial state Arad. We make a node and add it to the open list. Since its the only thing on the open list, we expand the node. Think of the open list as a priority queue (or heap) that sorts the nodes inside of it according to their g()+h() score.

7
A * search example Open List: Sibiu Timisoara Zerind We add the three nodes we found to the open list. We sort them according to the g()+h() calculation.

8
A * search example Open List: Rimricu Vicea Fagaras Timisoara Zerind Arad Oradea When we expand Sibiu, we produce four additional nodes. These also are placed into the Open List in order based on the g()+h() calculation. We see that Rimricu Vicea is at the top of the open list; so, its the next node we will expand.

9
A * search example Open List: Fagaras Pitesti Timisoara Zerind Craiova Sibiu Arad Oradea When we expand Rimricu Vicea, we produce three new nodes that are placed into the Open List. Fagaras will be the next node we should expand – its at the top of the sorted open list.

10
A * search example Open List: Pitesti Timisoara Zerind Bucharest Craiova Sibiu Arad Oradea When we expand Fagaras, we produce two new nodes. As humans we recognize that one of those is Bucharest. BUT REMEMBER, the computer doesnt check a node until it comes OFF the Open List, not going in. Therefore, Pitesti is the next best node.

11
A * search example Open List: Bucharest Timisoara Zerind Bucharest Craiova Sibiu Rimricu Vicea Craiova Arad Oradea Now it looks like Bucharest is at the top of the open list… Now we expand the node for Bucharest. Were done! (And we know the path that weve found is optimal.)

12
A* search Properties of A* Complete?? Yes, unless there are infinitely many nodes with f f(G) Time?? Exponential in [relative error in h x length of solution.] Space?? Keeps all nodes in memory Optimal?? Yes – cannot expand f i+1 until f i is finished A* expands all nodes with f(n) C*

13
A* search A* algorithm Optimality of A* (standard proof) Suppose some suboptimal goal G 2 has been generated and is in the queue. Let n be an unexpanded node on a shortest path to an optimal goal G 1.

14
A* search A* algorithm f(G 2 ) = g(G 2 )since h(G 2 ) = 0 > g(G 1 )since G 2 is suboptimal f(n)since h is admissible since f(G 2 ) > f(n), A* will never select G 2 for expansion

15
Heuristic Functions Admissible heuristic example: for the 8-puzzle h 1 (n) = number of misplaced tiles (Hamming Distance) h 2 (n) = total Manhattan distance i.e. no of squares from desired location of each tile h 1 (S) = ?? h 2 (S) = ??

16
Heuristic Functions Admissible heuristic example: for the 8-puzzle h 1 (n) = number of misplaced tiles h 2 (n) = total Manhattan distance i.e. no of squares from desired location of each tile h 1 (S) = ?? 6 h 2 (S) = ?? = 14

17
Heuristic Functions Dominance if h 1 (n) h 2 (n) for all n (both admissible) then h 2 dominates h 1 and is better for search Typical search costs in the 8-puzzle problem: d = 14 IDS = 3,473,941 nodes A*(h 1 ) = 539 nodes A*(h 2 ) = 113 nodes d = 24 IDS 54,000,000,000 nodes A*(h 1 ) = 39,135 nodes A*(h 2 ) = 1,641 nodes

18
Heuristic Functions Admissible heuristic example: for the 8-puzzle h 1 (n) = number of misplaced tiles h 2 (n) = total Manhattan distance i.e. no of squares from desired location of each tile h 1 (S) = ?? 6 h 2 (S) = ?? = 14 But how do you come up with a heuristic?

19
Heuristic Functions Relaxed problems Admissible heuristics can be derived from the exact solution cost of a relaxed version of the problem If the rules of the 8-puzzle are relaxed so that a tile can move anywhere, then h 1 (n) gives the shortest solution If the rules are relaxed so that a tile can move to any adjacent square, then h 2 (n) gives the shortest solution Key point: the optimal solution cost of a relaxed problem is no greater than the optimal solution cost of the real problem

20
20 Section – Bidirectional Search

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google