SlideShare a Scribd company logo
Alpha Beta Pruning
in Artificial Intelligence
Savya Sachi
1
Introduction
2
• Alpha-beta pruning is the way through which we can find the optimal
minimax solution while avoiding searching subtrees of moves which won't
be selected. In the search tree for a two-player game, there are two kinds of
nodes, one node represents your move and another node represents
opponent's move.
• Alpha-beta pruning comes from two parameters.
– They describe bounds on the values that appear anywhere along the
path under consideration:
• α = best value(i.e., highest value) choice found so far along the
path for MAX
• β = best value(i.e., lowest value) choice found so far along the
path for MIN
Alpha Beta Pruning
3
• Alpha-beta pruning gets its name from two bounds that are passed along
during the calculation, which restrict the set of possible solutions based on
the portion of the search tree that has already been seen. Specifically,
• Beta is the minimum upper bound of possiblesolutions
• Alpha is the maximum lower bound of possiblesolutions
• Thus, when any new node is being considered as a possible path to the
solution, it can only work if:
where N is the current estimate of the value of the node
Algorithm: Alpha Beta Search
4
Example
5
Initial Assumption for Alpha an d
Beta
6
• At begining, we see only the current state (i.e. the current position of pieces
on the game board). As for upper and lower bounds, all we know is that it's a
number less than infinity and greater than negative infinity. Thus, here's what
the initial situation looks like:
Example
7
• Since the bounds still contain a valid range, we start the problem by
generating the first child state, and passing along the current set of bounds.
At this point our search looks like this:
Example
8
• We are still not down to depth 4, so once
again we will generate the first child node
and pass along our current alpha and beta
values:
Example
9
And once more time
Example
10
• When we get to the first node at depth 4, we run our evaluation function on
the state, and get the value 3. Thus we have this:
Example
11
• We pass this node back to the min node above. Since this is a min node, we
now know that the minimax value of this node must be less than or equal to
3. In other words, we change beta to 3.
Example
12
• Next we generate the next child at depth 4, run our evaluation function, and
return a value of 17 to the min node above:
Example
13
• Since this is a min node and 17 is greater than 3, this child is ignored. Now
we've seen all of the children of this min node, so we return the beta value
to the max node above. Since it is a max node, we now know that it's value
will be greater than or equal to 3, so we change alpha to 3:
Example
14
• We generate the next child and pass the bounds along
Example
15
• Since this node is not at the target depth, we generate its first child, run the
evaluation function on that node, and return it's value
Example
16
• Since this is a min node, we now know that the value of this node willbe
less than or equal to 2, so we change beta to 2:
Example
17
• Certainly, we don't know the
actual value of the node.
There could be a 1 or 0 or -
100 somewhere in the other
children of this node. But
even if there was such a
value, searching for it won't
help us find the optimal
solution in the search tree.
The 2 alone is enough to
make this subtree fruitless,
so we can prune any other
children and return it.
• That's all there is to beta
Pruning…….
Example
18
• Back at the parent max
node, our alpha value is
already 3, which is more
restrictive than 2, so we
don't change it. At this
point we've seen all the
children of this max
node, so we can set its
value to the final alpha
value:
Example
19
• Now we move on to the parent min node.
With the 3 for the first child value, we
know that the value of the min node must
be less than or equal to 3, thus we set beta
to 3:
Example
20
• Since we still have a valid
range, we go on to explore the
next child. We generate the max
node...
Example
21
• ... it's first child min node ...
Example
22
• ... and finally the max node at the
target depth. All along this path, we
merely pass the alpha and beta bounds
along.
Example
23
• At this point, we've seen all
of the children of the min
node, and we haven't
changed the beta bound.
Since we haven't exceeded
the bound, we should return
the actual min value for the
node. Notice that this is
different than the case
where we pruned, in which
case you returned the beta
value. The reason for this
will become apparent
shortly.
Example
24
• Now we return the value to the parent max node. Based on this value, we
know that this max node will have a value of 15 or greater, so we set alpha
to 15:
Example
25
• Once again the alpha and beta bounds have crossed, so we can prune the
rest of this node's children and return the value that exceeded the bound
(i.e. 15). Notice that if we had returned the beta value of the child min node
(3) instead of the actual value (15), we wouldn't have been able to prune
here.
Example
26
• Now the parent min node has seen all
of it's children, so it can select the
minimum value of it's children (3) and
return.
Example
27
• Finally we've finished with the first child of the root max node. We now
know our solution will be at least 3, so we set the alpha value to 3 and go
on to the second child.
Example
28
• Passing the alpha and beta values along as we go, we generate the second
child of the root node...
Example
29
• ... and its first child ...
Example
30
Example
31
Example
32
• The min node parent uses this value to set it's beta value to 2:
Example
33
• Once again we are able to prune the other children of this node and return
the value that exceeded the bound. Since this value isn't greater than the
alpha bound of the parent max node, we don't change the bounds.
Example
34
• From here, we generate the next child of the max node:
Example
35
• Then we generate its child, which is at the target depth. We call the
evaluation function and get its value of 3.
Example
36
• The parent min node uses this value to set its upper bound (beta) to3:
Example
37
• In other words, at this point alpha = beta. Should we prune here? We haven't
actuallyexceeded the bounds, but since alpha and beta are equal, we know
we can't really do better in this subtree.
• The answer is yes, we should prune. The reason is that even though we
can't do better, we might be able to do worse. Remember, the task of
minimax is to find the best move to make at the state represented by the top
level max node. As it happens we've finished with this node's children
anyway, so we return the min value 3.
Example
38
Example
39
• The max node above has now seen all of its children, so it returns the
maximum value of those it has seen, which is 3.
Example
40
• This value is returned to its parent min node, which then has a new upper
bound of 3, so it sets beta to 3:
41
• Once again, we are at a point where alpha and beta are tied, so we prune.
• If you were to run minimax on the list version presented at the start of the
example, your minimax would return a value of 3 and 6 terminal nodes
would have been examined.
Conclusion
42
• Pruning will not affect final results.
• Whole subtrees can be pruned, not just leaves.
• Better move ordering improves effectiveness
of pruning.
• With perfect ordering, time complexity is O(bm/2).
– Effective branching factor of sqrt(b)
– Consequence: alpha-beta pruning can look twice as deep
as minimax in the same amount of time.

