0% found this document useful (0 votes)
14 views13 pages

Alpha Beta Pruningalgorithm-unit 2

Alpha-beta pruning is an optimization technique for the minimax algorithm that reduces the number of nodes evaluated in the game tree by pruning branches that do not influence the final decision. It uses two parameters, Alpha and Beta, to keep track of the best options for both maximizing and minimizing players, allowing for faster decision-making. The algorithm returns the same optimal move as the standard minimax algorithm while significantly improving efficiency by eliminating unnecessary calculations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views13 pages

Alpha Beta Pruningalgorithm-unit 2

Alpha-beta pruning is an optimization technique for the minimax algorithm that reduces the number of nodes evaluated in the game tree by pruning branches that do not influence the final decision. It uses two parameters, Alpha and Beta, to keep track of the best options for both maximizing and minimizing players, allowing for faster decision-making. The algorithm returns the same optimal move as the standard minimax algorithm while significantly improving efficiency by eliminating unnecessary calculations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

ALPHA BETA PRUNING ALGORITHM

Alpha-Beta Pruning

•Alpha-beta pruning is a modified version of the minimax algorithm.


•It is an optimization technique for the minimax algorithm.
•As we have seen in the minimax search algorithm that the number of game states it
has to examine are exponential in depth of the tree.
• Since we cannot eliminate the exponent, but we can cut it to half. Hence there is a
technique by which without checking each node of the game tree we can compute the
correct minimax decision, and this technique is called pruning.
• This involves two threshold parameter Alpha and beta for future expansion, so it is
called alpha-beta pruning.
•It is also called as Alpha-Beta Algorithm.
•Alpha-beta pruning can be applied at any depth of a tree, and sometimes it not only
prune the tree leaves but also entire sub-tree.
The two-parameter can be defined as:
Alpha: The best (highest-value) choice we have found so far at any point along the
path of Maximizer. The initial value of alpha is -∞.
Beta: The best (lowest-value) choice we have found so far at any point along the
path of Minimizer. The initial value of beta is +∞.
The Alpha-beta pruning to a standard minimax algorithm returns the same move as the
standard algorithm does, but it removes all the nodes which are not really affecting the
final decision but making algorithm slow.
Hence by pruning these nodes, it makes the algorithm fast.
Key points about alpha-beta pruning:

The Max player will only update the value of alpha.


The Min player will only update the value of beta.
While backtracking the tree, the node values will be passed to upper nodes instead of
values of alpha and beta.
We will only pass the alpha, beta values to the child nodes.
Alpha beta pruning

•Some branches will never be played by rational players since they include sub-optimal decisions
(for either player)

Alpha beta pruning. Example


MAX

MIN

MAX

4 3 6 2 2 1 9 5 3 1 5 4 7 5
Alpha beta pruning. Example
MAX

MIN

MAX 4

4 3 6 2 2 1 9 5 3 1 5 4 7 5

Alpha beta pruning. Example


MAX

MIN 4

MAX =4

4 3 6 2 2 1 9 5 3 1 5 4 7 5
Alpha beta pruning. Example
MAX

MIN 4

MAX =4
!!
6

4 3 6 2 2 1 9 5 3 1 5 4 7 5

Alpha beta pruning. Example


MAX 4

MIN =4

MAX =4 6

4 3 6 2 2 1 9 5 3 1 5 4 7 5
Alpha beta pruning. Example
MAX 4

MIN =4

MAX =4 6 2

4 3 6 2 2 1 9 5 3 1 5 4 7 5

Alpha beta pruning. Example


MAX 4

MIN =4 2

MAX =4 6 =2

4 3 6 2 2 1 9 5 3 1 5 4 7 5
Alpha beta pruning. Example
MAX 4

MIN
!!
=4 2

MAX =4 6 =2

4 3 6 2 2 1 9 5 3 1 5 4 7 5

CS 2710 Foundations of AI

Alpha beta pruning. Example


MAX 4

MIN =4 2

MAX =4 6 =2 5

4 3 6 2 2 1 9 5 3 1 5 4 7 5
Alpha beta pruning. Example
MAX 4

MIN =4 2 5

MAX =4 6 =2 =5

4 3 6 2 2 1 9 5 3 1 5 4 7 5

CS 2710 Foundations of AI

Alpha beta pruning. Example


MAX 4

MIN =4 2 5

MAX =4 6 =2 =5
!! 7

4 3 6 2 2 1 9 5 3 1 5 4 7 5
Alpha beta pruning. Example
MAX 5

MIN =4 2 =5

MAX =4 6 =2 =5 7

4 3 6 2 2 1 9 5 3 1 5 4 7 5

CS 2710 Foundations of AI

Alpha beta pruning. Example


MAX =5

MIN =4 2 =5

MAX =4 6 =2 =5 7

4 3 6 2 2 1 9 5 3 1 5 4 7 5

nodes that were never explored !!!


Alpha-Beta pruning

GOAL

GOAL

CS 2710 Foundations of AI

Using minimax value estimates


• Idea:
– Cutoff the search tree before the terminal state is reached
– Use imperfect estimate of the minimax value at the leaves
MAX • Evaluation function
5
MIN 4 2 5
Heuristic
evaluation 4 6 2 9 3 5 7
function
Cutoff level
Design of evaluation functions

•Heuristic estimate of the value for a sub-tree


•Examples of a heuristic functions:
– Material advantage in chess, checkers
• Gives a value to every piece on the board, its position and combines them
– More general feature-based evaluation function
• Typically a linear evaluation function:
f ( s ) = f1 (s ) w1 + f 2 (s ) w2 + K f k ( s ) wk
wi - feature weight
f i ( s ) - a feature of a state s
CS 2710 Foundations of AI

Further extensions to real games


•Restricted set of moves to be considered under the cutoff level
to reduce branching and improve the evaluation function
– E.g., consider only the capture moves in chess

Heuristic estimates

You might also like