http://csiweb.ucd.ie/Staff/acater/comp30260.html Artificial Intelligence for Games and Puzzles - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

http://csiweb.ucd.ie/Staff/acater/comp30260.html Artificial Intelligence for Games and Puzzles

Description:

AlphaBeta cuts off the search of the rest of a node's children if/when it ... [ ref Schaeffer: http://www.cs.ualberta.ca/~jonathan/Courses/657/Notes/7.Windows.pdf ] ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 19
Provided by: csi59
Category:

less

Transcript and Presenter's Notes

Title: http://csiweb.ucd.ie/Staff/acater/comp30260.html Artificial Intelligence for Games and Puzzles


1
Artificially Narrow Alpha Beta
  • AlphaBeta cuts off the search of the rest of a
    nodes children if/when it encounters one child
    whose minimaxed value exceeds ? (hope).
  • Reduced values of ? result in more child nodes
    being cut off.
  • Searching a tree - or any subtree - with a
    narrower window between ? ? will cause more
    cutoffs.
  • The search may be more efficient.
  • But it may no longer return the right answer!

Increased values of ? become reduced values for ?
at the next deeper level So increasing ? results
in more grandchildren being cut off.
2
Aspiration Search - at the root of a tree
  • If you are about to search a tree to some depth
    D,
  • And you have a fair idea Vguess what the minimax
    value is likely to be,
  • (You can use the result of a search to depth D-1)
  • Then you can search with a window Vguess-?,
    Vguess? instead of -?, ?
  • If you are right, you will obtain the true value
    Vtrue with less search.
  • The smaller ? is, the less search you do, but the
    less likely you are right.
  • If you are wrong, and the true value Vtrue
    Vguess-?
  • Fail Low Search again using window -?, Vguess
  • If you are wrong, and the true value Vtrue
    Vguess?
  • Fail High Search again using window Vguess, ?

3
Iterative-Deepening Aspiration Search Algorithm
  • int guess 0, depth 1, delta
    Pick_A_Number()
  • while Resources_Available()
  • int score, alphaguess-delta,
    betaguessdelta
  • score??(alpha,beta,depth)
  • if score beta / Fail High
    /
  • then score ??(score,?,depth)
  • else if score alpha / Fail Low
    /
  • then score ??(-?,score,depth)
  • guessscore
  • depthdepth1
  • return guess

4
Null windows
  • If ? ?1,
  • (and if evaluations return integers not reals),
  • ?? search will always either fail high or fail
    low.
  • Such a search can be thought of as answering the
    boolean question is Vtrue Vguess?
  • Such a search is used in NegaScout / PVS
  • to confirm cheaply that subsequent move choices
    are in fact inferior to the move believed to be
    best
  • but when subsequent moves are not in fact
    inferior, they must be searched again.

5
Negascout / PVS algorithm
  • PVS(?, ?, d) / ?-?, ?? at root node /
  • if d0
  • then return evaluation(?, ?)
  • else mk(1) score-PVS(-?,-?,d-1) unmk(1)
  • if score lt ?
  • then for m from 2 to Move_Count()
  • LBmax(?,score) UBLB1
  • mk(m) temp-PVS(-UB,-LB,d-1)
  • if (tempUB and templt?)
  • then temp-PVS(-?,-temp,d-1)
  • unmk(m)
  • scoremax(score,temp)
  • if temp ? then break
  • return score

6
NegaScout / PVS effect

(?-20, ?30)
-8
-14
-9
-7
-6
Suppose a negamax search of the suppressed
subtrees would give the indicated values for the
child nodes the top node would have value 14
7
NegaScout / PVS effect

(?-20, ?30)
-9
(-30, 20) ? -9
8
NegaScout / PVS effect

(?-20, ?30)
UB9
9
-9
(-30, 20) ? -9
9
NegaScout / PVS effect

(?-20, ?30)
UB9
7
-9
-7
(-30, 20) ? -9
(-10, -9) ? -7
10
NegaScout / PVS effect

(?-20, ?30)
UB9
6
-9
-7
-6
(-30, 20) ? -9
(-10, -9) ? -6
(-10, -9) ? -7
11
NegaScout / PVS effect

(?-20, ?30)
UB9
12
-12
-9
-7
-6
(-30, 20) ? -9
(-10, -9) ? -12
(-10, -9) ? -6
(-10, -9) ? -7
12
NegaScout / PVS effect

(?-20, ?30)
UB9
12
-12
-9
-7
-6
(-30, 20) ? -9
(-10, -9) ? -12
(-10, -9) ? -6
(-10, -9) ? -7
13
NegaScout / PVS effect

(?-20, ?30)
UB9
-9
-7
-6
(-30, 20) ? -9
(-10, -9) ? -12
(-10, -9) ? -6
(-10, -9) ? -7
(-30, 12) ?-14
14
NegaScout / PVS effect

(?-20, ?30)
UB14
14
-14
-9
-7
-6
(-30, 20) ? -9
(-10, -9) ? -12
(-10, -9) ? -6
(-10, -9) ? -7
(-30, 12) ?-14
15
NegaScout / PVS effect

(?-20, ?30)
UB14
8
-8
-12
-9
-7
-6
(-30, 20) ? -9
(-15, -14) ? -8
(-10, -9) ? -12
(-10, -9) ? -6
(-10, -9) ? -7
(-30, 12) ?-14
16
The SCOUT algorithm
  • Takes to an extreme the idea that minimal-window
    ?? searches are cheap
  • Replaces general ?? with a divide-and-conquer
    approach
  • First guess midway in range of possible values -
    say -512,512
  • Guess 0, use window 0,1
  • A result of say 24 means only that the true
    result exceeds 0
  • Try again, with window 256,257
  • A result of say 24 means only that the true
    result is no more than 256
  • Try again, window 128,129
  • and so on, cutting range in half each time,
  • eventually finding the N such that value gt N-1
    value N

17
MTD(f) Algorithm
  • Scouts divide-and-conquer approach does not take
    advantage of the result of a previous
    iterative-deepening search to make a good 1st
    guess.
  • MTD(f) does, then creeps toward correct answer.
  • score0 d0
  • while resources permit,
  • dd1 LB-? UB?
  • while LB lt UB
  • if score LB
  • then windowscore
  • else windowscore-1
  • score??(window,window1,d)
  • if score lt window
  • then UBscore
  • else LBscore
  • return score

18
Reflection on ?? variants
  • Aspiration Search, NegaScout, Scout, MTD(f)
  • All these variations on ?? may involve repeating
    searches with different choices for ? and ?.
  • This can make savings,
  • but probably only if a transposition table is
    also used, to allow results of previous partial
    searches to be reused.
  • For chess, MTD(f) seems to need on average 3 - 5
    iterations to converge, and saves 5-15 in terms
    of number of nodes generated. ref Schaeffer
  • http//www.cs.ualberta.ca/jonathan/Courses/657/N
    otes/7.Windows.pdf
  • ?? is fundamentally a depth-first tree search
    algorithm.
  • Iterative Deepening gives an effect rather like
    breadth-first search.
Write a Comment
User Comments (0)
About PowerShow.com