› ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture...
Transcript of › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture...
![Page 1: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/1.jpg)
Lecture 17Games and Adversarial Search
Marco Chiarandini
Department of Mathematics & Computer ScienceUniversity of Southern Denmark
Slides by Stuart Russell and Peter Norvig
![Page 2: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/2.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesCourse Overview
4 Introduction4 Artificial Intelligence4 Intelligent Agents
4 Search4 Uninformed Search4 Heuristic Search
4 Uncertain knowledge andReasoning
4 Probability and Bayesianapproach
4 Bayesian Networks4 Hidden Markov Chains4 Kalman Filters
4 Learning4 Supervised
Decision Trees, NeuralNetworksLearning Bayesian Networks
4 UnsupervisedEM Algorithm
4 Reinforcement LearningI Games and Adversarial Search
I Minimax search andAlpha-beta pruning
I Multiagent searchI Knowledge representation and
ReasoningI Propositional logicI First order logicI InferenceI Plannning
2
![Page 3: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/3.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesOutline
♦ Games♦ Perfect play
– minimax decisions– α–β pruning
♦ Resource limits and approximate evaluation♦ Games of chance♦ Games with imperfect information
3
![Page 4: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/4.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesOutline
1. Introduction
2. Minimax
3. α–β Algorithm
4. Stochastic Games
4
![Page 5: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/5.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesMultiagent environments
Multiagent environments:
I cooperativeI competitive è adversarial search in games
AI game theory (combinatorial game theory)
I deterministic/stochasticI turn takingI two playersI zero sum games = utility values equal and oppositeI perfect/imperfect informationI agents are restricted to a small number of actions described by rules
“Classical” (economic) game theory includes cooperation, chance, imperfectknowledge, simultaneous moves and tends to represent real-life decisionmaking situations.
5
![Page 6: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/6.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesTypes of Games
deterministic chance
perfect information chess, checkers, kalahago, othello
backgammon,monopoly
imperfect information battleships,blind tictactoe
bridge, poker, scrabble
6
![Page 7: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/7.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesGames vs. search problems
“Unpredictable” opponent ⇒ solution is a strategy/policyspecifying a move for every possible opponent reply è contingency strategy
Optimal strategy: the one that leads to outcomes at least as good as anyother strategy when one is playing an infallibile opponent
Search problem game treeI initial state: root of game treeI successor function: game rules/movesI terminal test (is the game over?)I utility function, gives a value for terminal nodes (eg, +1, -1, 0)
Terminology:
I Two players called MAX and MIN.I MAX searches the game tree.I Ply: one turn (every player moves once) from “reply”. [A. Samuel 1959]
7
![Page 8: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/8.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesGame tree (2-player, deterministic, turns)
XXXX
XX
X
XX
MAX (X)
MIN (O)
X X
O
OOX O
OO O
O OO
MAX (X)
X OX OX O XX X
XX
X X
MIN (O)
X O X X O X X O X
. . . . . . . . . . . .
. . .
. . .
. . .
TERMINALXX
−1 0 +1Utility
9
![Page 9: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/9.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesMeasures of Game Complexity
I state-space complexity: number of legal game positions reachable fromthe initial position of the game.
an upper bound can often be computed by including illegal positionsEg, TicTacToe:39 = 19.6835.478 after removal of illegal765 essentially different positions after eliminating symmetries
I game tree size: total number of possible games that can be played:number of leaf nodes in the game tree rooted at the game’s initialposition.
Eg: TicTacToe:9! = 362.880 possible games255.168 possible games halting when one side wins26.830 after removal of rotations and reflections
10
![Page 10: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/10.jpg)
IntroductionMinimaxα–β AlgorithmStochastic Games
11
![Page 11: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/11.jpg)
IntroductionMinimaxα–β AlgorithmStochastic Games
First three levels of the tic-tac-toe state space reduced by symmetry: 12× 7!
12
![Page 12: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/12.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesOutline
1. Introduction
2. Minimax
3. α–β Algorithm
4. Stochastic Games
13
![Page 13: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/13.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesMinimax
Perfect play for deterministic, perfect-information games
Idea: choose move to position with highest minimax value ( utility for MAX)= best achievable payoff against best play
E.g., 2-ply game:
MAX
3 12 8 642 14 5 2
MIN
3
A1
A3
A2
A13A
12A
11A
21 A23
A22
A33A
32A
31
3 2 2
14
![Page 14: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/14.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesMinimax algorithm
Recursive Depth First Search:
15
![Page 15: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/15.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesProperties of minimax
Complete?? Yes, if tree is finite (chess has specific rules for this)Time complexity?? O(bm)Space complexity?? O(bm) (depth-first exploration)
But do we need to explore every path?
16
![Page 16: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/16.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesMeasures of Game Complexity
I game-tree complexity: number of leaf nodes in the smallest full-widthdecision tree that establishes the value of the initial position.A full-width tree includes all nodes at each depth.estimates the number of positions to evaluate in a minimax search todetermine the value of the initial position.
approximation: game’s average branching factor to the power of thenumber of plies in an average game.Eg.: chess For chess, b ≈ 35, m ≈ 100 for “reasonable” games
⇒ exact solution completely infeasible
I computational complexity applies to generalized games(eg, n × n boards)Eg: TicTacToe:m × n board k in a row solved in DSPACE (mn) by searching the entiregame tree
17
![Page 17: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/17.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesHistorical view
Time limits ⇒ unlikely to find goal, must approximate
Plan of attack:I Computer considers possible lines of play (Babbage, 1846)I Algorithm for perfect play - MINIMAX - (Zermelo, 1912; Von Neumann,
1944)I Finite horizon, approximate evaluation (Zuse, 1945; Wiener, 1948;
Shannon, 1950)I First chess program (Turing, 1951)I Machine learning to improve evaluation accuracy (Samuel, 1952–57)I Pruning to allow deeper search - α− β alg. - (McCarthy, 1956)
18
![Page 18: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/18.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesResource limits
Standard approaches:
I n-ply lookahead: depth-limited search
I heuristic descent
I heuristic cutoff
1. Use Cutoff-Test instead of Terminal-Teste.g., depth limit (perhaps add quiescence search)
2. Use Eval instead of Utilityi.e., evaluation function that estimates desirability of position
Suppose we have 100 seconds, explore 104 nodes/second⇒ 106 nodes per move ≈ 358/2
19
![Page 19: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/19.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesHeuristic Descent
Heuristic measuring conflict applied to states of tic-tac-toe
20
![Page 20: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/20.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesEvaluation functions
Black to move
White slightly better
White to move
Black winning
For chess, typically linear weighted sum of features
Eval(s) = w1f1(s) + w2f2(s) + . . .+ wnfn(s)
e.g., w1 = 9 withf1(s) = (number of white queens) – (number of black queens), etc.
21
![Page 21: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/21.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesThrashing
22
![Page 22: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/22.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesDigression: Exact values don’t matter
MIN
MAX
21
1
42
2
20
1
1 40020
20
Behaviour is preserved under any monotonic transformation of EvalOnly the order matters:
payoff in deterministic games acts as an ordinal utility function
23
![Page 23: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/23.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesOutline
1. Introduction
2. Minimax
3. α–β Algorithm
4. Stochastic Games
24
![Page 24: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/24.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesExample
25
![Page 25: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/25.jpg)
IntroductionMinimaxα–β AlgorithmStochastic Gamesα–β pruning example
MAX
3 12 8
MIN
3
3
2
2
X X14
14
5
5
2
2
3
Minimax(root) = max {3,min{2, x , y},min{...}}
26
![Page 26: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/26.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesWhy is it called α–β?
..
..
..
MAX
MIN
MAX
MIN V
α is the best value (to MAX) found so far along the current pathIf V is worse (<) than α, MAX will avoid it ⇒ prune that branchDefine β similarly for MIN
27
![Page 27: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/27.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesThe α–β algorithm
α is the best value to MAX up to now for everything that comes above in the gametree. Similar for β and MIN.
28
![Page 28: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/28.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesProperties of α–β
I Pruning does not affect final result
I Good move ordering improves effectiveness of pruning
I With “perfect ordering,” time complexity = O(bm/2)⇒ doubles solvable depth
I if b is relatively small, random orders leads to O(b3m/4)
I Unfortunately, 3550 is still impossible!
29
![Page 29: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/29.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesDeterministic games in practice
I Checkers: Chinook ended 40-year-reign of human world championMarion Tinsley in 1994. Used an endgame database defining perfect playfor all positions involving 8 or fewer pieces on the board, a total of443,748,401,247 positions.
I Kalaha (6,6) solved at IMADA in 2011I Chess: Deep Blue defeated human world champion Gary Kasparov in a
six-game match in 1997. Deep Blue searches 200 million positions persecond, uses very sophisticated evaluation, and undisclosed methods forextending some lines of search up to 40 ply.
I Othello: human champions refuse to compete against computers, whoare too good.
I Go: human champions refuse to compete against computers, who aretoo bad. In go, b > 300, so most programs use pattern knowledge basesto suggest plausible moves.
30
![Page 30: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/30.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesOutline
1. Introduction
2. Minimax
3. α–β Algorithm
4. Stochastic Games
31
![Page 31: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/31.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesStochastic Games
Uncertainty in the result of an action.Examples:
I In solitaire, next card is unknownI In minesweeper, mine locationsI In pacman, the ghosts act
randomlyCan do expectimax search tomaximize average score
I Max nodes as in minimax searchI Chance nodes, like min nodes,
except the outcome is uncertainI Calculate expected utilities I.e.
take weighted average(expectation) of values of children
Note, they can be formalized asMarkov Decision Processes 32
![Page 32: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/32.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesExpectimax Pseudocode
33
![Page 33: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/33.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesDepth-Limited Expectimax
34
![Page 34: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/34.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesDigression: magnitudes matter
For expectimax, we need magnitudes to be meaningful
35
![Page 35: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/35.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesExpectimax-pruning
36
![Page 36: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/36.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesExpectimax for Pacman
I Ghosts are not anymore trying to minimize pacman’s scoreI Instead, they are now a part of the environmentI Pacman has a belief (distribution) over how they will actI World assumptions have impact
Results from playing 5 games
Pacman used depth 4 search with an eval function that avoids troubleGhost used depth 2 search with an eval function that seeks Pacman
37
![Page 37: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/37.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesNondeterministic games: backgammon
1 2 3 4 5 6 7 8 9 10 11 12
24 23 22 21 20 19 18 17 16 15 14 13
0
25
38
![Page 38: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/38.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesNondeterministic games in general
In nondeterministic games, chance introduced by dice, card-shufflingSimplified example with coin-flipping:
MIN
MAX
2
CHANCE
4 7 4 6 0 5 −2
2 4 0 −2
0.5 0.5 0.5 0.5
3 −1
39
![Page 39: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/39.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesAlgorithm for nondeterministic games
Expectiminimax gives perfect playJust like Minimax, except we must also handle chance nodes:. . .if state is a Max node then
return the highest ExpectiMinimax-Value of Successors(state)if state is a Min node then
return the lowest ExpectiMinimax-Value of Successors(state)if state is a chance node then
return average of ExpectiMinimax-Value of Successors(state). . .
40
![Page 40: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/40.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesNondeterministic games in practice
Dice rolls increase b: 21 possible rolls with 2 diceBackgammon ≈ 20 legal moves
depth 4 = 20× (21× 20)3 ≈ 1.2× 109
I As depth increases, probability of reaching a given node shrinks⇒ value of lookahead is diminished
I α–β pruning is much less effective
I Temporal Difference Learning Gammon uses depth-2 search + very goodEval
≈ world-champion level
41
![Page 41: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/41.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesDigression: Exact values DO matter
DICE
MIN
MAX
2 2 3 3 1 1 4 4
2 3 1 4
.9 .1 .9 .1
2.1 1.3
20 20 30 30 1 1 400 400
20 30 1 400
.9 .1 .9 .1
21 40.9
Behaviour is preserved only by positive linear transformation of EvalHence Eval should be proportional to the expected payoff
42
![Page 42: › ~marco › Teaching › AY2011-2012 › ... · Lecture 17 Games and Adversarial SearchLecture 17 Games and Adversarial Search MarcoChiarandini Department of Mathematics & Computer](https://reader031.fdocument.org/reader031/viewer/2022040119/5e5cace6a50702304072c671/html5/thumbnails/42.jpg)
IntroductionMinimaxα–β AlgorithmStochastic GamesGames of imperfect information
I E.g., card games, where opponent’s initial cards are unknown
I Typically we can calculate a probability for each possible deal
I Seems just like having one big dice roll at the beginning of the game∗
I Idea: compute the minimax value of each action in each deal,then choose the action with highest expected value over all deals∗
I Special case: if an action is optimal for all deals, it’s optimal.∗
I GIB, current best bridge program, approximates this idea by1) generating 100 deals consistent with bidding information2) picking the action that wins most tricks on average
43