foundations of artificial intelligence
play

Foundations of Artificial Intelligence 42. Board Games: Alpha-Beta - PowerPoint PPT Presentation

Foundations of Artificial Intelligence 42. Board Games: Alpha-Beta Search Malte Helmert and Thomas Keller University of Basel May 13, 2020 Alpha-Beta Search Move Ordering Summary Board Games: Overview chapter overview: 40. Introduction and


  1. Foundations of Artificial Intelligence 42. Board Games: Alpha-Beta Search Malte Helmert and Thomas Keller University of Basel May 13, 2020

  2. Alpha-Beta Search Move Ordering Summary Board Games: Overview chapter overview: 40. Introduction and State of the Art 41. Minimax Search and Evaluation Functions 42. Alpha-Beta Search 43. Monte-Carlo Tree Search: Introduction 44. Monte-Carlo Tree Search: Advanced Topics 45. AlphaGo and Outlook

  3. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search

  4. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search MAX 3 A 1 A 2 A 3 MIN 3 2 2 A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 4 6 14 5 2 Can we save search effort? We do not need to consider all the nodes!

  5. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search MAX 3 A 1 A 2 A 3 MIN 3 2 2 A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 4 6 14 5 2 Can we save search effort? We do not need to consider all the nodes! MAX 3 A 1 A 2 A 3 ≤ 2 MIN 3 2 A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  6. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Generally Player Opponent m .. .. .. Player Opponent n If m > n , then node with utility n will never be reached when playing perfectly!

  7. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Idea idea: Use two values α and β during minimax depth-first search, such that the following holds for every recursive call: If the utility value in the current subtree is ≤ α , then the subtree is not interesting because MAX will never enter it when playing perfectly. If the utility value in the current subtree is ≥ β , then the subtree is not interesting because MIN will never enter it when playing perfectly. If α ≥ β in the subtree, then the subtree is not interesting and does not have to be searched further ( α - β pruning). Starting with α = −∞ and β = + ∞ , alpha-beta search produces the identical result as minimax, with lower seach effort.

  8. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Idea idea: Use two values α and β during minimax depth-first search, such that the following holds for every recursive call: If the utility value in the current subtree is ≤ α , then the subtree is not interesting because MAX will never enter it when playing perfectly. If the utility value in the current subtree is ≥ β , then the subtree is not interesting because MIN will never enter it when playing perfectly. If α ≥ β in the subtree, then the subtree is not interesting and does not have to be searched further ( α - β pruning). Starting with α = −∞ and β = + ∞ , alpha-beta search produces the identical result as minimax, with lower seach effort.

  9. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Idea idea: Use two values α and β during minimax depth-first search, such that the following holds for every recursive call: If the utility value in the current subtree is ≤ α , then the subtree is not interesting because MAX will never enter it when playing perfectly. If the utility value in the current subtree is ≥ β , then the subtree is not interesting because MIN will never enter it when playing perfectly. If α ≥ β in the subtree, then the subtree is not interesting and does not have to be searched further ( α - β pruning). Starting with α = −∞ and β = + ∞ , alpha-beta search produces the identical result as minimax, with lower seach effort.

  10. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Idea idea: Use two values α and β during minimax depth-first search, such that the following holds for every recursive call: If the utility value in the current subtree is ≤ α , then the subtree is not interesting because MAX will never enter it when playing perfectly. If the utility value in the current subtree is ≥ β , then the subtree is not interesting because MIN will never enter it when playing perfectly. If α ≥ β in the subtree, then the subtree is not interesting and does not have to be searched further ( α - β pruning). Starting with α = −∞ and β = + ∞ , alpha-beta search produces the identical result as minimax, with lower seach effort.

  11. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Pseudo Code algorithm skeleton the same as minimax function signature extended by two variables α and β function alpha-beta-main( p ) � v , move � := alpha-beta( p , −∞ , + ∞ ) return move

  12. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Pseudo-Code function alpha-beta( p , α, β ) if p is terminal position: return � u ( p ) , none � initialize v and best move [as in minimax] for each � move , p ′ � ∈ succ( p ): � v ′ , best move ′ � := alpha-beta ( p ′ , α, β ) update v and best move [as in minimax] if player ( p ) = MAX: if v ≥ β : return � v , none � α := max { α, v } if player ( p ) = MIN: if v ≤ α : return � v , none � β := min { β, v } return � v , best move �

  13. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example −∞ , [ −∞ , ∞ ] MAX A 1 A 2 A 3 MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  14. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example −∞ , [ −∞ , ∞ ] MAX A 1 A 2 A 3 ∞ , [ −∞ , ∞ ] MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  15. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example −∞ , [ −∞ , ∞ ] MAX A 1 A 2 A 3 3 , [ −∞ , 3] MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  16. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example −∞ , [ −∞ , ∞ ] MAX A 1 A 2 A 3 3 , [ −∞ , 3] MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  17. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example −∞ , [ −∞ , ∞ ] MAX A 1 A 2 A 3 3 , [ −∞ , 3] MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  18. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example 3 , [3 , ∞ ] MAX A 1 A 2 A 3 3 , [ −∞ , 3] MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  19. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example 3 , [3 , ∞ ] MAX A 1 A 2 A 3 3 , [ −∞ , 3] ∞ , [3 , ∞ ] MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  20. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example 3 , [3 , ∞ ] MAX A 1 A 2 A 3 3 , [ −∞ , 3] 2 , [3 , ∞ ] MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  21. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example 3 , [3 , ∞ ] MAX A 1 A 2 A 3 3 , [ −∞ , 3] 2 , [3 , ∞ ] ∞ , [3 , ∞ ] MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  22. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example 3 , [3 , ∞ ] MAX A 1 A 2 A 3 3 , [ −∞ , 3] 2 , [3 , ∞ ] 14 , [3 , 14] MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  23. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example 3 , [3 , ∞ ] MAX A 1 A 2 A 3 3 , [ −∞ , 3] 2 , [3 , ∞ ] 5 , [3 , 5] MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  24. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example 3 , [3 , ∞ ] MAX A 1 A 2 A 3 3 , [ −∞ , 3] 2 , [3 , ∞ ] 2 , [3 , 5] MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2

  25. Alpha-Beta Search Move Ordering Summary Move Ordering

  26. Alpha-Beta Search Move Ordering Summary Alpha-Beta Search: Example 3 , [3 , ∞ ] MAX A 1 A 2 A 3 3 , [ −∞ , 3] 2 , [3 , ∞ ] 2 , [3 , 5] MIN A 11 A 13 A 21 A 23 A 31 A 33 A 12 A 22 A 32 3 12 8 2 14 5 2 If the last successor had been first, the rest of the subtree would have been pruned.

  27. Alpha-Beta Search Move Ordering Summary Move Ordering idea: consider first the successors that are likely to be best. Domain-specific ordering function e.g. chess: captures < threats < forward moves < backward moves Dynamic move-ordering try first moves that have been good in the past e.g. in iterative deepening search: best moves from previous iteration

  28. Alpha-Beta Search Move Ordering Summary How Much Do We Gain with Alpha-Beta Search? assumption: uniform game tree, depth d , branching factor b ≥ 2; assumption: MAX and MIN positions alternating perfect move ordering best move at every position is considered first (this cannot be done in practice – Why?) maximizing move for MAX, minimizing move for MIN effort reduced from O ( b d ) (minimax) to O ( b d / 2 ) doubles the search depth that can be achieved in same time random move ordering effort still reduced to O ( b 3 d / 4 ) (for moderate b ) In practice, it is often possible to get close to the optimum.

  29. Alpha-Beta Search Move Ordering Summary Summary

  30. Alpha-Beta Search Move Ordering Summary Summary alpha-beta search stores which utility both players can force somewhere else in the game tree exploits this information to avoid unnecessary computations can have significantly lower search effort than minimax best case: search twice as deep in the same time

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend