0% found this document useful (0 votes)
30 views

Alpha-Beta Pruning Algorithm

artificial intelligence

Uploaded by

janabadareen34
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)
30 views

Alpha-Beta Pruning Algorithm

artificial intelligence

Uploaded by

janabadareen34
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/ 14

Alpha-Beta Pruning

Algorithm
GAMES - ADVERSARIAL SEARCH
Pruning the Minimax Tree
 Since we have limited time available in the games, we want to avoid unnecessary computation
in the minimax tree.
 Alpha-beta pruning is a modified version of the min-max algorithm. It is an optimization
technique for the min-max algorithm.
 Pruning: ways of determining that certain branches will not be useful.
 The two values can be defined as:
 α = the value of the best (highest-value) choice we have found so far at any choice point
along the path for MAX. The initial value of alpha is -∞.
 β = the value of the best (lowest-value) choice we have found so far at any choice point
along the path for MIN. The initial value of beta is +∞
Alpha-Beta Pruning Algorithm
 Key points about alpha-beta pruning algorithm:

• 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 and beta values to the child nodes.
 Condition for Alpha-beta pruning:
 The main condition which required for alpha-beta pruning is:

α >=β
Alpha-Beta Example
[α =-∞, β=+∞] Max

[α =-∞, β=+∞]
Min

 initially [-∞, +∞]


 these local values reflect the values of the sub-trees in that node;
the global values α and β are the best overall choices so far for Max or Min
Alpha-Beta Example
[α =-∞, β=+∞]
Max

[α =-∞,
[α =-∞, β=+∞]
β=7] Min

 Min obtains the first value from a successor node


Alpha-Beta Example
[α =-∞, β=+∞]
Max

[α =-∞, β=7]
β=6] Min

7 6

 Min obtains the second value from a successor node


Alpha-Beta
[α =5,
Example
[α =-∞, β=+∞]
β=+∞]
Max

[α =-∞, β=6]
[5] β=5] Min

7 6 5

 Min obtains the third value from a successor node

 this is the last value from this sub-tree, and the exact value is known

 Max now has a value for its first successor node, but hopes that something better might
still come
Alpha-Beta Example
[α =5, β=+∞]
Max
[5] [α =5,
[α =5, β=+∞] Min
β=3]
7 6 5 3

 Min continues with the next sub-tree


 Now, Min player gets a better value
Alpha-Beta Example
[α =5, β=+∞] Max

[5] [α =5,
[3]β=3] Min

7 6 5 3

 Max has a better choice from previous move, Remember:


however, and will not consider a move in the sub-
tree currently explored by Min. So, Max won’t The main condition which
consider a move to this sub-tree, and abandons it. required for alpha-beta
pruning is:
 this is a case of pruning, indicated by α >=β
Alpha-Beta Example
[α =5, β=+∞]
Max

[5] [3] [α =5,


[α =5, β=+∞] Min
β=6]
7 6 5 3 6

 Min explores the next sub-tree


Alpha-Beta Example
[α =5, β=+∞]
Max

[5] [3] [α =5,


[α =5, β=6] Min
β=5]
7 6 5 3 6 5

◦ Min is lucky, and finds a value that is the same as the current worst value at
this level
Alpha-Beta Example
[α =5,[5]β=+∞]
Max

[5] [3] [α =5,


[5]β=5] Min

7 6 5 3 6 5

 The last branch will be pruned, indicated by Remember:

The main condition which


required for alpha-beta
pruning is:
α >=β
α-β Pruning
 The Alpha-beta pruning to a standard min-max algorithm returns the same move as the
standard algorithm does, but it removes all the nodes which are not really affecting the final
decision. Hence, by pruning these nodes, it makes the algorithm fast.
 Good ordering of moves can make this pruning much more efficient
Evaluating best branch first yields better likelihood of pruning later branches
Apply Alpha-beta pruning
algorithm on the next
game tree. Which
branches will be pruned
by Alpha-beta pruning
algorithm?

14

You might also like