 # Lights Out Issues Questions? Comment from me.

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

Lights Out Issues Questions? Comment from me

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

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

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.

Romania with step costs in km

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.

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.

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.

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.

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.

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.)

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*

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.

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

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) = ??

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

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

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?

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

Section 3.7.3 – Bidirectional Search

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

Similar presentations