More Related Content

What's hot

Minmax Algorithm In Artificial Intelligence slides
Minmax Algorithm In Artificial Intelligence slidesMinmax Algorithm In Artificial Intelligence slides
Minmax Algorithm In Artificial Intelligence slides
SamiaAziz4
 
Min-Max algorithm
Min-Max algorithmMin-Max algorithm
Min-Max algorithm
Dr. C.V. Suresh Babu
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
Shiwani Gupta
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
Nilu Desai
 
Adversarial search with Game Playing
Adversarial search with Game PlayingAdversarial search with Game Playing
Adversarial search with Game Playing
Aman Patel
 
Local search algorithm
Local search algorithmLocal search algorithm
Local search algorithm
Megha Sharma
 
Lecture 16 memory bounded search
Lecture 16 memory bounded searchLecture 16 memory bounded search
Lecture 16 memory bounded search
Hema Kashyap
 
5 csp
5 csp5 csp
5 csp
Mhd Sb
 
AI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction ProblemAI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction Problem
Mohammad Imam Hossain
 
Tree pruning
 Tree pruning Tree pruning
Tree pruning
Shivangi Gupta
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
vikas dhakane
 
Unit3:Informed and Uninformed search
Unit3:Informed and Uninformed searchUnit3:Informed and Uninformed search
Unit3:Informed and Uninformed search
Tekendra Nath Yogi
 
sum of subset problem using Backtracking
sum of subset problem using Backtrackingsum of subset problem using Backtracking
sum of subset problem using Backtracking
Abhishek Singh
 
AVL Tree
AVL TreeAVL Tree
An introduction to reinforcement learning
An introduction to reinforcement learningAn introduction to reinforcement learning
An introduction to reinforcement learning
Subrat Panda, PhD
 
Heaps
HeapsHeaps
Fuzzy Set Theory
Fuzzy Set TheoryFuzzy Set Theory
Fuzzy Set Theory
AMIT KUMAR
 
Hill climbing
Hill climbingHill climbing
Hill climbing
Mohammad Faizan
 
Forward Backward Chaining
Forward Backward ChainingForward Backward Chaining
Forward Backward Chaining
QAU ISLAMABAD,PAKISTAN
 
0 1 knapsack using branch and bound
0 1 knapsack using branch and bound0 1 knapsack using branch and bound
0 1 knapsack using branch and bound
Abhishek Singh
 

