0% found this document useful (0 votes)
2 views24 pages

AI Lecture 7

Uploaded by

zeegamingzone
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views24 pages

AI Lecture 7

Uploaded by

zeegamingzone
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Lecture 7 – Adversarial Search

Instrutor : Hafiz Mueez Ameen

March 6, 2023 1
 Multi-agent environment: every agent needs to
consider the actions of the other agents, in
order to optimize its own welfare
 Normally considered in terms of economies
 Cooperative: Agents act collectively to
achieve a common goal
 Competitive:
 Agents compete against each other
 Their goals are in conflict
 Gives rise to the concept of adversarial
search problems – often known as games.
 It’s a branch of economics
 Views any MAE as a game provided that the
impact of each agent on the other is “significant”,
i.e., able to affect the actions of the other agent(s)
 In AI, “game” is a specialized concept:
 Deterministic, fully-observable environments
 Two agents whose actions must alternate
 Utility values at the end of the game are always
equal and opposite
 +1 = Chess winner
 -1 = Chess looser.

March 6, 2023 3
 Tackled by Konrad Zuse, Claude Shannon,
Norbert Wiener, Alan Turing
 Have seen lot of successes recently, e.g.,
DeepBlue
 Game states are easy to represent:
 Agents restricted by a limited action rules
 Outcomes defined by precise rules
 Games: interesting because they are hard to
solve:
 Chess: average branching factor of 35
 If 50 moves by each player, search tree has
35100 nodes!
March 6, 2023 4
 In typical search problems, we optimize a
measure to acquire the goal: there is no
opponent
 In games, there is an "Unpredictable" opponent
 Need to specify a move for every possible
opponent reply
 Stringent time constraints
 Unlikely to find goal, must approximate
 Requires some type of a decision to move the
search forward.

 Strict penalty on an inefficient move


 Initial state
 Successor function
 Terminal state test
 Utility function: defining the usefulness of the
terminal states from the point of view of one of the
players.
 Imagine 2 players of tic-tac-toe: MAX and MIN
 MAX moves first: We can generate a game tree
 The terminal states are at the leaves
 MAX should play in order to maximize its utility,
which will minimize the utility for MIN
 This is called a Zero-Sum Game.

March 6, 2023 6
This terminal state is one of the worst for This terminal state is one of the best for
MAX and one of the best for MIN MAX and one of the worst for MIN
 This is a MAE
 In discovering the sequence of optimal moves
by MAX, we have to consider that MIN is
taking moves as well
 So, the optimal strategy will tell how should
MAX play against MIN (by considering the
moves of the latter), in order to win the game
 Let us consider a shortened game tree of TIC-
TAC-TOE
 Numbers are the utilities
 Ply: a move by MAX followed by a move from
MIN.
March 6, 2023 8
Move of MAX

Move of MIN
 When it is the turn of MAX, it will always take
an action in order to maximize its utility,
because it’s winning configurations have high
utilities
 When it is the turn of MIN, it will always take an
action in order to minimize its utility, because
it’s winning configurations have low utilities
 In order to implement this, we need to define a
measure in each state that takes the move of
the opponent into account:
 This measure is called Minimax.

March 6, 2023 10
 Minimax represents the utility of a state, given
that both MAX and MIN will play optimally till
the end of the game
 In any state s, one or more actions are possible

 For every possible new state that can be

transited into from s, we compute the minimax


value
 The term “Minimax” is used because:

 the opponent is always trying to minimize

the utility of the player, and


 the player is always trying to maximize this

minimized selection of the opponent.


 Confused? See next slide…
March 6, 2023 11
 Consider “3” at Level 1: MIN selects an action
(A11) that leads to a state of minimum utility
for MAX, i.e., minimum{3,12,8}
 Consider “3” at Level 0: MAX selects an action
(A1) that leads to a state of maximum utility for
MIN, i.e., maximum{3,2,2}
 Both are opposing what is best for the other.

March 6, 2023 12
 At each node, MAX will always select the action
with highest minimax value (it wants to reach
states with higher utilities)
 At each node, MIN will always select the action
with lowest minimax value (it wants to reach
states with lower utilities).
March 6, 2023 13
Depth-First
Exploration

Recursion: Winds all


the way to the
terminal nodes, and
then unwinds back
by backing up the
values

Min(minimax) for MIN


moves
Max(minimax) for
MAX moves
 Complete? Yes (if tree is finite)

 Optimal? Yes (against an optimal opponent)

 Time complexity? O(bm)

 Space complexity? O(bm) (depth-first


exploration)

 For chess, b ≈ 35, m ≈100 for "reasonable"


games  exact solution completely infeasible
 We need to think of a way to cut down the
number of search paths.
 α is the value of
the best (i.e.,
highest-value)
choice found so far
at any choice point
along the path for
MAX
 If v is worse than
α, MAX will avoid it
 prune that branch
 Define β similarly
for MIN.
 Pruning does not affect final result

 Good move ordering improves effectiveness of


pruning

 With "perfect ordering," time complexity =


O(bm/2)
 doubles depth of search

 A simple example of the value of reasoning


about which computations are relevant (a form
of meta-reasoning)
March 6, 2023 24

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy