SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Adversarial search
Adversarial search is search when there is an
"enemy" or "opponent" changing the state of
the problem every step in a direction you do not
want.
Adversarial search is a search, where we examine
the problem which arises when we try to plan
ahead of the world and other agents are planning
against us.
• A single agent that aims to find the solution
which often expressed in the form of a sequence
of actions.
• There might be some situations where more than
one agent is searching for the solution in the
same search space, and this situation usually
occurs in game playing.
• The environment with more than one agent is termed
as multi-agent environment, in which each agent is an
opponent of other agent and playing against each
other. Each agent needs to consider the action of other
agent and effect of that action on their performance.
• Searches in which two or more players with
conflicting goals are trying to explore the same search
space for the solution, are called adversarial searches,
often known as Games.
• Games are modeled as a Search problem and heuristic
evaluation function, and these are the two main
factors which help to model and solve games in AI.
Types of Games in AI
• Perfect information: A game with the perfect
information is that in which agents can look
into the complete board. Examples are Chess,
Checkers, Go, etc.
• Imperfect information: In a game agents do
not have all information about the game and
not aware with what's going on, such as tic-
tac-toe, Battleship, blind, Bridge, etc.
• Deterministic games: games which follow a strict
pattern and set of rules for the games, and there
is no randomness associated with them.
Examples are chess, Checkers, Go, tic-tac-toe, etc.
• Non-deterministic games: games which have
various unpredictable events and has a factor of
chance or luck. Ex. dice or cards.
• These are random, and each action response is
not fixed. Such games are also called as stochastic
games. Example: Backgammon, Monopoly, Poker,
etc.
Zero-Sum Game
• Zero-sum games are adversarial search which involves
pure competition.
• In Zero-sum game each agent's gain or loss of utility is
exactly balanced by the losses or gains of utility of
another agent.
• One player of the game try to maximize one single
value, while other player tries to minimize it.
• Each move by one player in the game is called as ply.
• Chess and tic-tac-toe are examples of a Zero-sum
game.
Zero-sum game: Embedded thinking
• The Zero-sum game involved embedded
thinking in which one agent or player is trying
to figure out:
• What to do.
• How to decide the move
• Needs to think about his opponent as well
• The opponent also thinks what to do
There were two reasons that games appeared to
be a good domain in which to explore machine
intelligence:
They provide a structured task in which it is very easy
to measure success or failure.
They did not obviously require large amounts of
knowledge. They were thought to be solvable by
straightforward search from the starting state to a
winning position.
9
10
To improve the effectiveness of a search based
problem solving program two things can be
done:
Improve the generate procedure so that only good
moves(or paths) are generated.
Improve the test procedure so that the best
moves(or paths) will be recognized and explored
first.
11
• The problem of playing chess we use simple legal
move generator , then the test procedure will
have to look at each of them.
• Instead of a legal move generator, we use a
plausible-move generator in which only some
small number of promising moves are generated.
• The test procedure can afford to spend more
time evaluating each of the moves it is given so it
can produce a more reliable result.
12
• We have to incorporate heuristic knowledge into
both the generator and the tester, so that the
performance of the overall system can be
improved.
• In order to choose the best move, the resulting
board positions must be compared to discover
which is most promising.
• This is done by using a static evaluation function,
which uses whatever information it has to
evaluate individual board positions by estimating
how likely they are to lead eventually to a goal.
Formalization of the problem
A game can be defined as a type of search in AI
which can be formalized of the following
elements:
• Initial state: It specifies how the game is set up at
the start.
• Player(s): It specifies which player has moved in
the state space.
• Action(s): It returns the set of legal moves in
state space.
• Result(s, a): It is the transition model, which
specifies the result of moves in the state space.
• Terminal-Test(s): Terminal test is true if the game
is over, else it is false at any case. The state where
the game ends is called terminal states.
• Utility(s, p): A utility function gives the final
numeric value for a game that ends in terminal
states s for player p. It is also called payoff
function. For Chess, the outcomes are a win, loss,
or draw and its payoff values are +1, 0, ½. And for
tic-tac-toe, utility values are +1, -1, and 0.
Game tree
A game tree is a tree where nodes of the tree are the game
states and Edges of the tree are the moves by players. Game
tree involves initial state, actions function, and result
Function.
Example: Tic-Tac-Toe game tree:
• The following figure is showing part of the game-tree for
tic-tac-toe game. Following are some key points of the
game:
• There are two players MAX and MIN.
• Players have an alternate turn and start with MAX.
• MAX maximizes the result of the game tree
• MIN minimizes the result.
Mini-Max Algorithm
• Mini-max algorithm is a recursive or backtracking
algorithm used for decision-making in game theory.
• It provides an optimal move for the player assuming
that opponent is also playing optimally.
• It uses recursion to search through the game-tree.
• Min-Max algorithm – Ex: Chess, Checkers, tic-tac-toe,
go, and various two-players game (turn-based games).
• Algorithm computes the minimax decision for the
current state, two players play the game, one is called
MAX and other is called MIN.
• Both the players fight it as the opponent player gets
the minimum benefit while they get the maximum
benefit.
• Both Players of the game are opponent of each other,
where MAX player will select the maximized value and
MIN player will select the minimized value.
• It performs a depth-first search algorithm for the
exploration of the complete game tree.
• It proceeds all the way down to the terminal node of
the tree, then backtrack the tree as the recursion.
• The goal is to find the best possible move for a player.
• Every board state has a value associated with it.
• If the MAX player has upper hand then, the score
of the board be some positive value.
• If the MIN player has the upper hand then board
state be some negative value.
• The values of the board are calculated by some
heuristics which are unique for every type of
game.
• It is based on the zero-sum game concept where
the total utility score gets divided between the
two players.
Implementation
• There are two players one is called Maximizer and
other is called Minimizer.
• Maximizer will try to get the Maximum possible
score, and Minimizer will try to get the minimum
possible score.
• Apply DFS, in the game-tree, and go all the way
through the leaves to reach the terminal nodes.
• At the terminal node, the terminal values are
given so we will compare those value and
backtrack the tree until the initial state occurs.
• Step-1: The algorithm generates the entire
game-tree and apply the utility function to get
the utility values for the terminal states.
• Ex: 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.
Step 2: Now, first we find the utilities value for
the Maximizer, its initial value is -∞
Step 3: In the next step, it's a turn for minimizer,
so it will compare all nodes value with +∞
Step 3: 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.
Exercise
Answer
Module_3_1.pptx
Module_3_1.pptx

Weitere ähnliche Inhalte

Ähnlich wie Module_3_1.pptx

OR PPT 280322 maximin final - nikhil tiwari.pptx
OR PPT 280322 maximin final - nikhil tiwari.pptxOR PPT 280322 maximin final - nikhil tiwari.pptx
OR PPT 280322 maximin final - nikhil tiwari.pptx
VivekSaurabh7
 

Ähnlich wie Module_3_1.pptx (20)

AI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptxAI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
 
Min-Max algorithm
Min-Max algorithmMin-Max algorithm
Min-Max algorithm
 
Game theory.ppt for Micro Economics content
Game theory.ppt for Micro Economics contentGame theory.ppt for Micro Economics content
Game theory.ppt for Micro Economics content
 
MINI-MAX ALGORITHM.pptx
MINI-MAX ALGORITHM.pptxMINI-MAX ALGORITHM.pptx
MINI-MAX ALGORITHM.pptx
 
cai
caicai
cai
 
9SearchAdversarial (1).pptx
9SearchAdversarial (1).pptx9SearchAdversarial (1).pptx
9SearchAdversarial (1).pptx
 
games, infosec, privacy, adversaries .ppt
games, infosec, privacy, adversaries .pptgames, infosec, privacy, adversaries .ppt
games, infosec, privacy, adversaries .ppt
 
Game playing.ppt
Game playing.pptGame playing.ppt
Game playing.ppt
 
It is an artificial document, please. regarding Ai topics
It is an artificial document, please. regarding Ai topicsIt is an artificial document, please. regarding Ai topics
It is an artificial document, please. regarding Ai topics
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
 
Minimax
MinimaxMinimax
Minimax
 
Two player games
Two player gamesTwo player games
Two player games
 
OR PPT 280322 maximin final - nikhil tiwari.pptx
OR PPT 280322 maximin final - nikhil tiwari.pptxOR PPT 280322 maximin final - nikhil tiwari.pptx
OR PPT 280322 maximin final - nikhil tiwari.pptx
 
Adversarial search with Game Playing
Adversarial search with Game PlayingAdversarial search with Game Playing
Adversarial search with Game Playing
 
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
 
Minimax
MinimaxMinimax
Minimax
 
Game Theory
Game Theory Game Theory
Game Theory
 
Lect04 slides
Lect04 slidesLect04 slides
Lect04 slides
 
Finalver
FinalverFinalver
Finalver
 
OthelloFinal.pptx
OthelloFinal.pptxOthelloFinal.pptx
OthelloFinal.pptx
 

Mehr von DrKalaavathiBuvanesh (6)

Text Book-2--linear-algebra.pdf
Text Book-2--linear-algebra.pdfText Book-2--linear-algebra.pdf
Text Book-2--linear-algebra.pdf
 
SAMPLE FOR MICRO PROGRAMMING CO_-_7th_UNIT.pdf
SAMPLE FOR MICRO PROGRAMMING CO_-_7th_UNIT.pdfSAMPLE FOR MICRO PROGRAMMING CO_-_7th_UNIT.pdf
SAMPLE FOR MICRO PROGRAMMING CO_-_7th_UNIT.pdf
 
Module_5_1.pptx
Module_5_1.pptxModule_5_1.pptx
Module_5_1.pptx
 
Module_4_2.pptx
Module_4_2.pptxModule_4_2.pptx
Module_4_2.pptx
 
IEEE_Wireless.pdf
IEEE_Wireless.pdfIEEE_Wireless.pdf
IEEE_Wireless.pdf
 
IEEEWired.pdf
IEEEWired.pdfIEEEWired.pdf
IEEEWired.pdf
 

Kürzlich hochgeladen

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
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 

Kürzlich hochgeladen (20)

Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
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...
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
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
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
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...
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
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
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 

