Presentation is loading. Please wait.

Presentation is loading. Please wait.

Artificial Intelligence

Similar presentations


Presentation on theme: "Artificial Intelligence"— Presentation transcript:

1 Artificial Intelligence
Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others

2 Today Hill-climbing Heuristic search algorithm
Heuristic Evaluation Function

3 Heuristic “A commonsense rule (or set of rules) intended to increase the probability of solving some problem”

4 Heuristics Rules for choosing paths in a state space that most likely lead to an acceptable problem solution Purpose Reduce the search space Reasons May not have exact solutions, need approximations Computational cost is too high Fallible

5 First three levels of the tic-tac-toe state space reduced by symmetry

6 The “most wins” heuristic applied to the first children in tic-tac-toe

7 Heuristically reduced state space for tic-tac-toe

8 Today Hill-climbing Heuristic search algorithm
Heuristic Evaluation Function

9 Hill-Climbing Analog Principle Problem
Go uphill along the steepest possible path until no farther up Principle Expand the current state of the search and evaluate its children Select the best child, ignore its siblings and parent No history for backtracking Problem Local maxima – not the best solution

10 The local maximum problem for hill-climbing with 3-level look ahead
Insert fig 4.4

11 Today Hill-climbing Heuristic search algorithm
Heuristic Evaluation Function

12 The Best-First Search Also heuristic search – use heuristic (evaluation) function to select the best state to explore Can be implemented with a priority queue Breadth-first implemented with a queue Depth-first implemented with a stack

13 Best-First Search

14 Best-First / Greedy Search
Expand the node that seems closest… What can go wrong?

15 Best-First / Greedy Search
A common case: Best-first takes you straight to the goal on a wrong path Worst-case: like a badly-guided DFS in the worst case Can explore everything Can get stuck in loops if no cycle checking Like DFS in completeness (finite states w/ cycle checking) b b

16 Best First Search What do we need to do to make it complete?
Algorithm Complete Optimal Time Space Greedy Best-First Search Y* N O(bm) O(bm) b m What do we need to do to make it complete? Can we make it optimal?

17 The best-first search algorithm

18 Heuristic search of a hypothetical state space

19 A trace of the execution of best-first-search

20 Heuristic search of a hypothetical state space with open and closed states highlighted

21 Today Hill-climbing Heuristic search algorithm
Heuristic Evaluation Function

22 Heuristic Evaluation Function
Heuristics can be evaluated in different ways 8-puzzle problem Heuristic 1: count the tiles out of places compared with the goal state Heuristic 2: sum all the distances by which the tiles are out of pace, one for each square a tile must be moved to reach its position in the goal state Heuristic 3: multiply a small number (say, 2) times each direct tile reversal (where two adjacent tiles must be exchanged to be in the order of the goal)

23 The start state, first moves, and goal state for an example-8 puzzle
Insert fig 4.12

24 Three heuristics applied to states in the 8-puzzle

25 Heuristic Design Use the limited information available in a single state to make intelligent choices Must be its actual performance on problem instances The solution path consists of two parts: from the starting state to the current state, and from the current state to the goal state The first part can be evaluated using the known information The second part must be estimated using unknown information The total evaluation can be f(n) = g(n) + h(n) g(n) – from the starting state to the current state n h(n) – from the current state n to the goal state

26 The heuristic f applied to states in the 8-puzzle
Insert fig 4.15

27 State space generated in heuristic search of the 8-puzzle graph
Insert fig 4.16

28 The successive stages of open and closed that generate the graph are:

29 Open and closed as they appear after the 3rd iteration of heuristic search

30 Heuristic Design Summary
f(n) is computed as the sum of g(n) and h(n) g(n) is the depth of n in the search space and has the search more of a breadth-first flavor. h(n) is the heuristic estimate of the distance from n to a goal The h value guides search toward heuristically promising states The g value grows to determine h and force search back to a shorter path, and thus prevents search from persisting indefinitely on a fruitless path


Download ppt "Artificial Intelligence"

Similar presentations


Ads by Google