AI - Problem Solving Final
AI - Problem Solving Final
Adversarial Search
Can we apply the recently discussed
search methods to all problems?
Why or why not?
How does the search change when there
are multiple actors involved?a
Game Playing
A second player (or more) is an adversary
Examples: chess, checkers, go, tic-tac-toe, connect
four, backgammon, bridge, poker
Adversarial search.
deterministic chance
chess, checkers,
perfect connect four, backgammon
information othello
Max attempts to
maximize the advantage 6-1 5-2 4-3 max
and win.
2-1-1-1-1-1 max
Perfect Decision, Two person games
Two players
MAX and MIN
MAX moves first; alternate turns thereafter.
Formal definition of game
Initial State
Successor Function
Terminal Test
Utility Function
No one player has full control, must develop a
strategy.
Minimax Algorithm: Basics
3 MAX
3 0 2 MIN
3 9 0 7 2 6 MAX
MIN
2 3 5 9 0 7 4 2 1 5 6
1
0
3-1-1-1-1 2-2-1-1-1 min
What do we observe from tree?
0 2-1-1-1-1-1 max
Branch and Bound
The basic idea was to reduce the
search space by binding the paths
that exceed the path length from S
to G.
We will discuss the two most famous
ways to improve it.
1. Estimates
2. Dynamic Programming
Branch and Bound
Basic Observation
S
9
Branch and Bound
3
A B 3 C
2
4
G
S
S
3 2
D E F
1 3
2 A D 3
5 B D 6 7 A E 4
8 7
8 9 7 10
C E E B B F
10 10 11 11 9
12 11
D F B F C E A C G
G C G F
G
Alpha Beta Pruning
=3
>=3
A Maximizing Level
=3
B =<2 C Minimizing Level
Maximizing Level
3 6 2
Alpha Beta Pruning
50
50
Maximizing Level
50 30 20
Minimizing Level
70 30 20
50
Maximizing Level
50 40 70 10 60 30 80 90 20 90 70 60
Alpha-Beta Pruning
Definitions
value – lower bound on MAX node
value – upper bound on MIN node
Observations
value on MAX nodes never decrease
values on MIN nodes never increase
Application
Search is discontinued below any MIN node with min-
value v : cut off
Search is discontinued below any MAX node with
max-value v : cut off
Alpha-Beta Search Algorithm
Computing and
value of MAX node = current largest final backed-
up value of its successors.
value of MIN node = current smallest final backed-
MAX-VALUE(state, , ) MIN-VALUE(state, , )
if TERMINAL-TEST(state) then if TERMINAL-TEST(state) then
return UTILITY(state) return UTILITY(state)
v = -∞ v = +∞
for a, s in SUCCESSORS(state) do for a, s in SUCCESSORS(state) do
v = MAX(v, MIN-VALUE(s, )) v = MIN(v, MAX-VALUE(s, ))
if v >= then return v if v <= then return v
= MAX(, v) = MIN(, v)
return v (a utility value) return v (a utility value)
That’s All
Thank You.