Module_3_1.pptx

  • 2. Adversarial search is search when there is an "enemy" or "opponent" changing the state of the problem every step in a direction you do not want.
  • 3. Adversarial search is a search, where we examine the problem which arises when we try to plan ahead of the world and other agents are planning against us. • A single agent that aims to find the solution which often expressed in the form of a sequence of actions. • There might be some situations where more than one agent is searching for the solution in the same search space, and this situation usually occurs in game playing.
  • 4. • The environment with more than one agent is termed as multi-agent environment, in which each agent is an opponent of other agent and playing against each other. Each agent needs to consider the action of other agent and effect of that action on their performance. • Searches in which two or more players with conflicting goals are trying to explore the same search space for the solution, are called adversarial searches, often known as Games. • Games are modeled as a Search problem and heuristic evaluation function, and these are the two main factors which help to model and solve games in AI.
  • 5. Types of Games in AI • Perfect information: A game with the perfect information is that in which agents can look into the complete board. Examples are Chess, Checkers, Go, etc. • Imperfect information: In a game agents do not have all information about the game and not aware with what's going on, such as tic- tac-toe, Battleship, blind, Bridge, etc.
  • 6. • Deterministic games: games which follow a strict pattern and set of rules for the games, and there is no randomness associated with them. Examples are chess, Checkers, Go, tic-tac-toe, etc. • Non-deterministic games: games which have various unpredictable events and has a factor of chance or luck. Ex. dice or cards. • These are random, and each action response is not fixed. Such games are also called as stochastic games. Example: Backgammon, Monopoly, Poker, etc.
  • 7. Zero-Sum Game • Zero-sum games are adversarial search which involves pure competition. • In Zero-sum game each agent's gain or loss of utility is exactly balanced by the losses or gains of utility of another agent. • One player of the game try to maximize one single value, while other player tries to minimize it. • Each move by one player in the game is called as ply. • Chess and tic-tac-toe are examples of a Zero-sum game.
  • 8. Zero-sum game: Embedded thinking • The Zero-sum game involved embedded thinking in which one agent or player is trying to figure out: • What to do. • How to decide the move • Needs to think about his opponent as well • The opponent also thinks what to do
  • 9. There were two reasons that games appeared to be a good domain in which to explore machine intelligence: They provide a structured task in which it is very easy to measure success or failure. They did not obviously require large amounts of knowledge. They were thought to be solvable by straightforward search from the starting state to a winning position. 9
  • 10. 10 To improve the effectiveness of a search based problem solving program two things can be done: Improve the generate procedure so that only good moves(or paths) are generated. Improve the test procedure so that the best moves(or paths) will be recognized and explored first.
  • 11. 11 • The problem of playing chess we use simple legal move generator , then the test procedure will have to look at each of them. • Instead of a legal move generator, we use a plausible-move generator in which only some small number of promising moves are generated. • The test procedure can afford to spend more time evaluating each of the moves it is given so it can produce a more reliable result.
  • 12. 12 • We have to incorporate heuristic knowledge into both the generator and the tester, so that the performance of the overall system can be improved. • In order to choose the best move, the resulting board positions must be compared to discover which is most promising. • This is done by using a static evaluation function, which uses whatever information it has to evaluate individual board positions by estimating how likely they are to lead eventually to a goal.
  • 13. Formalization of the problem A game can be defined as a type of search in AI which can be formalized of the following elements: • Initial state: It specifies how the game is set up at the start. • Player(s): It specifies which player has moved in the state space. • Action(s): It returns the set of legal moves in state space. • Result(s, a): It is the transition model, which specifies the result of moves in the state space.
  • 14. • Terminal-Test(s): Terminal test is true if the game is over, else it is false at any case. The state where the game ends is called terminal states. • Utility(s, p): A utility function gives the final numeric value for a game that ends in terminal states s for player p. It is also called payoff function. For Chess, the outcomes are a win, loss, or draw and its payoff values are +1, 0, ½. And for tic-tac-toe, utility values are +1, -1, and 0.
  • 15. Game tree A game tree is a tree where nodes of the tree are the game states and Edges of the tree are the moves by players. Game tree involves initial state, actions function, and result Function. Example: Tic-Tac-Toe game tree: • The following figure is showing part of the game-tree for tic-tac-toe game. Following are some key points of the game: • There are two players MAX and MIN. • Players have an alternate turn and start with MAX. • MAX maximizes the result of the game tree • MIN minimizes the result.
  • 16.
  • 17.
  • 18. Mini-Max Algorithm • Mini-max algorithm is a recursive or backtracking algorithm used for decision-making in game theory. • It provides an optimal move for the player assuming that opponent is also playing optimally. • It uses recursion to search through the game-tree. • Min-Max algorithm – Ex: Chess, Checkers, tic-tac-toe, go, and various two-players game (turn-based games). • Algorithm computes the minimax decision for the current state, two players play the game, one is called MAX and other is called MIN.
  • 19. • Both the players fight it as the opponent player gets the minimum benefit while they get the maximum benefit. • Both Players of the game are opponent of each other, where MAX player will select the maximized value and MIN player will select the minimized value. • It performs a depth-first search algorithm for the exploration of the complete game tree. • It proceeds all the way down to the terminal node of the tree, then backtrack the tree as the recursion. • The goal is to find the best possible move for a player.
  • 20. • Every board state has a value associated with it. • If the MAX player has upper hand then, the score of the board be some positive value. • If the MIN player has the upper hand then board state be some negative value. • The values of the board are calculated by some heuristics which are unique for every type of game. • It is based on the zero-sum game concept where the total utility score gets divided between the two players.
  • 21. Implementation • There are two players one is called Maximizer and other is called Minimizer. • Maximizer will try to get the Maximum possible score, and Minimizer will try to get the minimum possible score. • Apply DFS, in the game-tree, and go all the way through the leaves to reach the terminal nodes. • At the terminal node, the terminal values are given so we will compare those value and backtrack the tree until the initial state occurs.
  • 22. • Step-1: The algorithm generates the entire game-tree and apply the utility function to get the utility values for the terminal states. • Ex: 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.
  • 23.
  • 24. Step 2: Now, first we find the utilities value for the Maximizer, its initial value is -∞
  • 25. Step 3: In the next step, it's a turn for minimizer, so it will compare all nodes value with +∞
  • 26. Step 3: 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.
  • 28.