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

foundations of artificial intelligence
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Foundations of Artificial Intelligence

  • 42. Board Games: Alpha-Beta Search

Malte Helmert and Thomas Keller

University of Basel

May 13, 2020

slide-2
SLIDE 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
slide-3
SLIDE 3

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search

slide-4
SLIDE 4

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 4 6 14 5 2 MAX MIN 3 2 2 3

Can we save search effort? We do not need to consider all the nodes!

slide-5
SLIDE 5

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 4 6 14 5 2 MAX MIN 3 2 2 3

Can we save search effort? We do not need to consider all the nodes!

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN 3 ≤ 2 2 3

slide-6
SLIDE 6

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Generally

Player Opponent Player Opponent .. .. .. m n

If m > n, then node with utility n will never be reached when playing perfectly!

slide-7
SLIDE 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.

slide-8
SLIDE 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.

slide-9
SLIDE 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.

slide-10
SLIDE 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.

slide-11
SLIDE 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

slide-12
SLIDE 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

slide-13
SLIDE 13

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN −∞, [−∞, ∞]

slide-14
SLIDE 14

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN ∞, [−∞, ∞] −∞, [−∞, ∞]

slide-15
SLIDE 15

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN 3, [−∞, 3] −∞, [−∞, ∞]

slide-16
SLIDE 16

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN 3, [−∞, 3] −∞, [−∞, ∞]

slide-17
SLIDE 17

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN 3, [−∞, 3] −∞, [−∞, ∞]

slide-18
SLIDE 18

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN 3, [−∞, 3] 3, [3, ∞]

slide-19
SLIDE 19

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN 3, [−∞, 3] ∞, [3, ∞] 3, [3, ∞]

slide-20
SLIDE 20

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN 3, [−∞, 3] 2, [3, ∞] 3, [3, ∞]

slide-21
SLIDE 21

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN 3, [−∞, 3] 2, [3, ∞] ∞, [3, ∞] 3, [3, ∞]

slide-22
SLIDE 22

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN 3, [−∞, 3] 2, [3, ∞] 14, [3, 14] 3, [3, ∞]

slide-23
SLIDE 23

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN 3, [−∞, 3] 2, [3, ∞] 5, [3, 5] 3, [3, ∞]

slide-24
SLIDE 24

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN 3, [−∞, 3] 2, [3, ∞] 2, [3, 5] 3, [3, ∞]

slide-25
SLIDE 25

Alpha-Beta Search Move Ordering Summary

Move Ordering

slide-26
SLIDE 26

Alpha-Beta Search Move Ordering Summary

Alpha-Beta Search: Example

A11 A12 A13 A1 A21 A22 A23 A2 A31 A32 A33 A3

3 12 8 2 14 5 2 MAX MIN 3, [−∞, 3] 2, [3, ∞] 2, [3, 5] 3, [3, ∞] If the last successor had been first, the rest of the subtree would have been pruned.

slide-27
SLIDE 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

slide-28
SLIDE 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(bd) (minimax) to O(bd/2) doubles the search depth that can be achieved in same time

random move ordering

effort still reduced to O(b3d/4) (for moderate b)

In practice, it is often possible to get close to the optimum.

slide-29
SLIDE 29

Alpha-Beta Search Move Ordering Summary

Summary

slide-30
SLIDE 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