properties of
play

Properties of - //the leaf node (terminal state) ) 9 ( The - - PowerPoint PPT Presentation

G Game Playing Pl i - Pruning Pruning Introduction to Artificial Intelligence Hadi Moradi 1 2. - pruning: search cutoff Pruning: eliminating a branch of the search tree from consideration without exhaustive examination


  1. G Game Playing Pl i α - β Pruning α β Pruning Introduction to Artificial Intelligence Hadi Moradi 1

  2. 2. α - β pruning: search cutoff � Pruning: eliminating a branch of the search tree from consideration without exhaustive examination of each node � Does it work? � Yes, it roughly cuts the branching factor from b to √ b resulting in double as far look-ahead than pure minimax l i i d bl f l k h d h i i 2

  3. α - β pruning: example ≥ 6 MAX MIN 6 6 12 8 3

  4. α - β pruning: example ≥ 6 MAX ≤ 2 MIN 6 6 12 8 2 4

  5. α - β pruning: example ≥ 6 MAX ≤ 5 ≤ 2 MIN 6 6 12 8 2 5 5

  6. 6 ≤ 5 ≤ 5 5 5 α - β pruning: example ≥ 6 ≤ 2 ≤ 2 2 2 Selected move 8 8 6 6 12 12 6 6 MAX MIN

  7. α - β pruning: general principle Player α = 6 m 6 Opponent Opponent If α > v then MAX will chose m so prune tree under n Similar for β for MIN β Player n Opponent v = 2 7

  8. 8 Properties of α - β

  9. //the leaf node (terminal state) ) 9 ( The α - β algorithm

  10. //the leaf node (terminal state) 10 The α - β algorithm (cont.)

  11. Remember Minimax: Recursive implementation p Time complexity: O(b m ) Complete: Yes, for finite state-space Space complexity: O(bm) (= DFS Optimal: Yes 11 Does not keep all nodes in memory.)

  12. More on the α - β algorithm: start from Minimax t t f Mi i 12

  13. The α - β algorithm Note: These are both Local variables. At the Start of the algorithm, We initialize them to l h α = - ∞ and β = + ∞ 13

  14. A Walk Through Example p α : Best choice so far for MAX α : Best choice so far for MAX β : Best choice so far for MIN α = - ∞ MAX β β = + ∞ + MIN … MAX 5 10 4 2 8 7 14

  15. In Max-Value: α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ V= - ∞ Max-Value loops over these MIN … MAX 5 5 10 4 2 8 7 10 4 2 8 7 15

  16. In Max-Value: α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ v= - ∞ α = - ∞ MIN β = + ∞ … MAX 5 5 10 4 2 8 7 10 4 2 8 7 16

  17. In Min-Value: α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ v= - ∞ α = - ∞ MIN β = + ∞ … v= + ∞ v= + ∞ MAX 5 5 10 4 2 8 7 10 4 2 8 7 17

  18. In Min-Value: α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ v= - ∞ α = - ∞ MIN β = + ∞ … v= + ∞ v= + ∞ Min-Value loops over these MAX 5 5 10 4 2 8 7 10 4 2 8 7 18

  19. α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ v= - ∞ α = - ∞ β = + ∞ MIN … v= + ∞ α = - ∞ β = + ∞ MAX 5 5 10 4 2 8 7 10 4 2 8 7 Utility(state) =5 19

  20. In Min-Value: α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ v= - ∞ α = - ∞ MIN β = + ∞ … v= 5 v= 5 MAX 5 5 10 4 2 8 7 10 4 2 8 7 20

  21. In Min-Value: α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ α = - ∞ MIN β = 5 … v= 5 v= 5 MAX 5 5 10 4 2 8 7 10 4 2 8 7 21

  22. In Min-Value: α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ α = - ∞ β = 5 MIN … v= 5 α = - ∞ β = 5 v= 5 MAX 5 5 10 4 2 8 7 10 4 2 8 7 22

  23. α : Best choice so far for MAX β : Best choice so far for MIN α = - ∞ MAX β = + ∞ v= - ∞ α = - ∞ β = 5 MIN … v= 5 α = - ∞ β = 5 MAX 5 5 10 4 2 8 7 10 4 2 8 7 Utility(state) =10 23

  24. In Min-Value: α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ α = - ∞ β = 5 MIN … v= 5 <10 MAX 5 5 10 4 2 8 7 10 4 2 8 7 24

  25. α : Best choice so far for MAX β : Best choice so far for MIN α = - ∞ MAX β = + ∞ v= - ∞ α = - ∞ β = 5 MIN … v= 5 α = - ∞ β = 5 MAX 5 5 10 4 2 8 7 10 4 2 8 7 Utility(state) =4 25

  26. In Min-Value: α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ v= - ∞ α = - ∞ β = 5 MIN … v= 5 >4 MAX 5 5 10 4 2 8 7 10 4 2 8 7 26

  27. In Min-Value: α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ v= - ∞ α = - ∞ β = 5 MIN … v= 4 MAX 5 5 10 4 2 8 7 10 4 2 8 7 27

  28. In Min-Value: α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ v= - ∞ α = - ∞ β = 4 MIN … v= 4 MAX 5 5 10 4 2 8 7 10 4 2 8 7 28

  29. α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ v= 4 MIN … MAX 5 5 10 4 2 8 7 10 4 2 8 7 29

  30. α : Best choice so far for MAX β : Best choice so far for MIN β α = 4 MAX β = + ∞ v= 4 MIN … MAX 5 5 10 4 2 8 7 10 4 2 8 7 30

  31. In Max-Value: α : Best choice so far for MAX β : Best choice so far for MIN β α = - ∞ MAX β = + ∞ v= - ∞ α = 4 β = + ∞ MIN … v= 4 MAX 5 5 10 4 2 8 7 10 4 2 8 7 31

  32. α : Best choice so far for MAX β β : Best choice so far for MIN α = - ∞ MAX β = + ∞ v= - ∞ α = 4 β = + ∞ MIN … v= + ∞ MAX 5 5 10 4 2 8 7 10 4 2 8 7 32

  33. α : Best choice so far for MAX β β : Best choice so far for MIN α = - ∞ MAX β = + ∞ v= - ∞ MIN … MAX 5 10 4 2 8 7 5 10 4 2 8 7 α = 4 4 β = + ∞ v= + ∞ 33

  34. α : Best choice so far for MAX β β : Best choice so far for MIN α = - ∞ MAX β = + ∞ v= - ∞ MIN … MAX 5 10 4 2 8 7 5 10 4 2 8 7 α = 4 4 β = + ∞ 34

  35. α : Best choice so far for MAX β β : Best choice so far for MIN α = - ∞ MAX β = + ∞ v= - ∞ α = 4 β = + ∞ MIN … v= 2 MAX 5 5 10 4 2 8 7 10 4 2 8 7 35

  36. α : Best choice so far for MAX β β : Best choice so far for MIN α = - ∞ MAX β = + ∞ v= - ∞ α = 4 β = + ∞ MIN … v= 2 MAX 5 5 10 4 2 8 7 10 4 2 8 7 36

  37. α : Best choice so far for MAX β : Best choice so far for MIN β α = 4 MAX β = + ∞ v= 4 >2 MIN … MAX 5 5 10 4 2 8 7 10 4 2 8 7 37

  38. Another way to understand the algorithm � From: http://yoda.cis.temple.edu:8080/UGAIWWW/lectures95/se arch/alpha-beta.html h/ l h b t ht l � For a given node N, α is the value of N to MAX β is the value of N to MIN 38

  39. Alpha/Beta pruning - example (4) A move (max) B move (min) A move (max) 8 8 7 3 9 1 6 2 4 1 1 3 5 3 9 2 6 5 2 1 2 3 7 3 9 1 6 2 4 1 1 3 5 3 9 2 6 5 2 1 2 3 9 9 7 2 7 2 39

  40. Alpha/Beta pruning - example (4) A move (max) B move (min) A move (max) 8 8 7 3 9 1 6 2 4 1 1 3 5 3 9 2 6 5 2 1 2 3 7 3 9 1 6 2 4 1 1 3 5 3 9 2 6 5 2 1 2 3 9 9 7 2 7 2 40

  41. 41 deterministic games State-of-the-art for

  42. Chess As An Example � Chess basics Ch b i � 8x8 board, 16 pieces per side, average branching factor of 38 factor of 38 � Rating system based on competition � 500 --- beginner/legal � 1200 --- good weekend warrier � 2000 --- world championship level � 2500+ --- grand master 2500 grand master � time limited moves � important aspects: position, material 42

  43. Sketch of Chess History � First discussed by Shannon, Sci. American, 1950 � Initially, two approaches � human-like � brute force search � 1966 MacHack ---1100 --- average tournament player � 1970’s � discovery that 1 ply = 200 rating points � hash tables � quiescence search 43

Recommend


More recommend