What's hot (20)

Minmax Algorithm In Artificial Intelligence slides
Minmax Algorithm In Artificial Intelligence slidesMinmax Algorithm In Artificial Intelligence slides
Minmax Algorithm In Artificial Intelligence slides
 
Min-Max algorithm
Min-Max algorithmMin-Max algorithm
Min-Max algorithm
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
 
Adversarial search with Game Playing
Adversarial search with Game PlayingAdversarial search with Game Playing
Adversarial search with Game Playing
 
Local search algorithm
Local search algorithmLocal search algorithm
Local search algorithm
 
Lecture 16 memory bounded search
Lecture 16 memory bounded searchLecture 16 memory bounded search
Lecture 16 memory bounded search
 
5 csp
5 csp5 csp
5 csp
 
AI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction ProblemAI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction Problem
 
Tree pruning
 Tree pruning Tree pruning
Tree pruning
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
 
Unit3:Informed and Uninformed search
Unit3:Informed and Uninformed searchUnit3:Informed and Uninformed search
Unit3:Informed and Uninformed search
 
sum of subset problem using Backtracking
sum of subset problem using Backtrackingsum of subset problem using Backtracking
sum of subset problem using Backtracking
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
 
An introduction to reinforcement learning
An introduction to reinforcement learningAn introduction to reinforcement learning
An introduction to reinforcement learning
 
Heaps
HeapsHeaps
Heaps
 
Fuzzy Set Theory
Fuzzy Set TheoryFuzzy Set Theory
Fuzzy Set Theory
 
Hill climbing
Hill climbingHill climbing
Hill climbing
 
Forward Backward Chaining
Forward Backward ChainingForward Backward Chaining
Forward Backward Chaining
 
0 1 knapsack using branch and bound
0 1 knapsack using branch and bound0 1 knapsack using branch and bound
0 1 knapsack using branch and bound
 

Similar to Alpha beta pruning in ai

Alpha-Beta Search
Alpha-Beta SearchAlpha-Beta Search
Alpha-Beta Search
Harshit Thakur
 
AI algorithms with alpha beta stratagy 1
AI algorithms with alpha beta stratagy 1AI algorithms with alpha beta stratagy 1
AI algorithms with alpha beta stratagy 1
tpvvsreenivasarao
 
AI3391 Artificial intelligence Session 16 Alpha–Beta Pruning.pptx
AI3391 Artificial intelligence Session 16 Alpha–Beta Pruning.pptxAI3391 Artificial intelligence Session 16 Alpha–Beta Pruning.pptx
AI3391 Artificial intelligence Session 16 Alpha–Beta Pruning.pptx
Asst.prof M.Gokilavani
 
Algorithm in computer science
Algorithm in computer scienceAlgorithm in computer science
Algorithm in computer science
Riazul Islam
 
fdocuments.in_branch-and-bound-design-and-analysis-of-alogorithm.ppt
fdocuments.in_branch-and-bound-design-and-analysis-of-alogorithm.pptfdocuments.in_branch-and-bound-design-and-analysis-of-alogorithm.ppt
fdocuments.in_branch-and-bound-design-and-analysis-of-alogorithm.ppt
KartikGupta711
 
CPP Programming Homework Help
CPP Programming Homework HelpCPP Programming Homework Help
CPP Programming Homework Help
C++ Homework Help
 
AI_Session 15 Alpha–Beta Pruning.pptx
AI_Session 15 Alpha–Beta Pruning.pptxAI_Session 15 Alpha–Beta Pruning.pptx
AI_Session 15 Alpha–Beta Pruning.pptx
Asst.prof M.Gokilavani
 
hanoosh-tictactoeqqqqqqqaaaaaaaaaaaa.ppt
hanoosh-tictactoeqqqqqqqaaaaaaaaaaaa.ppthanoosh-tictactoeqqqqqqqaaaaaaaaaaaa.ppt
hanoosh-tictactoeqqqqqqqaaaaaaaaaaaa.ppt
ssuser148ae0
 
Lecture 22 adversarial search
Lecture 22 adversarial searchLecture 22 adversarial search
Lecture 22 adversarial search
Hema Kashyap
 
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
22bcs058
 
DS & Algo 6 - Dynamic Programming
DS & Algo 6 - Dynamic ProgrammingDS & Algo 6 - Dynamic Programming
DS & Algo 6 - Dynamic Programming
Mohammad Imam Hossain
 
Insider mathematical
Insider   mathematicalInsider   mathematical
Insider mathematical
Aditi Saxena
 
Mathematical Statistics Assignment Help
Mathematical Statistics Assignment HelpMathematical Statistics Assignment Help
Mathematical Statistics Assignment Help
Excel Homework Help
 
n7-LP-simplex.ppt
n7-LP-simplex.pptn7-LP-simplex.ppt
n7-LP-simplex.ppt
Mayurkumarpatil1
 
L06
L06L06
Game playing (tic tac-toe), andor graph
Game playing (tic tac-toe), andor graphGame playing (tic tac-toe), andor graph
Game playing (tic tac-toe), andor graph
Syed Zaid Irshad
 
Sienna 13 limitations
Sienna 13 limitationsSienna 13 limitations
Sienna 13 limitations
chidabdu
 
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
Roman Elizarov
 
3.4 Polynomial Functions and Their Graphs
3.4 Polynomial Functions and Their Graphs3.4 Polynomial Functions and Their Graphs
3.4 Polynomial Functions and Their Graphs
smiller5
 
Chapter3 bp
Chapter3   bpChapter3   bp
Chapter3 bp
kumar tm
 

Similar to Alpha beta pruning in ai (20)

Alpha-Beta Search
Alpha-Beta SearchAlpha-Beta Search
Alpha-Beta Search
 
AI algorithms with alpha beta stratagy 1
AI algorithms with alpha beta stratagy 1AI algorithms with alpha beta stratagy 1
AI algorithms with alpha beta stratagy 1
 
AI3391 Artificial intelligence Session 16 Alpha–Beta Pruning.pptx
AI3391 Artificial intelligence Session 16 Alpha–Beta Pruning.pptxAI3391 Artificial intelligence Session 16 Alpha–Beta Pruning.pptx
AI3391 Artificial intelligence Session 16 Alpha–Beta Pruning.pptx
 
Algorithm in computer science
Algorithm in computer scienceAlgorithm in computer science
Algorithm in computer science
 
fdocuments.in_branch-and-bound-design-and-analysis-of-alogorithm.ppt
fdocuments.in_branch-and-bound-design-and-analysis-of-alogorithm.pptfdocuments.in_branch-and-bound-design-and-analysis-of-alogorithm.ppt
fdocuments.in_branch-and-bound-design-and-analysis-of-alogorithm.ppt
 
CPP Programming Homework Help
CPP Programming Homework HelpCPP Programming Homework Help
CPP Programming Homework Help
 
AI_Session 15 Alpha–Beta Pruning.pptx
AI_Session 15 Alpha–Beta Pruning.pptxAI_Session 15 Alpha–Beta Pruning.pptx
AI_Session 15 Alpha–Beta Pruning.pptx
 
hanoosh-tictactoeqqqqqqqaaaaaaaaaaaa.ppt
hanoosh-tictactoeqqqqqqqaaaaaaaaaaaa.ppthanoosh-tictactoeqqqqqqqaaaaaaaaaaaa.ppt
hanoosh-tictactoeqqqqqqqaaaaaaaaaaaa.ppt
 
Lecture 22 adversarial search
Lecture 22 adversarial searchLecture 22 adversarial search
Lecture 22 adversarial search
 
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
 
DS & Algo 6 - Dynamic Programming
DS & Algo 6 - Dynamic ProgrammingDS & Algo 6 - Dynamic Programming
DS & Algo 6 - Dynamic Programming
 
Insider mathematical
Insider   mathematicalInsider   mathematical
Insider mathematical
 
Mathematical Statistics Assignment Help
Mathematical Statistics Assignment HelpMathematical Statistics Assignment Help
Mathematical Statistics Assignment Help
 
n7-LP-simplex.ppt
n7-LP-simplex.pptn7-LP-simplex.ppt
n7-LP-simplex.ppt
 
L06
L06L06
L06
 
Game playing (tic tac-toe), andor graph
Game playing (tic tac-toe), andor graphGame playing (tic tac-toe), andor graph
Game playing (tic tac-toe), andor graph
 
Sienna 13 limitations
Sienna 13 limitationsSienna 13 limitations
Sienna 13 limitations
 
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
 
3.4 Polynomial Functions and Their Graphs
3.4 Polynomial Functions and Their Graphs3.4 Polynomial Functions and Their Graphs
3.4 Polynomial Functions and Their Graphs
 
Chapter3 bp
Chapter3   bpChapter3   bp
Chapter3 bp
 

More from Savyasachi14

Cryptanalysis by savyasachi
Cryptanalysis by savyasachiCryptanalysis by savyasachi
Cryptanalysis by savyasachi
Savyasachi14
 
Goals of security
Goals of securityGoals of security
Goals of security
Savyasachi14
 
Software design
Software designSoftware design
Software design
Savyasachi14
 
Encryption
EncryptionEncryption
Encryption
Savyasachi14
 
System requirements specification (srs)
System requirements specification (srs)System requirements specification (srs)
System requirements specification (srs)
Savyasachi14
 
Object modeling techniques by savyasachi
Object modeling techniques by savyasachiObject modeling techniques by savyasachi
Object modeling techniques by savyasachi
Savyasachi14
 
Ids
IdsIds
Software testing ppt
Software testing pptSoftware testing ppt
Software testing ppt
Savyasachi14
 

More from Savyasachi14 (8)

Cryptanalysis by savyasachi
Cryptanalysis by savyasachiCryptanalysis by savyasachi
Cryptanalysis by savyasachi
 
Goals of security
Goals of securityGoals of security
Goals of security
 
Software design
Software designSoftware design
Software design
 
Encryption
EncryptionEncryption
Encryption
 
System requirements specification (srs)
System requirements specification (srs)System requirements specification (srs)
System requirements specification (srs)
 
Object modeling techniques by savyasachi
Object modeling techniques by savyasachiObject modeling techniques by savyasachi
Object modeling techniques by savyasachi
 
Ids
IdsIds
Ids
 
Software testing ppt
Software testing pptSoftware testing ppt
Software testing ppt
 

Recently uploaded

DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENTNATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
Addu25809
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
Hematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood CountHematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood Count
shahdabdulbaset
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
LAXMAREDDY22
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
zubairahmad848137
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
amsjournal
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 

Recently uploaded (20)

DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENTNATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
Hematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood CountHematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood Count
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 

