Ch 4. Heuristic Search

KU NLP
4.1.3 Heuristic Search and Expert
Systems (1)
 An interesting approach to implementing heuristics is
the use of confidence measures by expert systems to
weigh the results of a rule.
 Expert systems employ confidence measures to
select the conclusions with the highest likelihood of
success.
 Games are ideal vehicles for exploring the design and
behavior of heuristic search algorithm.
1. Search spaces are large enough to require heuristic pruning
2. Most games are complex enough to suggest a rich variety of
heuristic evaluations for comparison and analysis.
3. Games generally do not involve complex representational issues.
4. Because each node of the state space has a common
representation(e.g. a board description), a single heuristic may be
applied throughout the search space.
Heuristic Search
30
KU NLP
4.1.3 Heuristic Search and Expert
Systems (2)
 More realistic problems(such as those found in expert
systems applications, planning, intelligent control,
and machine learning) complicate the implementation
and analysis of heuristic search by requiring multiple
heuristics to deal with different situations in the
problem space.
 A single heuristic may not apply to each state in these domains.
Instead, situation specific problem-solving heuristics are encoded
in the syntax and content of individual problem solving operators.
Heuristic Search
31
Example 4.1.1 The Financial
Advisor (1)
KU NLP
 So far, the knowledge base has been treated as a set
of logical implications, whose conclusions are either
true or false, depending on the truth value of the
premises.
savings_account(adequate)income(adequate) investment(stocks)
 In reality, it is possible that such an individual may
prefer the added security of a combination strategy or
even that of placing all investment money in savings
 The problem solver should try to account for this uncertainty.
 Expert systems have attached a numeric weight (confidence
measure or certainty factor) to the conclusion of each rule.

Savings_account(adequate) income(adequate)
investment(stocks) with confidence=0.8
Heuristic Search
32
Example 4.1.1 The Financial
Advisor (2)
KU NLP
Savings_account(adequate) income(adequate)
investment(combination) with confidence=0.5
 Savings_account(adequate) income(adequate)
investment(savings) with confidence=0.1

 Heuristic search algorithms can use certainty factors
in a number of ways
 The results of all applicable rules could be produced with varying
certainties placed on multiple conclusions.
 The program might return only the result with the strongest
confidence value.
Heuristic Search
33
4.3 Using Heuristics in Games (1)
KU NLP
 Games are good application area for heuristic
algorithm.
 Tow-person games are more complicated than
simple puzzles.
 Hostility
 maximize own advantage while minimize opponent’s
opportunity of win.
 Unpredictable opponent
 different knowledge of games.
 Credit assignment is difficult.
Heuristic Search
34
4.3 Using Heuristics in Games (2)
KU NLP
 Various games
 Checker
 Samuel’s program had an interesting learning component which
allowed its performance to improve with experience. Ultimately, the
program was able to beat its author.
 Evaluate all states at a level with a evaluation polynomial.
(C1*piece advantage + C2*advancement + C3*center control +
C4*fork treat + C5*mobility …)
 If the evaluation polynomial led to a losing series of moves, the program
adjusted its coefficients to improve performance.

Limitations
 No notion of global strategy, it may lead the program into local maxima.
 The learning component of the program is vulnerable to inconsistencies
in the opponent play.
 Go : Go is a very difficult game to play by machine since the
average branching factor of the game tree is very high.
 Backgammon : a backgammon program must choose its moves
with incomplete information about what may happen.
 Othello, Chess: achieved world-championship level.
Heuristic Search
35
KU NLP
4.3.1 Minimax Procedure on
Exhaustively Searchable Graphs (1)
 If a game whose state space is small enough to be
exhaustively searched, then the problem is
systematically searching the space of possible moves
and counter moves by the opponent.
 A game of “nim” (Fig 4.13, p145, tp37)
 To predict opponent’s behavior, we assume that our opponent
uses the same knowledge of the state space as we use.
 MAX represents the player trying to win, or to
maximize the advantage. MIN is the opponent who
attempts to minimize MAX’s score.
Heuristic Search
36
KU NLP
4.3.1 Minimax Procedure on
Exhaustively Searchable Graphs (2)
Heuristic Search
37
KU NLP
4.3.1 Minimax Procedure on
Exhaustively Searchable Graphs (3)
 In implementing minimax, label each level MIN or
