Presentation is loading. Please wait.

Presentation is loading. Please wait.

Heuristic Functions By Peter Lane

Similar presentations


Presentation on theme: "Heuristic Functions By Peter Lane"— Presentation transcript:

1 Heuristic Functions By Peter Lane

2 Heuristics are: strategies using readily accessible information to control problem-solving algorithms.

3 Earliest search problem, the 8-puzzle
A solution for randomly generated 8-puzzle problem is about 22 steps with a branching factor of 3. Meaning that a search of depth 22 would be about 3^22 The problem can be easily simplified with a good heuristic

4 When solving a problem with, for example, A
When solving a problem with, for example, A*, we will need a heuristic function that does not overestimate the number of steps to the goal. Here are two candidates for the 8-puzzle solution: h1= The number of misplaced tiles. h2= The sum of the distances of the tiles from their goal positions. Since no diagonal movement, distance is counted by sum of horizontal and vertical distances; also known as Manhattan distance.

5 characterizing the quality of heuristic The effective Branching factor
characterize the quality of heuristic N= total number of nodes generated by A* d= solution depth b* is the branching factor that a tree of depth d would have in order to contain N + 1 nodes N + 1 = 1 + b* + (b*)^2 + … + (b*) A well designed heuristic would have a value of b* close to 1.

6 When testing the two example heuristics we find:
h1 has better results that h2 h2 dominates h1 h2(n)  h1(n). A* using h2 will never expand more nodes than A* using h1 It is better to use a heuristic function with higher values, without overestimating the number of steps.

7

8 How to invent admissible heuristics
Relaxed problem: a problem with fewer restrictions on the actions. It is admissible because the optimal solution in the original is also a solution in the relaxed problem. Must be at least as expensive as the optimal solution in the relaxed problem. Example: if the problems action were limited to simply “A tile can move from square A to square B”, then h1 would be the optimal heuristic since each square could move to their intended spot in one step. If the relaxed problem is hard to solve, then the values of the heuristic will be expensive.

9 Continuing on inventing heuristics
Subproblems: Example; getting tiles 1,2,3,4 of the 8-puzzle, into there correct position, ignoring the other tiles. The cost for this solution is much less than that of the complete problem. Pattern database stores the solution cost for each sub problem instance. We then compute a heuristic for each complete state during a search by looking up the corresponding subproblem configuration in the database.

10 Learning from “Experience”
In our example, “experience means solving lots of 8-puzzles.” The solutions to previous problems can provide examples from which h(n) can be learned. Consists of a state from the solution path and cost of the solution from that point.

11 Inductive learning algorithms can be used to construct a function h(n) that can predict solution costs for other states that arise during search. They work better when supplied with features of a state that are relevant to its evaluation. One example is “number of misplaced tiles” might help predict the distances of a state from the goal. x1(n). Another example feature, x2(n), would be “number of pairs adjacent tiles that are also adjacent in the goal state.” x1(n) and x2(n) can be also be combined to predict h(n). h(n) = c1 X x1(n) + c2 X x2(n) Constants c1 and c2 are adjusted to give the best fit to the actual data on solution costs. c1 should be positive and c2 should be negative.

12 Quick Summary Heuristics are strategies used for problem solving algorithms. Heuristics are evaluated by the effective branching factor. There are several way to help invent a heuristic Relaxed problems Pattern database of subproblems Learning from Experience

13 ~fin


Download ppt "Heuristic Functions By Peter Lane"

Similar presentations


Ads by Google