0% found this document useful (0 votes)
34 views15 pages

4 Alpha Beta Pruning

The document discusses adversarial search and the minimax algorithm with alpha-beta pruning for game playing. It describes how alpha-beta pruning improves upon minimax by pruning branches that cannot influence the decision. It provides examples to illustrate how alpha-beta pruning updates alpha and beta values and prunes branches accordingly.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views15 pages

4 Alpha Beta Pruning

The document discusses adversarial search and the minimax algorithm with alpha-beta pruning for game playing. It describes how alpha-beta pruning improves upon minimax by pruning branches that cannot influence the decision. It provides examples to illustrate how alpha-beta pruning updates alpha and beta values and prunes branches accordingly.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

ADVERSARIAL SEARCH

MINIMAX ALGORITHM WITH ALPHA BETA PRUNING


Search algorithms for game playing
• Higher branching factor, and
• number and type of moves,
• timing
• Contingencies introduced by other agents
makes for an optimal path infeasible/inappropriate for the
search algorithms
Game-playing research has therefore spawned a number of
interesting ideas on how to make the best possible use of time.
E.g Pruning – ignoring portions of the search tree that
makes no difference to the final choice, Heuristic evaluation
functions approximating utility functions
ALPHA-BETA PRUNING
• When applied to a standard minimax tree, it returns the same move as minimax
would, but prunes away branches that cannot possibly influence the final
decision
• Example

X Y
ALPHA-BETA PRUNING
• When applied to a standard minimax tree, it returns the same move as minimax
would, but prunes away branches that cannot possibly influence the final
decision
• Example

MIN(2, X, Y)

X Y
ALPHA-BETA PRUNING
• When applied to a standard minimax tree, it returns the same move as minimax
would, but prunes away branches that cannot possibly influence the final
decision
• Example
MAX(3, Z, 2) = 3
Z = MIN(2, X, Y) which is < 2

MINIMAX DECISION ARE


MIN(2, X, Y) INDEPENDENT OF THE
VALUES OF THE PRUNED LEAVES X
AND Y.

X Y
ALPHA BETA PRUNING
• APPLIED TO TREES OF ANY DEPTH, AND IT IS OFTEN POSSIBLE TO PRUNE ENTIRE SUBTREES
RATHER THAN JUST LEAVES
• General Principle
Alpha – Beta Pruning Parameters
• Minimax search is depth-first, so at any one time we just have to consider the
nodes along a single path in the tree. Alpha–beta pruning gets its name from the
following two parameters that describe bounds on the backed-up values that
appear anywhere along the path:

α = the value of the best (i.e., highest-value) choice we have found so far at any choice
point along the path for MAX.
β = the value of the best (i.e., lowest-value) choice we have found so far at any choice
point along the path for MIN.
Parameters Update and pruning based on
parameters
• Alpha–beta search updates the values of α and β as it goes
along and prunes the remaining branches at a node (i.e.,
terminates the recursive call) as soon as the value of the
current node is known to be worse than the current α or β
value for MAX or MIN, respectively.
• MIN-VALUE returns when a result is found less than α else
updates β with the minimum value found
• MAX-VALUE returns when a result is found greater than β
else updates α with the maximum value found
S.No Node Type v α β
Example 1- Solution
1 A Max -∞ -∞ ∞
v – local variable
2 B Min +∞ -∞ ∞
α, β – function arguments
3 T1 T 3 -∞ ∞
4 B Min 3 -∞ 3
5 T2 T 12 -∞ 3
6 B Min 3 -∞ 3
7 T3 T 8 -∞ 3
8 B Min 3 -∞ 3
9 A Max 3 3 ∞
10 C Min +∞ 3 ∞
S.No Node Type V α β
11 T4 T 2 3 ∞
18 D Min 5 3 5
12 C Min 2 3 ∞ (v<α)
19 T9 T9 2 3 5
13 A Max 3 3 ∞
20 D Min 2 3 5 (v<α)
14 D Min +∞ 3 ∞
21 A Max 3 3 ∞
15 T7 T 14 3 ∞
16 D Min 14 3 ∞
17 T8 T 5 3 ∞
Example 1- Solution contd…

OPTIMAL MOVE
v=3
α=3
β=+∞
v=2
v=3 α=3
α = -∞ v=2 β=5
β=3 α=3
β=+∞
Example 2
S.No Node Type v α β Example 2 - Solution

1 A Max -∞ -∞ +∞
2 B Min +∞ -∞ +∞
3 D Max -∞ -∞ +∞
4 H T 1 -∞ +∞
5 D Max 1 1 +∞
6 I T 2 1 +∞
7 D Max 2 2 +∞
8 B Min 2 -∞ 2
9 E Max -∞ -∞ 2
10 J T 5 -∞ 2 S.No Node Type v α β
11 E Max 5 -∞ 2 (v>β) 18 M T 1 0 2
12 B Min 2 -∞ 2 19 F Max 1 1 +∞
13 A Max 2 2 +∞ 20 C Min 1 2 1 (v<α)
14 C Min +∞ 2 +∞ 21 A Max 2 2 +∞
15 F Max -∞ 2 +∞
16 L T 0 2 +∞
17 F Max 0 2 +∞
Example 2 Solution contd…

Optimal move
Performance of Minimax algorithm with and
without Alpha Beta Pruning
• Time Complexity of search using minimax is O(bm)
• Effectiveness of pruning depends on the order of the
child nodes in the tree With an accurate ordering
(best first search) of the successors efficiency is
O(bm/2) (i.e effective branching factor of )
• With a random choice of successors the efficiency was
found to be

You might also like