MAX in the search space according to whose
move it is at that point in the game (Fig 4.14,
p146)
 If the parent state is a MAX node, give it the maximum value
among its children.
 If the parent is a MIN node, give the minimum value of its
children.
 The value assigned to each state indicates the value of the
best state that this player can hope to achieve.
Heuristic Search
38
KU NLP
4.3.1 Minimax Procedure on
Exhaustively Searchable Graphs (4)
Heuristic Search
39
4.3.2 Minimaxing to Fixed Ply
Depth
KU NLP
 In applying MINIMAX to complicated games, the state
space is searched to a predefined number of levels(Nmove look-ahead)
 The value propagated back to the root node is simply the heuristic
value of the best state that can be reached in N moves.
 Many game heuristics measure the advantage of one
player over another.
 simple heuristic take the difference in the number of pieces
belonging to MAX and MIN, and try to maximize the difference.
 more sophisticated strategy might assign different values to the
pieces (e.g. queen, pawn, king, checker) or location on the board.
 Game playing programs typically look ahead a fixed
ply depth. The states on that ply are measured
heuristically and the values are propagated back up
the graph using MINIMAX.
Heuristic Search
40
Minimax Search (1)
KU NLP
 One-ply search
A
B
(8)
 two-ply search
C
(3)
D
(-2)
A
B
C
D
E F G H I
J K
(9) (-6) (0) (0) (-2) (-4)(-3)
Heuristic Search
41
Minimax Search (2)
KU NLP
 Two-ply search (continued)
A (-2)
B (-6)
C (-2)
Maximizing ply
D (-4)
Minimizing ply
E F G H I
J K
(9) (-6) (0) (0) (-2) (-4)(-3)
Heuristic Search
42
Minimax Search (3)
KU NLP
Heuristic Search
43
Minimax Procedure (1)
KU NLP
 When a heuristic applied with a limited look-ahead, it
is possible that the depth of the look-ahead may not
detect that a heuristically promising path leads to a
bad situation later in the game.
 Horizon effect: selection of the state may cause the entire game to
be lost.
 Selective deepening of search : searching several plies deeper
from states that look exceptionally good.
 The evaluations that take place very deep in the
space can be biased by their very depth.
 A desirable heuristic can be one that attempts to
measure the conflict in the game.
 A heuristic applied to tic-tac-toe (Fig 4.16, tp45)
Heuristic Search
44
Minimax
Procedure (2)
KU NLP
Heuristic Search
45
Minimax Procedure (3)
KU NLP
Heuristic Search
46
Minimax Procedure (4)
KU NLP
Heuristic Search
47
4.3.3 Alpha-Beta Procedure (1)
KU NLP
 Minimax procedure is a depth-first process, its
efficiency can be improved by using branch-andbound techniques in which partial solutions that are
clearly worse than known solutions can be
abandoned early.
 It requires the maintenance of two threshold values
(alpha and beta)
 one representing a lower bound on the value that a maximizing
node may be assigned
 one representing an upper bound on the value that a minimizing
node may be assigned.
Heuristic Search
48
4.3.3 Alpha-Beta Procedure (2)
KU NLP
 At maximizing levels, rule out a move early if it
becomes clear that its value will be less than the
current threshold.
 At minimizing levels, search will be terminated if
values that are greater than the current threshold
are discovered.
Heuristic Search
49
4.3.3 Alpha-Beta Procedure (3)
KU NLP
 An Alpha Cutoff
A (3)
Maximizing ply
B (3)
C (-5)
Minimizing ply
(3) D
Heuristic Search
(5) E
F (-5)
G
50
4.3.3 Alpha-Beta Procedure (4)
KU NLP
 Alpha and Beta Cutoffs
A (3)
B (3)
Maximizing ply
C
Minimizing ply
D
(3)
E
(5)
(0) I
(0) K
Heuristic Search
F (0) G
H
Maximizing ply
J
(5)
M N
Minimizing ply
L
51
4.3.3 Alpha-Beta Procedure (5)
KU NLP
 Alpha and Beta Cutoffs (continued)
A (5)
Maximizing ply
C (5)
B
Minimizing ply
D
(3)
E
(5)
(0) I
(0) K
Heuristic Search
F (5)
G (7) H
(4)
Maximizing ply
J M N
(5) (7)
Minimizing ply
L
52
4.3.3 Alpha-Beta Procedure (6)
KU NLP
Heuristic Search
53