Lecture 17
Games and Adversarial Search
Marco Chiarandini
Department of Mathematics & Computer Science University of Southern Denmark
Games and Adversarial Search Marco Chiarandini Department of - - PowerPoint PPT Presentation
Lecture 17 Games and Adversarial Search Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Slides by Stuart Russell and Peter Norvig Introduction Minimax Algorithm Course Overview
Department of Mathematics & Computer Science University of Southern Denmark
Introduction Minimax α–β Algorithm Stochastic Games
◮ Games and Adversarial Search
◮ Minimax search and
◮ Multiagent search
◮ Knowledge representation and
◮ Propositional logic ◮ First order logic ◮ Inference ◮ Plannning 2
Introduction Minimax α–β Algorithm Stochastic Games
3
Introduction Minimax α–β Algorithm Stochastic Games
4
Introduction Minimax α–β Algorithm Stochastic Games
◮ cooperative ◮ competitive ➨ adversarial search in games
◮ deterministic/stochastic ◮ turn taking ◮ two players ◮ zero sum games = utility values equal and opposite ◮ perfect/imperfect information ◮ agents are restricted to a small number of actions described by rules
5
Introduction Minimax α–β Algorithm Stochastic Games
6
Introduction Minimax α–β Algorithm Stochastic Games
◮ initial state: root of game tree ◮ successor function: game rules/moves ◮ terminal test (is the game over?) ◮ utility function, gives a value for terminal nodes (eg, +1, -1, 0)
◮ Two players called MAX and MIN. ◮ MAX searches the game tree. ◮ Ply: one turn (every player moves once) from “reply”. [A. Samuel 1959]
7
Introduction Minimax α–β Algorithm Stochastic Games
X X X X X X X X X MAX (X) MIN (O) X X O O O X O O O O O O O MAX (X) X O X O X O X X X X X X X MIN (O) X O X X O X X O X . . . . . . . . . . . . . . . . . . . . . TERMINAL X X −1 +1 Utility
9
Introduction Minimax α–β Algorithm Stochastic Games
◮ state-space complexity: number of legal game positions reachable from
◮ game tree size: total number of possible games that can be played:
10
Introduction Minimax α–β Algorithm Stochastic Games 11
Introduction Minimax α–β Algorithm Stochastic Games
12
Introduction Minimax α–β Algorithm Stochastic Games
13
Introduction Minimax α–β Algorithm Stochastic Games
A 13 A 12 A 11 A 21 A 23 A 22 A 33 A 32 A 31
14
Introduction Minimax α–β Algorithm Stochastic Games
15
Introduction Minimax α–β Algorithm Stochastic Games
16
Introduction Minimax α–β Algorithm Stochastic Games
◮ game-tree complexity: number of leaf nodes in the smallest full-width
◮ computational complexity applies to generalized games
17
Introduction Minimax α–β Algorithm Stochastic Games
◮ Computer considers possible lines of play (Babbage, 1846) ◮ Algorithm for perfect play - MINIMAX - (Zermelo, 1912; Von Neumann,
◮ Finite horizon, approximate evaluation (Zuse, 1945; Wiener, 1948;
◮ First chess program (Turing, 1951) ◮ Machine learning to improve evaluation accuracy (Samuel, 1952–57) ◮ Pruning to allow deeper search - α − β alg. - (McCarthy, 1956)
18
Introduction Minimax α–β Algorithm Stochastic Games
◮ n-ply lookahead: depth-limited search ◮ heuristic descent ◮ heuristic cutoff
19
Introduction Minimax α–β Algorithm Stochastic Games
20
Introduction Minimax α–β Algorithm Stochastic Games
21
Introduction Minimax α–β Algorithm Stochastic Games
22
Introduction Minimax α–β Algorithm Stochastic Games
23
Introduction Minimax α–β Algorithm Stochastic Games
24
Introduction Minimax α–β Algorithm Stochastic Games
25
Introduction Minimax α–β Algorithm Stochastic Games
26
Introduction Minimax α–β Algorithm Stochastic Games
.. .. .. MAX MIN MAX MIN V
27
Introduction Minimax α–β Algorithm Stochastic Games
28
Introduction Minimax α–β Algorithm Stochastic Games
◮ Pruning does not affect final result ◮ Good move ordering improves effectiveness of pruning ◮ With “perfect ordering,” time complexity = O(bm/2)
◮ if b is relatively small, random orders leads to O(b3m/4) ◮ Unfortunately, 3550 is still impossible!
29
Introduction Minimax α–β Algorithm Stochastic Games
◮ Checkers: Chinook ended 40-year-reign of human world champion
◮ Kalaha (6,6) solved at IMADA in 2011 ◮ Chess: Deep Blue defeated human world champion Gary Kasparov in a
◮ Othello: human champions refuse to compete against computers, who
◮ Go: human champions refuse to compete against computers, who are
30
Introduction Minimax α–β Algorithm Stochastic Games
31
Introduction Minimax α–β Algorithm Stochastic Games
◮ In solitaire, next card is unknown ◮ In minesweeper, mine locations ◮ In pacman, the ghosts act
◮ Max nodes as in minimax search ◮ Chance nodes, like min nodes,
◮ Calculate expected utilities I.e.
32
Introduction Minimax α–β Algorithm Stochastic Games
33
Introduction Minimax α–β Algorithm Stochastic Games
34
Introduction Minimax α–β Algorithm Stochastic Games
35
Introduction Minimax α–β Algorithm Stochastic Games
36
Introduction Minimax α–β Algorithm Stochastic Games
◮ Ghosts are not anymore trying to minimize pacman’s score ◮ Instead, they are now a part of the environment ◮ Pacman has a belief (distribution) over how they will act ◮ World assumptions have impact
37
Introduction Minimax α–β Algorithm Stochastic Games
38
Introduction Minimax α–β Algorithm Stochastic Games
39
Introduction Minimax α–β Algorithm Stochastic Games
40
Introduction Minimax α–β Algorithm Stochastic Games
◮ As depth increases, probability of reaching a given node shrinks
◮ α–β pruning is much less effective ◮ Temporal Difference Learning Gammon uses depth-2 search + very good
41
Introduction Minimax α–β Algorithm Stochastic Games
42
Introduction Minimax α–β Algorithm Stochastic Games
◮ E.g., card games, where opponent’s initial cards are unknown ◮ Typically we can calculate a probability for each possible deal ◮ Seems just like having one big dice roll at the beginning of the game∗ ◮ Idea: compute the minimax value of each action in each deal,
◮ Special case: if an action is optimal for all deals, it’s optimal.∗ ◮ GIB, current best bridge program, approximates this idea by
43