Professional Documents
Culture Documents
Ai CH 4 2
Ai CH 4 2
Ai CH 4 2
11
Luger: Artificial Intelligence, 6th edition. © Pearson Education Limited, 2009
Tic-Tac-Toe
• Heuristics
– Other alternatives and their descendants are eliminated.
– Approximately two-thirds of the space is pruned away with
the first move .
– After the first move, the opponent can choose either of two
alternative moves.
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:
• 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.
• 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
– Where:-
• 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)
h(n) h*(n)
• Comparison of
search using
heuristics with
search by breadth-
first search.
• Heuristic used is
f(n) = g(n) + h(n)
where h(n) is tiles
out of place.
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)