study group randomized algorithms 21 st june 03. topics covered game tree evaluation –its expected...
TRANSCRIPT
Study GroupRandomized Algorithms
21st June 03
Topics Covered
• Game Tree Evaluation– its expected run time is better than the worst-
case complexity of any deterministic algorithm– demonstrates a technique to derive a lower
bound on running time of any randomized algorithm for a problem
• Introduction to Game Theory– leads to the Minimax Principle
Definition of Game Tree
• a Game Tree Td,k is uniform tree in which the root and the internal nodes has d children and every leaf is at distance 2k from the root
• internal nodes at even distance from the root are labeled MIN and at odd distance are labeled MAX
• each leaf is associated with a value
Example of a Game Tree T2,2
MIN
MINMINMIN
MAXMAX
MIN
MAXMAXMAX MAX MAXMAXMAX MAX
0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1
Observations
• Every root-to-leaf path goes through the same number of MIN and MAX nodes (including the root)
• If the depth of the tree is 2k, there are 22k = 4k leaves
Game Tree Evaluation
• MIN (AND) Node– returns the lesser of the two children
MIN
0 0
0
MIN
0 1
0
MIN
1 0
0
MIN
1 1
1
Game Tree Evaluation
• MAX (OR) Node– returns the greater of the two children
MAX
0 0
0
MAX
0 1
1
MAX
1 0
1
MAX
1 1
1
What is the value returned by the root?
AND
ANDANDAND
OROR
AND
OROROR OR OROROR OR
0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1
A Deterministic Algorithm
• Depth-first manner– always visit the left child before the right child
AND
OR OR
0 1 0 1
AND
OR OR
1 0 1 0
worst case – need to visit ALL 4k leaves a better case – visit 2 leaves is enough
A Randomized Algorithm
• Coin toss– 0.5 probability choosing the left child and 0.5
probability choosing the right child
AND
OR OR
0 1 0 1
Expected cost (number of leaves visited) 3
Design Rationale
• Suppose AND node were to return 0– at least one of the leaves is 0– if deterministic algorithm is used, your
opponent can always “hide” this 0 and make your algorithm visit both leaves
– if randomized algorithm is used, you foils your opponent’s strategy. The expected number of steps (leaf visits) is 3/2
• Similar for OR node were to return 1
Design Rationale
• Expected cost– EAND_0 = EOR_1 = 3/2
• What if AND(OR) node were to return 1(0)?– both children are 1(0), it seems that the
randomized algorithm doesn’t improve much since we need to visit both children anyway
– however, it benefits the parent level
Analysis of the Randomized Algo.
• Claim:
The expected cost of the randomized algorithm for evaluating any T2,k game tree is at most 3k
• Proof by induction:– consider k = 1– expected cost 3
Analysis of the Randomized Algo.
• Case I – root evaluated to 0– at least one of the subtrees
(OR nodes) gives 0– you have 0.5 probability that
this particular node is checked first
– E(T) = ½ 2 + ½ (3/2 + 2)
= 2.75
AND
OR OR
0 0 0 1
return 0
Analysis of the Randomized Algo.
• Case II – root evaluated to 1– both subtrees give 1– E(T) = 2 3/2
= 3
• Both cases give 3 expected cost, so the claim is true for k=1
AND
OR OR
0 1 0 1
return 1
Analysis of the Randomized Algo.
• Assume that for all T2,k-1, the expected cost 3k-1
• First, consider the OR-root tree
OR
T2,k-1 T2,k-1
either gives 1 or 0
Analysis of the Randomized Algo.
• Case I: OR-root gives 1– at least one subtree gives 1– 0.5 probability we use it first– E(T) ½ 3k-1 + ½ 2 3k-1
= 3/2 3k-1
• Case II: OR-root gives 0– both subtrees give 0– E(T) 2 3k-1
OR
T2,k-1 T2,k-1
either 1 or 0
Analysis of the Randomized Algo.
• Now, consider the AND-root game tree, T2,k
OR
T2,k-1 T2,k-1
AND
OR
T2,k-1 T2,k-1
OR
T2,k-1 T2,k-1
T2,k
Analysis of the Randomized Algo.
• Case I: AND-root gives 0– at least one subtree gives 0– 0.5 probability we use it first
– E(T2,k) ½ 2 3k-1
+ ½ (3/2 3k-1 + 2 3k-1)
= 2.75 3k-1 3k
• Case II: AND-root gives 1– both subtrees give 1
– E(T2,k) 2 3/2 3k-1
= 3k
either 1 or 0
AND
OR
T2,k-1 T2,k-1
OR
T2,k-1 T2,k-1
Analysis of the Randomized Algo.
• Proved the claim:
The expected cost of the randomized algorithm for evaluating any T2,k game tree is at most 3k
• A tree has n = 4k leaves, then k = log4n. Substitute log4n for k in the expected cost, then the cost 3log4n. By xlogab = blogax, the cost nlog43 =n0.793
Question
Our randomized algorithm for the game tree evaluation of any uniform binary tree with n leaves is n0.793. Can we establish that no randomized algorithm can have a lower expected running time?
YES! Using Yao’s technique the Minimax Theorem Game Theory Basics
Introduction to Game Theory
• Consider the stone-paper-scissors game between 2 players– loser pays $1 to the winner
– payoff matrix M : Mij denotes the payoff by the Column player to the Row player
Scissors Paper Stone
Scissors 0 1 -1
Paper -1 0 1
Stone 1 -1 0
Two-person Zero-sum Game
• Zero-sum game– the net amount won by C and R is exactly zer
o, i.e., the amount of money is not increased or decreased among them
• Every two-person zero-sum game can be represented by a nm payoff matrix
Pure Strategy v.s. Mixed Strategy
• Pure (Deterministic) strategy– always uses the same strategy or a
deterministic pattern, e.g., R always chooses ‘stone’ while C always chooses ‘paper’
• Mixed (Randomized) strategy– the strategy chosen by a player is
randomized, i.e., a probability distribution among all possible strategies
Pure Optimal Strategy
• Zero-information game– the strategy chosen by the opponent is unkno
wn
• Naturally, the goal of the row (column) player is to maximize (minimize) the payoff– If R chooses strategy i, then she is guarantee
d a payoff of minjMij, regardless of what C’s strategy is
– Optimal strategy for R is an strategy i that maximize minjMij.
Pure Optimal Strategy
• Similarly, the optimal strategy of C is– If C chooses strategy j, then he is guaranteed
a loss of no more than maxiMij, regardless of what R’s strategy is
– Optimal strategy for C is an strategy j that minimize maxiMij.
• Let Vr = maximinjMij and Vc = minjmaxiMij be the lower bound of payoff R can get and the upper bound of loss C can ensure respectively
Inequality for All Payoff Matrix
• Minimax InequalitymaximinjMij minjmaxiMij
• Proof:i
j
Vr
Vc
z
Clearly, Vr z Vc
Saddle-point
• If Vr = Vc, we say the game has a solution and the value of the game is V = Vr = Vc
• the solution is also known as the saddle-point of the game
• If no saddle-point exists, it means there is no clear-cut pure optimal strategy for any player
Mixed Strategy Game
• The Row player picks a vector p = (p1, …, pn), which is a probability distribution on the rows of M. (i.e., pi is the probability that R will choose strategy i)
• Similarly, the Column player picks a vector q = (q1, …, qm), i.e., qj is the probability that R will choose strategy j)
Mixed Optimal Strategy
• Expected Payoff– E[payoff] = pT M q– R aims to maximize it while C aims to minimizes it
• As before, let Vr = maxpminq pT M q be the lower bound of the expected payoff R can get using a strategy p
• Let VC = minqmaxp pT M q be the upper bound of the expected payoff C need to pay using a strategy q
von Neumann’s Mininmax Theorem
• For any two person, zero-sum game specified by a matrix M
maxpminqptMq = minqmaxppTMq
• the optimal strategy for R will yield the same payoff as the optimal strategy for C!
• if either player uses his optimal strategy, the opponent cannot improve the payoff