Download presentation

Presentation is loading. Please wait.

Published byMae Fields Modified over 2 years ago

1
Adversarial Search CSE 473 University of Washington

2
© D. Weld, D. Fox 2 Contents Board Games Minimax Search Alpha-Beta Search Games with an Element of Chance

3
© D. Weld, D. Fox 3 Games Overview chess, checkers, go, othello backgammon, monopoly bridge, poker, scrabble Imperfect information Perfect information deterministic chance

4
© D. Weld, D. Fox 4 Games & Game Theory When there is more than one agent, the future is not anymore easily predictable for the agent In competitive environments (conflicting goals), adversarial search becomes necessary In AI, we usually consider special type of games: board games, which can be characterized as deterministic, turn-taking, two-player, zero-sum games with perfect information

5
© D. Weld, D. Fox 5 Games as Search Components: States: Initial state: Successor function: Terminal test: Utility function:

6
© D. Weld, D. Fox 6 Games as Search Components: States: board configurations Initial state: the board position and which player will move Successor function: returns list of (move, state) pairs, each indicating a legal move and the resulting state Terminal test: determines when the game is over Utility function: gives a numeric value in terminal states (eg, -1, 0, +1 in chess for loss, tie, win)

7
© D. Weld, D. Fox 7 Games as Search Components: States: board configurations Initial state: the board position and which player will move Successor function: returns list of (move, state) pairs, each indicating a legal move and the resulting state Terminal test: determines when the game is over Utility function: gives a numeric value in terminal states (eg, -1, 0, +1 in chess for loss, tie, win) Convention: first player is MAX, 2nd player is MIN State utility values from MAX’s perspective Initial state and legal moves define the game tree

8
© D. Weld, D. Fox 8 Tic-Tac-Toe Example

9
© D. Weld, D. Fox 9

10
10

11
© D. Weld, D. Fox 11

12
© D. Weld, D. Fox 12

13
© D. Weld, D. Fox 13

14
© D. Weld, D. Fox 14

15
© D. Weld, D. Fox 15

16
© D. Weld, D. Fox 16

17
© D. Weld, D. Fox 17 Properties of minimax Complete? Optimal? Time complexity? Space complexity?

18
© D. Weld, D. Fox 18 Properties of minimax Complete? Yes (if tree is finite) Optimal? Yes (against an optimal opponent) Time complexity? O(b m ) Space complexity? O(bm) (depth-first exploration)

19
© D. Weld, D. Fox 19 Good enough? Chess: branching factor b≈35 game length m≈100 search space b m ≈ 35 100 ≈ 10 154 The Universe: number of atoms ≈ 10 78 age ≈ 10 21 milliseconds

20
© D. Weld, D. Fox 20 Alpha-Beta Pruning

21
© D. Weld, D. Fox 21

22
© D. Weld, D. Fox 22

23
© D. Weld, D. Fox 23

24
© D. Weld, D. Fox 24

25
© D. Weld, D. Fox 25

26
© D. Weld, D. Fox 26 Alpha-Beta MaxVal(state, alpha, beta){ if (terminal(state)) return utility(state); for (s in successors(state)){ child = MinVal(s,alpha,beta); alpha = max(alpha,child); if (alpha>=beta) return child; } return alpha; } alpha = the highest (best) value for MAX along path beta = the lowest (best) value for MIN along path

27
© D. Weld, D. Fox 27 Alpha-Beta MinVal(state, alpha, beta){ if (terminal(state)) return utility(state); for (s in successors(state)){ child = MaxVal(s,alpha,beta); beta = min(beta,child); if (beta <=alpha) return child; } return beta; } alpha = the highest (best) value for MAX along path beta = the lowest (best) value for MIN along path

28
© D. Weld, D. Fox 28

29
© D. Weld, D. Fox 29

30
© D. Weld, D. Fox 30

31
© D. Weld, D. Fox 31

32
© D. Weld, D. Fox 32

33
© D. Weld, D. Fox 33

34
© D. Weld, D. Fox 34

35
© D. Weld, D. Fox 35

36
© D. Weld, D. Fox 36

37
© D. Weld, D. Fox 37

38
© D. Weld, D. Fox 38 Properties of α-β Still optimal, pruning does not affect final result Good move ordering improves effectiveness of pruning With "perfect ordering," time complexity = O(b m/2 ) doubles depth of search A simple example of the value of reasoning about which computations are relevant (a form of metareasoning)

39
© D. Weld, D. Fox 39 Good enough? Chess: branching factor b≈35 game length m≈100 search space b m/2 ≈ 35 50 ≈ 10 77 The Universe: number of atoms ≈ 10 78 age ≈ 10 21 milliseconds

40
© D. Weld, D. Fox 40 Partial State Spaces Strategies: search to a fixed depth iterative deepening (most common) stop only at ‘quiescent’ nodes

41
© D. Weld, D. Fox 41

42
© D. Weld, D. Fox 42 Evaluation Function When search space is too large, create game tree up to a certain depth only. Art is to evaluate positions that are not terminal states. Example of simple evaluation criteria in chess: Material worth: pawn=1, knight =3, rook=5, queen=9. Other: king safety, good pawn structure Rule of thumb: 3-point advantage = certain victory eval(s) = w1 * material(s) + w2 * mobility(s) + w3 * king safety(s) + w4 * center control(s) +...

43
© D. Weld, D. Fox 43 Cutting off search Does it work in practice? b m = 10 6, b=35 m=4 4-ply lookahead is a hopeless chess player! 4-ply ≈ human novice 8-ply ≈ typical PC, human master 12-ply ≈ Deep Blue, Kasparov

44
© D. Weld, D. Fox 44 Transposition Tables Game trees contain repeated states In chess, e.g., the game tree may have 35 100 nodes, but there are only 10 40 different board positions Similar to closed list in search, maintain a transposition table Got its name from the fact that the same state is reached by a transposition of moves.

45
© D. Weld, D. Fox 45 Game Playing in Practice Checkers: Chinook ended 40 year reign of human world champion Marion Tinsley in 1994; used an endgame database defining perfect play for all positions involving 8 or fewer pieces on the board, a total of 443,748,401,247 positions (!) Chess: Deep Blue defeated human world champion Gary Kasparov in a 6 game match in 1997. Deep Blue searches 200 million positions per second, uses very sophisticated evaluation, and undisclosed methods for extending some lines of search up to 40 ply Othello: human champions refuse to play against computers because software is too good Go: human champions refuse to play against computers because software is too bad

46
© D. Weld, D. Fox 46 Summary of Deterministic Games Basic idea: minimax -- too slow for most games Alpha-Beta pruning can increase max depth by factor up to 2 Limited depth search may be necessary Static evaluation functions necessary for limited depth search and help alpha-beta Opening game and End game databases can help Computers can beat humans in some games (checkers, chess, othello) but not in others (Go)

47
© D. Weld, D. Fox 47 Other Games chess, checkers, go, othello backgammon, monopoly bridge, poker, scrabble Imperfect information Perfect information deterministic chance

48
© D. Weld, D. Fox 48 Games that Include an Element of Chance White has just rolled 6-5 and has 4 legal moves.

49
© D. Weld, D. Fox 49 Game Tree for Games with an Element of Chance In addition to MIN- and MAX nodes, we need chance nodes (e.g., for rolling dice). Search costs increase: Instead of O(b d ), we get O((bn) d ), where n is the number of chance outcomes.

50
© D. Weld, D. Fox 50 Imperfect Information E.g. card games, where opponents’ initial cards are unknown Idea: For all deals consistent with what you can see compute the minimax value of available actions for each of possible deals compute the expected value over all deals

Similar presentations

OK

Introduction to Artificial Intelligence CS 438 Spring 2008 Today –AIMA, Ch. 6 –Adversarial Search Thursday –AIMA, Ch. 6 –More Adversarial Search The “Luke.

Introduction to Artificial Intelligence CS 438 Spring 2008 Today –AIMA, Ch. 6 –Adversarial Search Thursday –AIMA, Ch. 6 –More Adversarial Search The “Luke.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on adr and gdr Ppt on paintings and photographs related to colonial period lighting Ppt on content addressable memory test File type-ppt on cybercrime Single room earth view ppt on mac Ppt on interchange of sentences for kids Ppt on limits and continuity in higher Ppt on index numbers in statistics Ppt on campus recruitment systems Ppt on singapore stock exchange