AI Unit 3
AI Unit 3
UNIT – 3
Adversarial search Methods-Game
playing-Important concepts
• Techniques required to get
the best optimal solution
(Choose Algorithms for best
optimal solution within
limited time)
– Pruning: A technique
which allows ignoring the
unwanted portions of a
search tree which make no
difference in its final
result.
– Heuristic Evaluation
Function: It allows to
approximate the cost value
at each level of the search
tree, before reaching the
goal node.
Game playing and knowledge structure-
Elements of Game Playing search
• To play a game, we use a game tree to • For example, in chess, tic-tac-toe, we have
know all the possible choices and to pick two or three possible outcomes. Either to
the best one out. There are following win, to lose, or to draw the match with
elements of a game-playing: values +1,-1 or 0.
• S0: It is the initial state from where a game • Game Tree for Tic-Tac-Toe
begins. – Node: Game states, Edges: Moves taken by
• PLAYER (s): It defines which player is having players
the current turn to make a move in the
state.
• ACTIONS (s): It defines the set of legal
moves to be used in a state.
• RESULT (s, a): It is a transition model which
defines the result of a move.
• TERMINAL-TEST (s): It defines that the
game has ended and returns true.
• UTILITY (s,p): It defines the final value with
which the game has ended. This function is
also known as Objective function or Payoff
function. The price which the winner will
get i.e.
• (-1): If the PLAYER loses.
• (+1): If the PLAYER wins.
• (0): If there is a draw between the PLAYERS.
https://www.tutorialandexample.com/adversarial-search-in-artificial-intelligence/#:~:text=AI%20Adversarial%20search%3A%20A
dversarial%20search,order%20to%20win%20the%20game.
Game playing and knowledge structure-
Elements of Game Playing search
• INITIAL STATE (S0): The top node in
the game-tree represents the initial
state in the tree and shows all the
possible choice to pick out one.
• PLAYER (s): There are two
players, MAX and MIN. MAX begins
the game by picking one best move
and place X in the empty square box.
• ACTIONS (s): Both the players can
make moves in the empty boxes
chance by chance.
• RESULT (s, a): The moves made
by MIN and MAX will decide the
outcome of the game.
• TERMINAL-TEST(s): When all the
empty boxes will be filled, it will be the
terminating state of the game.
• UTILITY: At the end, we will get to
know who wins: MAX or MIN, and
accordingly, the price will be given to
them.
Game as a search problem
Tree from
Max’s
perspective
Minimax Algorithm
• Minimax algorithm
– Perfect play for deterministic, 2-player game
– Max tries to maximize its score
– Min tries to minimize Max’s score (Min)
– Goal: move to position of highest minimax value
Identify best achievable payoff against best play
Minimax Algorithm
2 1 2 1
2 7 1 8 2 7 1 8 2 7 1 8
MIN
2 7 1 8
Minimax Algorithm (cont’d)
3 9 0 7 2 6
3 0 2
3 9 0 7 2 6
3 0 2
3 9 0 7 2 6
• Limitations
– Not always feasible to traverse entire tree
– Time limitations
• Key Improvement
– Use evaluation function instead of utility
• Evaluation function provides estimate of utility at given
position
α-β Pruning
Principle
– If a move is determined worse than another move already
examined, then there is no need for further examination of the
node.
α-β Pruning Example
α-β Pruning Example (cont’d)
α-β Pruning Example (cont’d)
α-β Pruning Example (cont’d)
α-β Pruning Example (cont’d)
Alpha-Beta Pruning (αβ prune)
• Rules of Thumb
β
Alpha-Beta Pruning Example
β
Alpha-Beta Pruning Example
β
The α-β algorithm
The α-β algorithm
Another Example
1. Search below a MIN
node may be
alpha-pruned if the
beta value is <= to
the alpha value of
some MAX ancestor.
• Puzzle Solving: Many logic puzzles, such as Sudoku, crosswords, and the
Learning agents hold the same capabilities as the other agent types but are
unique in their ability to learn. New experiences are added to their initial
knowledge base, which occurs autonomously. This learning enhances the
agent’s ability to operate in unfamiliar environments. Learning agents may be
utility or goal-based in their reasoning and are comprised of four main
elements:
Learning agents
Learning: This improves the agent’s knowledge by learning from the
environment through its precepts and sensors.
Critic: This provides feedback to the agent on whether the quality of its
responses meets the performance standard.
Performance: This element is responsible for selecting actions upon learning.
Problem generator: This creates various proposals for actions to be taken.
Example: Personalized recommendations on e-commerce sites. These agents
track user activity and preferences in their memory. This information is used
to recommend certain products and services to the user. The cycle repeats
each time new recommendations are made. The user’s activity is
continuously stored for learning purposes. In doing so, the agent improves its
accuracy over time.
Learning agents
Use cases of AI Agents
Customer experience
AI agents can be integrated into websites and apps to enhance the customer
experience by serving as a virtual assistants, providing mental health support,
simulating interviews and other related tasks.
Healthcare
AI agents can be used for various real-world healthcare applications. From
treatment planning for patients in the emergency department to managing
drug processes, these systems save the time and effort of medical
professionals for more urgent tasks.
Emergency response
In case of natural disasters, AI agents can use deep learning algorithms to
retrieve the information of users on social media sites that need rescue.
Benefits of AI Agents
Task automation
With the ongoing advancements in generative AI, there is a
growing interest in workflow optimization using AI, or intelligent
automation. AI agents are AI tools that can automate complex
tasks that would otherwise require human resources.
Greater performance
Multi-agent frameworks tend to outperform singular agents. An
AI agent incorporating knowledge and feedback from other AI
agents specializing in related areas can be useful for information
synthesis.
Quality of responses
AI agents provide responses that are more comprehensive,
accurate and personalized to the user than traditional AI models.