Heuristic Search
-
Upload
noel-solis -
Category
Documents
-
view
58 -
download
3
description
Transcript of Heuristic Search
![Page 1: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/1.jpg)
Mahgul Gulzai
Moomal Umer
Rabail Hafeez
![Page 2: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/2.jpg)
Introduction Definition of heuristic searchAlgorithms of heuristic search
Best first search Hill climbing strategy Implementing heuristic evaluation functions
Admissibility, Monotonicity and Informedness Using heuristic in games
Artificial Intelligence www.csc.csudh.edu
![Page 3: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/3.jpg)
Human generally consider number of alternative strategies on their way to solving a problem .
To obtain the best possible strategy, humans use search.
For example : A chess player consider number of possible moves, A Doctor examine several possible diagnoses .
Human Problem solving seems to be based on judgmental rules that guide our search to those portion of state Space that seems some how promising.
These rules are known as “Heuristics”
Artificial Intelligence www.csc.csudh.edu
![Page 4: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/4.jpg)
George Polya defines Heuristics as, “The study of methods and rules of discovery and invention”.
A heuristic is a method that might not always find the best solution . but is guaranteed to find a good solution in
reasonable time. By sacrificing completeness it increases
efficiency. Useful in solving tough problems which
could not be solved any other way. solutions take an infinite time or very long time
to compute. Artificial Intelligence www.csc.csudh.edu
![Page 5: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/5.jpg)
Heuristic Search is used in AI in two situations:1.When a problem doesn’t have an exact
solution.2.There is an exact solution but the
computational cost of finding it exceeds the limit.
Artificial Intelligence www.csc.csudh.edu
![Page 6: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/6.jpg)
Consider the game of tic-tac-toe. Even if we use symmetry to reduce the
search space of redundant moves, the number of possible paths through the search space is something like 12 x 7! = 60480.
That is a measure of the amount of work that would have to be done by a brute-force search.
Artificial Intelligence www.csc.csudh.edu
![Page 7: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/7.jpg)
First three levels of the tic-tac-toe state space First three levels of the tic-tac-toe state space reduced by symmetryreduced by symmetry
Artificial Intelligence www.csc.csudh.edu
![Page 8: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/8.jpg)
The “most wins” heuristic applied to the first children in tic-tac-toe
Artificial Intelligence www.csc.csudh.edu
![Page 9: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/9.jpg)
CSC411Artificial Intelligence
Heuristically reduced state space for tic-tac-toe
Artificial Intelligence www.csc.csudh.edu
![Page 10: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/10.jpg)
Using this rule, we can see that a corner square has heuristic value of 3, a side square has a heuristic value of 2, but the centre square has a heuristic value of 4.
So we can prune the left and right branches of the search tree.
This removes 2/3 of the search space on the first move.
If we apply the heuristic at each level of the search, we will remove most of the states from consideration thereby greatly improving the efficiency of the search.
Artificial Intelligence www.csc.csudh.edu
![Page 11: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/11.jpg)
Heuristic search is implemented in two parts: The heuristic measure. The search algorithm.
Artificial Intelligence www.csc.csudh.edu
![Page 12: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/12.jpg)
Use heuristic to move only to states that are better than the current state.
Always move to better state when possible.The process ends when all operators have
been applied and none of the resulting states are better than the current state.
Artificial Intelligence www.csc.csudh.edu
![Page 13: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/13.jpg)
• Will terminate when at local optimum.• The order of application of operators can
make a big difference.• Can’t see past a single move in the state
space
Artificial Intelligence www.csc.csudh.edu
![Page 14: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/14.jpg)
The local maximum problem for hill-climbing with 3-level look ahead
Artificial Intelligence www.csc.csudh.edu
![Page 15: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/15.jpg)
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
Artificial Intelligence www.csc.csudh.edu
![Page 16: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/16.jpg)
The best-The best-first first search search algorithmalgorithm
Artificial Intelligence www.csc.csudh.edu
![Page 17: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/17.jpg)
Heuristic search of a hypothetical state space
Artificial Intelligence www.csc.csudh.edu
![Page 18: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/18.jpg)
A trace of the execution of best-first-search
Artificial Intelligence www.csc.csudh.edu
![Page 19: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/19.jpg)
Heuristic search of a hypothetical state space with open and closed states highlighted
Artificial Intelligence www.csc.csudh.edu
![Page 20: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/20.jpg)
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)
Artificial Intelligence www.csc.csudh.edu
![Page 21: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/21.jpg)
The start state, first moves, and goal state for an example-8 puzzle
Artificial Intelligence www.csc.csudh.edu
![Page 22: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/22.jpg)
Three heuristics applied to states in the 8-puzzle
Artificial Intelligence www.csc.csudh.edu
![Page 23: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/23.jpg)
Use the limited information available in a single state to make intelligent choices
Empirical, judgment, and intuitionMust be its actual performance on problem instancesThe 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 stateArtificial Intelligence www.csc.csudh.edu
![Page 24: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/24.jpg)
The heuristic f applied to states in the 8-puzzle
Artificial Intelligence www.csc.csudh.edu
![Page 25: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/25.jpg)
State space generated in heuristic search of the 8-puzzle graph
Artificial Intelligence www.csc.csudh.edu
![Page 26: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/26.jpg)
The successive stages of open and closed that generate the graph are:
Artificial Intelligence www.csc.csudh.edu
![Page 27: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/27.jpg)
Open and closed as they appear after the 3rd iteration of heuristic search
Artificial Intelligence www.csc.csudh.edu
![Page 28: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/28.jpg)
evaluation function for the states in a search space, you are interested in two things:
g(n): How far is state n from the start state? h(n): How far is state n from a goal state? Evaluation function. This gives us the
following evaluation function: f(n) = g(n) + h(n) where g(n) measures the actual length of the path from the start state to the state n, and h(n) is a heuristic estimate of the distance from a state n to a goal state.
Artificial Intelligence www.csc.csudh.edu
![Page 29: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/29.jpg)
Expert System employ confidence measures to select the conclusions with the highest likelihood of the success through heuristics implementation.
Artificial Intelligence www.csc.csudh.edu
![Page 30: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/30.jpg)
A best-first search algorithm guarantee to find a best path, if exists, if the algorithm is admissible.
A best-first search algorithm is admissible if its heuristic function h is monotone.
Artificial Intelligence www.csc.csudh.edu
![Page 31: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/31.jpg)
Admissibility and Algorithm A*Admissibility and Algorithm A*
Artificial Intelligence www.csc.csudh.edu
![Page 32: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/32.jpg)
Monotonicity and InformednessMonotonicity and Informedness
Artificial Intelligence www.csc.csudh.edu
![Page 33: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/33.jpg)
Comparison of state space searched using heuristic search with space searched by breadth-first search. The proportion of the graph searched heuristically is shaded. The optimal search selection is in bold. Heuristic used is f(n) = g(n) + h(n) where h(n) is tiles out of place.Artificial Intelligence www.csc.csudh.edu
![Page 34: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/34.jpg)
Games Two players attempting to win Two opponents are referred to as MAX and
MINA variant of game nim
A number of tokens on a table between the 2 opponents
Each player divides a pile of tokens into two nonempty piles of different sizes
The player who cannot make division losses
Artificial Intelligence www.csc.csudh.edu
![Page 35: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/35.jpg)
State space for a variant of nim. Each state partitions the seven matches into one or more piles
Exhaustive SearchExhaustive Search
Artificial Intelligence www.csc.csudh.edu
![Page 36: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/36.jpg)
Principles MAX tries to win by maximizing her score, moves to a
state that is best for MAX MIN, the opponent, tries to minimize the MAX’s score,
moves to a state that is worst for MAX Both share the same information MIN moves first The terminating state that MAX wins is scored 1,
otherwise 0 Other states are valued by propagating the value of
terminating statesValue propagating rules
If the parent state is a MAX node, it is given the maximum value among its children
If the parent state is a MIN state, it is given the minimum value of its children
Artificial Intelligence www.csc.csudh.edu
![Page 37: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/37.jpg)
Exhaustive minimax for the game of nim. Bold lines indicate forced win for MAX. Each node is marked with its derived value (0 or 1) under minimax.
Artificial Intelligence www.csc.csudh.edu
![Page 38: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/38.jpg)
If cannot expand the state space to terminating (leaf) nodes (explosive), can use the fixed ply depth
Search to a predefined number, n, of levels from the starting state, n-ply look-ahead
The problem is how to value the nodes at the predefined level – heuristics
Propagating values is similar Maximum children for MAX nodes Minimum children for MIN nodes
Artificial Intelligence www.csc.csudh.edu
![Page 39: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/39.jpg)
Minimax to a hypothetical state space. Leaf states show heuristic values; internal states show backed-up values.
Artificial Intelligence www.csc.csudh.edu
![Page 40: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/40.jpg)
Heuristic measuring conflict applied to states of tic-tac-toe
Artificial Intelligence www.csc.csudh.edu
![Page 41: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/41.jpg)
Two-ply minimax applied to the opening move of tic-tac-toe
Artificial Intelligence www.csc.csudh.edu
![Page 42: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/42.jpg)
Two ply minimax, and one of two possible MAX second moves
Artificial Intelligence www.csc.csudh.edu
![Page 43: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/43.jpg)
Two-ply minimax applied to X’s move near the end of the game
Artificial Intelligence www.csc.csudh.edu
![Page 44: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/44.jpg)
Alpha-beta pruning to improve search efficiencyProceeds in a depth-first fashion and creates two
values alpha and beta during the searchAlpha associated with MAX nodes, and never
decreasesBeta associated with MIN nodes, never increasesTo begin, descend to full ply depth in a depth-first
search, and apply heuristic evaluation to a state and all its siblings. The value propagation is the same as minimax procedure
Next, descend to other grandchildren and terminate exploration if any of their values is >= this beta value
Terminating criteria Below any MIN node having beta <= alpha of any of its MAX
ancestors Below any MAX node having alpha >= beta of any of its MIN
ancestorsArtificial Intelligence www.csc.csudh.edu
![Page 45: Heuristic Search](https://reader030.fdocuments.us/reader030/viewer/2022033103/5681354d550346895d9ca945/html5/thumbnails/45.jpg)
Artificial Intelligence www.csc.csudh.edu