SlideShare a Scribd company logo
1 of 22
ARTIFICAL INTELLIGENCE
(R18 III(II Sem))
Department of computer science and
engineering (AI/ML)
Session 14
by
Asst.Prof.M.Gokilavani
VITS
3/18/2023 Department of CSE (AI/ML) 1
TEXTBOOK:
• Artificial Intelligence A modern Approach, Third
Edition, Stuart Russell and Peter Norvig, Pearson
Education.
REFERENCES:
• Artificial Intelligence, 3rd Edn, E. Rich and K.Knight
(TMH).
• Artificial Intelligence, 3rd Edn, Patrick Henny Winston,
Pearson Education.
• Artificial Intelligence, Shivani Goel, Pearson
Education.
• Artificial Intelligence and Expert Systems- Patterson,
Pearson Education.
3/18/2023 Department of CSE (AI/ML) 2
Topics covered in session 14
3/18/2023 Department of CSE (AI/ML) 3
• Adversarial Search: Games, Optimal Decisions in
Games, Alpha–Beta Pruning, Imperfect Real-Time
Decisions.
• Constraint Satisfaction Problems: Defining Constraint
Satisfaction Problems, Constraint Propagation,
Backtracking Search for CSPs, Local Search for CSPs, The
Structure of Problems.
• Propositional Logic: Knowledge-Based Agents, The
Wumpus World, Logic, Propositional Logic, Propositional
Theorem Proving: Inference and proofs, Proof by
resolution, Horn clauses and definite clauses, Forward and
backward chaining, Effective Propositional Model
Checking, Agents Based on Propositional Logic.
Types of algorithms in Adversarial
search
• Adversarial search is a game-playing technique
where the agents are surrounded by a competitive
environment.
• It is also obvious that the solution for the goal
state will be an optimal solution because the
player will try to win the game with the shortest
path and under limited time.
• There are following types of adversarial search:
– Min-max Algorithm
– Alpha-beta Pruning.
3/18/2023 4
Department of CSE (AI/ML)
Mini-Max Algorithm
• In artificial intelligence, minimax is a decision-
making strategy under game theory, which is used to
minimize the losing chances in a game and to
maximize the winning chances.
• This strategy is also known as ‘Min-max,’ ’MM,’ or
‘Saddle point.’
3/18/2023 5
Department of CSE (AI/ML)
Mini-Max Algorithm
• Mini-max algorithm is a recursive or backtracking algorithm
which is used in decision-making and game theory. It provides
an optimal move for the player assuming that opponent is also
playing optimally.
• Mini-Max algorithm uses recursion to search through the
game-tree.
• Example : Chess, Checkers, tic-tac-toe
• In this algorithm two players play the game; one is called
MAX and other is called MIN.
3/18/2023 6
Department of CSE (AI/ML)
Mini-Max Algorithm
• Both the players fight it as the opponent player gets the
minimum benefit while they get the maximum benefit.
• MIN: Decrease the chances of MAX to win the game.
• MAX: Increases his chances of winning the game.
• The minimax algorithm performs a depth-first search
algorithm for the exploration of the complete game tree.
• The minimax algorithm proceeds all the way down to the
terminal node of the tree, then backtrack the tree as the
recursion.
3/18/2023 7
Department of CSE (AI/ML)
Working of Min-Max Algorithm
• MINIMAX algorithm is a backtracking algorithm where it
backtracks to pick the best move out of several choices.
• MINIMAX strategy follows the DFS (Depth-first
search) concept.
• Here, we have two players MIN and MAX, and the game is
played alternatively between them, i.e., when MAX made a
move, then the next turn is of MIN.
• It means the move made by MAX is fixed and, he cannot
change it.
• The same concept is followed in DFS strategy, i.e., we
follow the same path and cannot change in the middle.
• That’s why in MINIMAX algorithm, instead of BFS, we
follow DFS.
3/18/2023 8
Department of CSE (AI/ML)
Working of Min-Max Algorithm
• Keep on generating the game tree/ search tree till a
limit d.
• Compute the move using a heuristic function.
• Propagate the values from the leaf node till the
current position following the minimax strategy.
• Make the best move from the choices.
3/18/2023 9
Department of CSE (AI/ML)
Pseudocode for Minimax Algorithm
3/18/2023 Department of CSE (AI/ML) 10
Step 1
• In the first step, the algorithm generates the
entire game-tree and apply the utility function
to get the utility values for the terminal states.
• In the below tree diagram, let's take A is the
initial state of the tree.
• Suppose maximizer takes first turn which has
worst-case initial value =- infinity, and
minimizer will take next turn which has worst-
case initial value = +infinity.
3/18/2023 Department of CSE (AI/ML) 11
3/18/2023 Department of CSE (AI/ML) 12
Step 2
• Now, first we find the utilities value for the
Maximizer, its initial value is -∞, so we will
compare each value in terminal state with initial
value of Maximizer and determines the higher
nodes values. It will find the maximum among the
all.
• For node D max(-1,- -∞) => max(-1,4)= 4
• For Node E max(2, -∞) => max(2, 6)= 6
• For Node F max(-3, -∞) => max(-3,-5) = -3
• For node G max(0, -∞) = max(0, 7) = 7
3/18/2023 Department of CSE (AI/ML) 13
3/18/2023 Department of CSE (AI/ML) 14
Step 3
• In the next step, it's a turn for minimizer, so it
will compare all nodes value with +∞ and will
find the 3rd layer node values.
• For node B= min(4,6) = 4
• For node C= min (-3, 7) = -3
3/18/2023 Department of CSE (AI/ML) 15
3/18/2023 Department of CSE (AI/ML) 16
Step 4
• Now it's a turn for Maximizer, and it will again
choose the maximum of all nodes value and
find the maximum value for the root node.
• In this game tree, there are only 4 layers, hence
we reach immediately to the root node, but in
real games, there will be more than 4 layers.
• For node A max(4, -3)= 4
3/18/2023 Department of CSE (AI/ML) 17
3/18/2023 Department of CSE (AI/ML) 18
Example 2
3/18/2023 Department of CSE (AI/ML) 19
Solution
3/18/2023 Department of CSE (AI/ML) 20
Limitation of the minimax Algorithm
• The main drawback of the minimax algorithm
is that it gets really slow for complex games
such as Chess, go, etc.
• This type of games has a huge branching
factor, and the player has lots of choices to
decide.
• This limitation of the minimax algorithm can
be improved from alpha-beta pruning.
3/18/2023 Department of CSE (AI/ML) 21
Topics to be covered in next session 15
• Alpha–Beta Pruning
• Imperfect Real-Time Decisions..
3/18/2023 Department of CSE (AI/ML) 22
Thank you!!!

