Lecture Adversarial Searches
Lecture Adversarial Searches
ADVERSARIAL SEARCH
1
ADVERSARIAL SEARCH
• In which we examine the problems that arise when we try to plan
ahead in a world where other agents are planning against us.
2
Adversarial Search
• 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.
• In previous topics, we have studied the search strategies which
are only associated with a single agent that aims to find the
solution which often expressed in the form of a sequence of
actions.
• But, 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.
Adversarial Search
• 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.
• So, 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.
Games
• A game can be defined as a search problem with the
following elements:
7
Simple Approach in Tic-Tac-Toe
• In simple algorithm, calculate all the possible moves from the
current position. For a game of Noughts and Crosses the
result might look like:
10
OPTIMAL DECISIONS IN GAMES
– Higher the result of f(n), the closer the move towards a win. Three
moves result in 3 but only one move results a win for X in Figure.
– This f(n) is useful but another heuristics is necessary to pick the move
with highest f(n) while protecting against a loss in the next move.
– Thus, the computer should make the move which leaves its opponent
capable of doing the least damage.
11
Minimax algorithm
• Minimax uses one of the two basic strategies:
12
Minimax algorithm
• After evaluating some number of moves ahead
we examine the total value of the cost to each
player.
14
Partial Example Tree For Minimax
Algorithm
15
Example
16
Example
17
ALPHA–BETA PRUNING
• Minimax search is exponential like DFS and couldn’t
be eliminated but can be effectively cut in half.
19
ALPHA–BETA PRUNING
20
ALPHA–BETA PRUNING
• Alpha–beta search updates the values of α and β
as it goes along and prunes the remaining
branches at a node (i.e., terminates the recursive
call) as soon as the value of the current node is
known to be worse than the current α or β value
for MAX or MIN, respectively.
22
Example
23
Example
24
EXample
25