artificial intelligence lecture : heuristic search-i ghulam irtaza sheikh– dept cs-bzu adapted...
TRANSCRIPT
![Page 1: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/1.jpg)
Artificial Intelligence
Lecture : Heuristic Search-I
Ghulam Irtaza Sheikh– Dept CS-BZU
Adapted from original course material & others
![Page 2: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/2.jpg)
Today
Hill-climbing
Heuristic search algorithm
Heuristic Evaluation Function
![Page 3: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/3.jpg)
“A commonsense rule (or set of rules) intended to increase the probability of solving some problem”
Heuristic
![Page 4: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/4.jpg)
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
![Page 5: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/5.jpg)
First three levels of the tic-tac-toe state space reduced by symmetry
![Page 6: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/6.jpg)
The “most wins” heuristic applied to the first children in tic-tac-toe
![Page 7: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/7.jpg)
Heuristically reduced state space for tic-tac-toe
![Page 8: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/8.jpg)
Today
Hill-climbing
Heuristic search algorithm
Heuristic Evaluation Function
![Page 9: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/9.jpg)
Hill-Climbing Analog
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
![Page 10: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/10.jpg)
The local maximum problem for hill-climbing with 3-level look ahead
![Page 11: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/11.jpg)
Today
Hill-climbing
Heuristic search algorithm
Heuristic Evaluation Function
![Page 12: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/12.jpg)
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
![Page 13: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/13.jpg)
Best-First Search
![Page 14: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/14.jpg)
Best-First / Greedy Search
Expand the node that seems closest…
What can go wrong?
![Page 15: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/15.jpg)
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
![Page 16: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/16.jpg)
Best First Search
Algorithm Complete Optimal Time SpaceGreedy Best-First Search
What do we need to do to make it complete? Can we make it optimal?
Y* N O(bm) O(bm)
…b
m
![Page 17: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/17.jpg)
The best-first search algorithm
![Page 18: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/18.jpg)
Heuristic search of a hypothetical state space
![Page 19: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/19.jpg)
A trace of the execution of best-first-search
![Page 20: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/20.jpg)
Heuristic search of a hypothetical state space with open and closed states highlighted
![Page 21: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/21.jpg)
Today
Hill-climbing
Heuristic search algorithm
Heuristic Evaluation Function
![Page 22: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/22.jpg)
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)
![Page 23: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/23.jpg)
The start state, first moves, and goal state for an example-8 puzzle
![Page 24: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/24.jpg)
Three heuristics applied to states in the 8-puzzle
![Page 25: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/25.jpg)
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 nh(n) – from the current state n to the goal state
![Page 26: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/26.jpg)
The heuristic f applied to states in the 8-puzzle
![Page 27: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/27.jpg)
State space generated in heuristic search of the 8-puzzle graph
![Page 28: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/28.jpg)
The successive stages of open and closed that generate the graph are:
![Page 29: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/29.jpg)
Open and closed as they appear after the 3rd iteration of heuristic search
![Page 30: Artificial Intelligence Lecture : Heuristic Search-I Ghulam Irtaza Sheikh– Dept CS-BZU Adapted from original course material & others](https://reader033.vdocuments.site/reader033/viewer/2022061305/55144e7e550346414e8b4fd7/html5/thumbnails/30.jpg)
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