Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lights Out Issues Questions? Comment from me.

Similar presentations


Presentation on theme: "Lights Out Issues Questions? Comment from me."— Presentation transcript:

1 Lights Out Issues Questions? Comment from me

2 Section 3.6.4 – 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, hSLD(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 it’s 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 A* search example 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, it’s the next node we will expand.

9 A* search example Open List: Fagaras Pitesti Timisoara Zerind Craiova
Sibiu Arad Oradea A* search example 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 – it’s at the top of the sorted open list.

10 A* search example Open List: Pitesti Timisoara Zerind Bucharest
Craiova Sibiu Arad Oradea A* search example When we expand Fagaras, we produce two new nodes. As humans we recognize that one of those is Bucharest. BUT REMEMBER, the computer doesn’t 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 Craiova Sibiu
Rimricu Vicea Arad Oradea A* search example Now it looks like Bucharest is at the top of the open list… Now we “expand” the node for Bucharest. We’re done! (And we know the path that we’ve 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 fi is finished A* expands all nodes with f(n) < C* A* expands some nodes with f(n) = C* A* expands no nodes with f(n) > C*

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

14 A* search A* algorithm f(G2) = g(G2) since h(G2) = > g(G1) since G2 is suboptimal  f(n) since h is admissible since f(G2) > f(n), A* will never select G2 for expansion

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

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

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

18 Heuristic Functions Admissible heuristic example: for the 8-puzzle h1(n) = number of misplaced tiles h2(n) = total Manhattan distance i.e. no of squares from desired location of each tile h1(S) = ?? 6 h2(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 h1(n) gives the shortest solution If the rules are relaxed so that a tile can move to any adjacent square, then h2(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 Section 3.7.3 – Bidirectional Search


Download ppt "Lights Out Issues Questions? Comment from me."

Similar presentations


Ads by Google