Alpha beta pruning in ai

  • 1. Alpha Beta Pruning in Artificial Intelligence Savya Sachi 1
  • 2. Introduction 2 • Alpha-beta pruning is the way through which we can find the optimal minimax solution while avoiding searching subtrees of moves which won't be selected. In the search tree for a two-player game, there are two kinds of nodes, one node represents your move and another node represents opponent's move. • Alpha-beta pruning comes from two parameters. – They describe bounds on the values that appear anywhere along the path under consideration: • α = best value(i.e., highest value) choice found so far along the path for MAX • β = best value(i.e., lowest value) choice found so far along the path for MIN
  • 3. Alpha Beta Pruning 3 • Alpha-beta pruning gets its name from two bounds that are passed along during the calculation, which restrict the set of possible solutions based on the portion of the search tree that has already been seen. Specifically, • Beta is the minimum upper bound of possiblesolutions • Alpha is the maximum lower bound of possiblesolutions • Thus, when any new node is being considered as a possible path to the solution, it can only work if: where N is the current estimate of the value of the node
  • 6. Initial Assumption for Alpha an d Beta 6 • At begining, we see only the current state (i.e. the current position of pieces on the game board). As for upper and lower bounds, all we know is that it's a number less than infinity and greater than negative infinity. Thus, here's what the initial situation looks like:
  • 7. Example 7 • Since the bounds still contain a valid range, we start the problem by generating the first child state, and passing along the current set of bounds. At this point our search looks like this:
  • 8. Example 8 • We are still not down to depth 4, so once again we will generate the first child node and pass along our current alpha and beta values:
  • 10. Example 10 • When we get to the first node at depth 4, we run our evaluation function on the state, and get the value 3. Thus we have this:
  • 11. Example 11 • We pass this node back to the min node above. Since this is a min node, we now know that the minimax value of this node must be less than or equal to 3. In other words, we change beta to 3.
  • 12. Example 12 • Next we generate the next child at depth 4, run our evaluation function, and return a value of 17 to the min node above:
  • 13. Example 13 • Since this is a min node and 17 is greater than 3, this child is ignored. Now we've seen all of the children of this min node, so we return the beta value to the max node above. Since it is a max node, we now know that it's value will be greater than or equal to 3, so we change alpha to 3:
  • 14. Example 14 • We generate the next child and pass the bounds along
  • 15. Example 15 • Since this node is not at the target depth, we generate its first child, run the evaluation function on that node, and return it's value
  • 16. Example 16 • Since this is a min node, we now know that the value of this node willbe less than or equal to 2, so we change beta to 2:
  • 17. Example 17 • Certainly, we don't know the actual value of the node. There could be a 1 or 0 or - 100 somewhere in the other children of this node. But even if there was such a value, searching for it won't help us find the optimal solution in the search tree. The 2 alone is enough to make this subtree fruitless, so we can prune any other children and return it. • That's all there is to beta Pruning…….
  • 18. Example 18 • Back at the parent max node, our alpha value is already 3, which is more restrictive than 2, so we don't change it. At this point we've seen all the children of this max node, so we can set its value to the final alpha value:
  • 19. Example 19 • Now we move on to the parent min node. With the 3 for the first child value, we know that the value of the min node must be less than or equal to 3, thus we set beta to 3:
  • 20. Example 20 • Since we still have a valid range, we go on to explore the next child. We generate the max node...
  • 21. Example 21 • ... it's first child min node ...
  • 22. Example 22 • ... and finally the max node at the target depth. All along this path, we merely pass the alpha and beta bounds along.
  • 23. Example 23 • At this point, we've seen all of the children of the min node, and we haven't changed the beta bound. Since we haven't exceeded the bound, we should return the actual min value for the node. Notice that this is different than the case where we pruned, in which case you returned the beta value. The reason for this will become apparent shortly.
  • 24. Example 24 • Now we return the value to the parent max node. Based on this value, we know that this max node will have a value of 15 or greater, so we set alpha to 15:
  • 25. Example 25 • Once again the alpha and beta bounds have crossed, so we can prune the rest of this node's children and return the value that exceeded the bound (i.e. 15). Notice that if we had returned the beta value of the child min node (3) instead of the actual value (15), we wouldn't have been able to prune here.
  • 26. Example 26 • Now the parent min node has seen all of it's children, so it can select the minimum value of it's children (3) and return.
  • 27. Example 27 • Finally we've finished with the first child of the root max node. We now know our solution will be at least 3, so we set the alpha value to 3 and go on to the second child.
  • 28. Example 28 • Passing the alpha and beta values along as we go, we generate the second child of the root node...
  • 29. Example 29 • ... and its first child ...
  • 32. Example 32 • The min node parent uses this value to set it's beta value to 2:
  • 33. Example 33 • Once again we are able to prune the other children of this node and return the value that exceeded the bound. Since this value isn't greater than the alpha bound of the parent max node, we don't change the bounds.
  • 34. Example 34 • From here, we generate the next child of the max node:
  • 35. Example 35 • Then we generate its child, which is at the target depth. We call the evaluation function and get its value of 3.
  • 36. Example 36 • The parent min node uses this value to set its upper bound (beta) to3:
  • 37. Example 37 • In other words, at this point alpha = beta. Should we prune here? We haven't actuallyexceeded the bounds, but since alpha and beta are equal, we know we can't really do better in this subtree. • The answer is yes, we should prune. The reason is that even though we can't do better, we might be able to do worse. Remember, the task of minimax is to find the best move to make at the state represented by the top level max node. As it happens we've finished with this node's children anyway, so we return the min value 3.
  • 39. Example 39 • The max node above has now seen all of its children, so it returns the maximum value of those it has seen, which is 3.
  • 40. Example 40 • This value is returned to its parent min node, which then has a new upper bound of 3, so it sets beta to 3:
  • 41. 41 • Once again, we are at a point where alpha and beta are tied, so we prune. • If you were to run minimax on the list version presented at the start of the example, your minimax would return a value of 3 and 6 terminal nodes would have been examined.
  • 42. Conclusion 42 • Pruning will not affect final results. • Whole subtrees can be pruned, not just leaves. • Better move ordering improves effectiveness of pruning. • With perfect ordering, time complexity is O(bm/2). – Effective branching factor of sqrt(b) – Consequence: alpha-beta pruning can look twice as deep as minimax in the same amount of time.