More Related Content

Similar to AI_Session 14 Min Max Algorithm.pptx

Jarrar.lecture notes.aai.2011s.ch6.games
Jarrar.lecture notes.aai.2011s.ch6.gamesJarrar.lecture notes.aai.2011s.ch6.games
Jarrar.lecture notes.aai.2011s.ch6.games
PalGov
 
Gameplaying in artificial intelligence
Gameplaying in artificial intelligenceGameplaying in artificial intelligence
Gameplaying in artificial intelligence
oceanparkk
 

Similar to AI_Session 14 Min Max Algorithm.pptx (20)

Minmax Algorithm In Artificial Intelligence slides
Minmax Algorithm In Artificial Intelligence slidesMinmax Algorithm In Artificial Intelligence slides
Minmax Algorithm In Artificial Intelligence slides
 
Topic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).pptTopic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).ppt
 
AI3391 Artificial Intelligence Session 18 Monto carlo search tree.pptx
AI3391 Artificial Intelligence Session 18 Monto carlo search tree.pptxAI3391 Artificial Intelligence Session 18 Monto carlo search tree.pptx
AI3391 Artificial Intelligence Session 18 Monto carlo search tree.pptx
 
Jarrar.lecture notes.aai.2011s.ch6.games
Jarrar.lecture notes.aai.2011s.ch6.gamesJarrar.lecture notes.aai.2011s.ch6.games
Jarrar.lecture notes.aai.2011s.ch6.games
 
AI_unit3.pptx
AI_unit3.pptxAI_unit3.pptx
AI_unit3.pptx
 
Minimax
MinimaxMinimax
Minimax
 
Libratus
LibratusLibratus
Libratus
 
Chess engine presentation
Chess engine presentationChess engine presentation
Chess engine presentation
 
Gameplaying in artificial intelligence
Gameplaying in artificial intelligenceGameplaying in artificial intelligence
Gameplaying in artificial intelligence
 
