Professional Documents
Culture Documents
Heuristic
1. From Greek heuriskein, “to find”.
5. In state space search, heuristics are formalized as rules for choosing those
branches in a state space that are most likely to lead to an acceptable problem
solution.
INTRODUCTION
• Al problem solvers employ heuristics in two situations:-
A R T I F I C I A L I N T E L L I G E N C E: Structure and Strategies for Complex Problem Solving, 4th Edition George F. Luger © 2002 Addison Wesley
Tic-Tac-Toe
• Heuristics
– After the move of opponent, The “max
win lines” heuristics can be applied to
the resulting state of the game.
– As search continues, each move
evaluates the children of a single
node: exhaustive search is not
required.
– Figure shows the reduced search
after three steps in the games. States
are marked with their heuristics
values.
Tic-Tac-Toe
• COMPLAXITY
– It is difficult to compute the exact number of states that must be examined.
However, a crude upper bound can be computed by assuming a maximum
of nine moves in a game and eight children per move.
– In reality:
• The number of states will be smaller, as board fills and reduces our
options.
• In addition opponent is responsible for half the moves.
• Even this crude upper bound of 8 x 9 or 72 states is an improvement of
four orders of magnitude over 9!.
ALGORITHM FOR HEURISTICS SEARCH
Implementing Best-First-Search
• Best first search uses lists to maintain states:
• Each iteration of the loop consider the most “promising” state on the OPEN list.
• Because these estimates are heuristic in nature, the next state to be examined
may be from any level of the state space. When OPEN is maintained as a
sorted list, it is often referred a priority queue.
• Figure 4.4 shows a hypothetical state space with heuristic evaluations attached
to some of its states.
• The goals of best –first search is to find the goals state by looking at as few
states as possible: the more informed the heuristic, the fewer states are
processed in finding the goal.
BEST-FIRST-SEARCH
• The best-first search algorithm always selects the most promising state on
OPEN for further expansion.
• It does not abandon all the other states but maintains them on OPEN .
• In the event a heuristic leads the search down a path that proves incorrect,
the algorithm will eventually retrieve some previously generated next best
state from OPEN and shift its focus to another part of the space.
• In the example after the children of state B were found to have poor
heuristic evaluations, the search shifted its focus to state C.
• In best-first-search the OPEN list allows backtracking from paths that fail
to produce a goal.
Figure 3.6: State space of the 8-puzzle generated by “move blank” operations.
IMPLEMENTING HEURISTIC EVALUATION FUNCTIONS
• We will evaluate performance of various heuristics for solving the
8-puzzle.
• Figure shows a start and goal state for the 8-puzzle, along with the
first three states generated in the search.
IMPLEMENTING HEURISTIC EVALUATION FUNCTIONS
• Heuristic 1
– The simplest heuristic, counts the tiles out of place in
each state when it is compared with the goal.
– The state that had fewest tiles out of place is probably
closer to the desired goal and would be the best to
examine next.
– However, this heuristic does not use all of the information
available in a board configuration, because it does not
take into account the distance the tiles must be moved.
IMPLEMENTING HEURISTIC EVALUATION FUNCTIONS
• Heuristic 2
– A “better” heuristic would sum all the distances
by which the tiles are out of place, one for each
square a tile must be moved to reach its
position in the goal state.
IMPLEMENTING HEURISTIC EVALUATION FUNCTIONS
• Heuristic 3
– Above two heuristics fail to take into account the problem of tile
reversals.
– If two tiles are next to each other and the goal requires their being in
opposite locations, it takes more than two moves to put them back to
place, as the tiles must “go around” each other.
– Where:-
• g(n) measures the actual length of the path from start state
to any state n.
• More realistic problems greatly complicate the implementation and analysis of heuristic search
by requiring multiple heuristics to deal with different situations in the problems space.
• Instead, situation specific problem-solving heuristics are encoded to deal with various states.
• Each solution step incorporates its own heuristic that determines when, it should be applied.
EXAMPLE: THE FINANCIAL ADVISOR
• An individual with adequate savings and income should invest in stocks.
saving_account(adequate)income(adequate)investment(stocks).
• Thus the rule is a heuristic in nature. The problem solver should be programmed to account for this
uncertainty. Additional factors may also be taken into account to make the rule more informed and
capable of finer distinctions.
– Age of the investor.
– Long term prospects for security.
– Advancement in investors profession.
EXAMPLE: AN EXPERT SYSTEM
•
THE FINANCIAL ADVISOR
Now how the financial advisor is going to weigh the above heuristic to decide the best option or to
find out a solution which is closer to the best solution.
• One way is to attach a confidence measure with the conclusion of each rule. Attach a real number
between –1 to 1 as:-
• 1 corresponding to certainty ‘True’.
• -1 to define a value of ‘False’.
• Values in between reflect varying confidence levels.
• This way the preceding rules would be reflected as under:
saving_account(adequate)income(adequate)investment(stocks).
with confidence = 0.8
saving_account(adequate)income(adequate)investment(combination).
with confidence = 0.5
saving_account(adequate)income(adequate)investment(savings).
with confidence = 0.1
ADMISSIBILITY MEASURES
• A search algorithm is admissible if it is guaranteed to find a minimal path to solution, whenever
such a path exists.
• Breadth-first search is an admissible search strategy .
• In determining the properties of admissible heuristics, we define an evaluation
function f*. f*(n) = g*(n) + h*(n)
nj
ng
• Monotonic heuristic is admissible. Consider any path in the space as a sequence of states S1,
S2, …… Sg, where S1 is the start state and Sg is the goal: For the sequence of moves in this arbitrary
selected path:
S1 to S2 h(S1) - h(S2) cost (S1, S2) by monotone property
S2 to S3 h(S2) - h(S3) cost (S2, S3) by monotone property
S3 to S4 h(S3) - h(S4) cost (S3, S4) by monotone property
. . . . by monotone property
. . . . by monotone property
Sg-1 to Sg h(Sg-1) - h(Sg) - cost (Sg-1, Sg) by monotone property
• Summing each column and using the monotone property of h(Sg) = 0:
path S1 to Sg h(S1) cost (S1, Sg)