Textbook: Chapter 6
Supplementary reading #4: Adversarial Search, by Russell and Norvig
Searching in the presence of an adversary introduces uncertainty
Usually too hard to solve completely
Example: chess branching factor of ~ 35 with ~ 50 moves per player means that a typical search tree has ~ 35100 nodes
Resource limits force us to approximate
Search tree must take into account the different perspectives of the two players (MAX and MIN). You (MAX) are trying to maximize your chances of winning while your opponent (MIN) is trying to minimize your chances of winning.
Utility function returns values from the perspective of MAX
Minimax Algorithm |
|
---|
Example: Game of Nim
Complete if game tree is finite
Optimal against an optimal opponent
O(bd ) time complexity
O(bd) space complexity (does a depth-first exploration)
Introduce chance nodes into the game tree
At chance nodes, the "moves" correspond to rolls of the dice
Compute expectiminimax values of nodes instead of minimax values
Expectiminimax value of a chance node is a weighted average over probabilities
We use a static evaluation function instead of a utility function to estimate expected utility
Replace terminal test by a cutoff test
Example: material value of pieces in chess
eval(board) = 1 · Δ pawns + 3 · Δ bishops + 9
· Δ queens + ...
In general, eval(s) = w1 · f1(s) + w2 · f2(s) + ... + wn · fn(s) is a weighted linear sum
With 100 seconds and ability to explore 10,000 nodes/sec, we can examine 1,000,000 nodes per move, so bd = 106. If b = 35, d is slightly less than 4.
4-ply lookahead = human novice
8-ply lookahead = human master, typical PC
14-ply lookahead = Deep Blue, Kasparov
Another problem: cutting off search in non-quiescent states.
Example: White is up by a bishop, but will lose queen on the next move.
If you have an idea that is surely bad, do not take time to analyze just how bad it is.
Effectiveness of alpha-beta pruning depends on the ordering in which successor nodes are examined.
Worst case: O(bd ) no gain
Best case: O(bd/2 ) big gain, but still exponential
Effective branching factor is sqrt(b) instead of b
Alpha-beta can look twice as far ahead in the game tree as Minimax for the same cost
Example: chess goes from b ~ 35 to b ~ 6.
This can be the difference between playing a game at a novice level versus an expert level.
No alpha-beta pruning (worst-case)