Game Playing in Artificial Intelligence
Game Playing in Artificial IntelligenceGame Playing in Artificial Intelligence
Game Playing in Artificial Intelligence
 
Unit_I_Introduction(Part_III).ppt
Unit_I_Introduction(Part_III).pptUnit_I_Introduction(Part_III).ppt
Unit_I_Introduction(Part_III).ppt
 
Minimax.pdf
Minimax.pdfMinimax.pdf
Minimax.pdf
 
Capgemini 1
Capgemini 1Capgemini 1
Capgemini 1
 
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
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
 
report
reportreport
report
 
Min-Max algorithm
Min-Max algorithmMin-Max algorithm
Min-Max algorithm
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
 
AI subject - Game Theory and cps ppt pptx
AI subject  - Game Theory and cps ppt pptxAI subject  - Game Theory and cps ppt pptx
AI subject - Game Theory and cps ppt pptx
 
Min Max Artificial Intelligence algorithm
Min Max Artificial Intelligence algorithmMin Max Artificial Intelligence algorithm
Min Max Artificial Intelligence algorithm
 

More from Asst.prof M.Gokilavani

More from Asst.prof M.Gokilavani (20)

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
IT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdfIT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdf
 
IT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notesIT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notes
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
 
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfGE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
 
GE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdfGE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdf
 
GE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdfGE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdf
 
GE3151_PSPP_All unit _Notes
GE3151_PSPP_All unit _NotesGE3151_PSPP_All unit _Notes
GE3151_PSPP_All unit _Notes
 
GE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_NotesGE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_Notes
 
GE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_NotesGE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_Notes
 
GE3151_PSPP_UNIT_3_Notes
GE3151_PSPP_UNIT_3_NotesGE3151_PSPP_UNIT_3_Notes
GE3151_PSPP_UNIT_3_Notes
 
GE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_NotesGE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_Notes
 
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
 
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdfAI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
 
AI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptxAI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptx
 
AI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptxAI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptx
 
AI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptxAI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptx
 

Recently uploaded

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 

Recently uploaded (20)

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 

AI_Session 14 Min Max Algorithm.pptx

  • 1. ARTIFICAL INTELLIGENCE (R18 III(II Sem)) Department of computer science and engineering (AI/ML) Session 14 by Asst.Prof.M.Gokilavani VITS 3/18/2023 Department of CSE (AI/ML) 1
  • 2. TEXTBOOK: • Artificial Intelligence A modern Approach, Third Edition, Stuart Russell and Peter Norvig, Pearson Education. REFERENCES: • Artificial Intelligence, 3rd Edn, E. Rich and K.Knight (TMH). • Artificial Intelligence, 3rd Edn, Patrick Henny Winston, Pearson Education. • Artificial Intelligence, Shivani Goel, Pearson Education. • Artificial Intelligence and Expert Systems- Patterson, Pearson Education. 3/18/2023 Department of CSE (AI/ML) 2
  • 3. Topics covered in session 14 3/18/2023 Department of CSE (AI/ML) 3 • Adversarial Search: Games, Optimal Decisions in Games, Alpha–Beta Pruning, Imperfect Real-Time Decisions. • Constraint Satisfaction Problems: Defining Constraint Satisfaction Problems, Constraint Propagation, Backtracking Search for CSPs, Local Search for CSPs, The Structure of Problems. • Propositional Logic: Knowledge-Based Agents, The Wumpus World, Logic, Propositional Logic, Propositional Theorem Proving: Inference and proofs, Proof by resolution, Horn clauses and definite clauses, Forward and backward chaining, Effective Propositional Model Checking, Agents Based on Propositional Logic.
  • 4. Types of algorithms in Adversarial search • Adversarial search is a game-playing technique where the agents are surrounded by a competitive environment. • It is also obvious that the solution for the goal state will be an optimal solution because the player will try to win the game with the shortest path and under limited time. • There are following types of adversarial search: – Min-max Algorithm – Alpha-beta Pruning. 3/18/2023 4 Department of CSE (AI/ML)
  • 5. Mini-Max Algorithm • In artificial intelligence, minimax is a decision- making strategy under game theory, which is used to minimize the losing chances in a game and to maximize the winning chances. • This strategy is also known as ‘Min-max,’ ’MM,’ or ‘Saddle point.’ 3/18/2023 5 Department of CSE (AI/ML)
  • 6. Mini-Max Algorithm • Mini-max algorithm is a recursive or backtracking algorithm which is used in decision-making and game theory. It provides an optimal move for the player assuming that opponent is also playing optimally. • Mini-Max algorithm uses recursion to search through the game-tree. • Example : Chess, Checkers, tic-tac-toe • In this algorithm two players play the game; one is called MAX and other is called MIN. 3/18/2023 6 Department of CSE (AI/ML)
  • 7. Mini-Max Algorithm • Both the players fight it as the opponent player gets the minimum benefit while they get the maximum benefit. • MIN: Decrease the chances of MAX to win the game. • MAX: Increases his chances of winning the game. • The minimax algorithm performs a depth-first search algorithm for the exploration of the complete game tree. • The minimax algorithm proceeds all the way down to the terminal node of the tree, then backtrack the tree as the recursion. 3/18/2023 7 Department of CSE (AI/ML)
  • 8. Working of Min-Max Algorithm • MINIMAX algorithm is a backtracking algorithm where it backtracks to pick the best move out of several choices. • MINIMAX strategy follows the DFS (Depth-first search) concept. • Here, we have two players MIN and MAX, and the game is played alternatively between them, i.e., when MAX made a move, then the next turn is of MIN. • It means the move made by MAX is fixed and, he cannot change it. • The same concept is followed in DFS strategy, i.e., we follow the same path and cannot change in the middle. • That’s why in MINIMAX algorithm, instead of BFS, we follow DFS. 3/18/2023 8 Department of CSE (AI/ML)
  • 9. Working of Min-Max Algorithm • Keep on generating the game tree/ search tree till a limit d. • Compute the move using a heuristic function. • Propagate the values from the leaf node till the current position following the minimax strategy. • Make the best move from the choices. 3/18/2023 9 Department of CSE (AI/ML)
  • 10. Pseudocode for Minimax Algorithm 3/18/2023 Department of CSE (AI/ML) 10
  • 11. Step 1 • In the first step, the algorithm generates the entire game-tree and apply the utility function to get the utility values for the terminal states. • In the below tree diagram, let's take A is the initial state of the tree. • Suppose maximizer takes first turn which has worst-case initial value =- infinity, and minimizer will take next turn which has worst- case initial value = +infinity. 3/18/2023 Department of CSE (AI/ML) 11
  • 12. 3/18/2023 Department of CSE (AI/ML) 12
  • 13. Step 2 • Now, first we find the utilities value for the Maximizer, its initial value is -∞, so we will compare each value in terminal state with initial value of Maximizer and determines the higher nodes values. It will find the maximum among the all. • For node D max(-1,- -∞) => max(-1,4)= 4 • For Node E max(2, -∞) => max(2, 6)= 6 • For Node F max(-3, -∞) => max(-3,-5) = -3 • For node G max(0, -∞) = max(0, 7) = 7 3/18/2023 Department of CSE (AI/ML) 13
  • 14. 3/18/2023 Department of CSE (AI/ML) 14
  • 15. Step 3 • In the next step, it's a turn for minimizer, so it will compare all nodes value with +∞ and will find the 3rd layer node values. • For node B= min(4,6) = 4 • For node C= min (-3, 7) = -3 3/18/2023 Department of CSE (AI/ML) 15
  • 16. 3/18/2023 Department of CSE (AI/ML) 16
  • 17. Step 4 • Now it's a turn for Maximizer, and it will again choose the maximum of all nodes value and find the maximum value for the root node. • In this game tree, there are only 4 layers, hence we reach immediately to the root node, but in real games, there will be more than 4 layers. • For node A max(4, -3)= 4 3/18/2023 Department of CSE (AI/ML) 17
  • 18. 3/18/2023 Department of CSE (AI/ML) 18
  • 19. Example 2 3/18/2023 Department of CSE (AI/ML) 19
  • 21. Limitation of the minimax Algorithm • The main drawback of the minimax algorithm is that it gets really slow for complex games such as Chess, go, etc. • This type of games has a huge branching factor, and the player has lots of choices to decide. • This limitation of the minimax algorithm can be improved from alpha-beta pruning. 3/18/2023 Department of CSE (AI/ML) 21
  • 22. Topics to be covered in next session 15 • Alpha–Beta Pruning • Imperfect Real-Time Decisions.. 3/18/2023 Department of CSE (AI/ML) 22 Thank you!!!