Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4486377
  • 博文数量: 192
  • 博客积分: 10014
  • 博客等级: 上将
  • 技术积分: 8232
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-21 00:22
文章分类

全部博文(192)

文章存档

2011年(4)

2009年(14)

2008年(174)

我的朋友

分类:

2008-06-09 23:15:51

Alpha-beta pruning

From Wikipedia, the free encyclopedia

Alpha-beta pruning is a which seeks to reduce the number of nodes that are evaluated in the by the . It is a search with adversary algorithm used commonly for machine playing of two-player games (, , , etc.). It stops completely evaluating a move when at least one possibility has been found that proves the move to be worse than a previously examined move. Such moves need not be evaluated further. Alpha-beta pruning is a sound optimization in that it does not change the result of the algorithm it optimizes.

History

and who used what calls an "approximation" in 1958 wrote that alpha-beta "appears to have been reinvented a number of times". had an early version and Richards, Hart, Levine and/or Edwards found alpha-beta independently in the .[] McCarthy proposed similar ideas during the in 1956 and suggested it to a group of his students including at MIT in 1961. independently discovered the alpha-beta algorithm, publishing his results in 1963. and Ronald W. Moore refined the algorithm In 1975 and it continued to be advanced.

Improvements over naive minimax

The benefit of alpha-beta pruning lies in the fact that branches of the search tree can be eliminated. The search time can in this way be limited to the 'more promising' subtree, and a deeper search can be performed in the same time. Like its predecessor, it belongs to the class of algorithms. The optimization reduces the effective depth to slightly more than half that of simple minimax if the nodes are evaluated in an optimal or near optimal order (best choice for side on move ordered first at each node).

With an (average or constant) of b, and a search depth of d , the maximum number of leaf node positions evaluated (when the move ordering is pessimal) is (b*b*...*b) = O(bd) – the same as a simple minimax search. If the move ordering for the search is optimal (meaning the best moves always searched first), the number of positions searched is about O(b*1*b*1*...*b) for odd depth and O(b*1*b*1*...*1) for even depth, or

 In the latter case, the effective branching factor is reduced to its , or, equivalently, the search can go twice as deep with the same amount of computation. The explanation of b*1*b*1*... is that all the first player's moves must be studied to find the best one, but for each, only the best second player's move is needed to refute all but the first (and best) first player move – alpha-beta ensures no other second player moves need be considered. If b=40 (as in chess), and the search depth is 12 ply, the ratio between optimal and pessimal sorting is a factor of nearly 406 or about 4 times.

Normally during alpha-beta, the subtrees are temporarily dominated by either a first player advantage (when many first player moves are good, and at each search depth the first move checked by the first player is adequate, but all second player responses are required to try and find a refutation), or vice versa. This advantage can switch sides many times during the search if the move ordering is incorrect, each time leading to inefficiency. As the number of positions searched decreases exponentially each move nearer the current position, it is worth spending considerable effort on sorting early moves. An improved sort at any depth will exponentially reduce the total number of positions searched, but sorting all positions at depths near the root node is relatively cheap as there are so few of them. In practice, the move ordering is often determined by the results of earlier, smaller searches, such as through .

The algorithm maintains two values, alpha and beta, which represent the minimum score that the maximizing player is assured of and the maximum score that the minimizing player is assured of respectively. Initially alpha is negative infinity and beta is positive infinity. As the recursion progresses the "window" becomes smaller. When beta becomes less than alpha, it means that the current position cannot be the result of best play by both players and hence need not be explored further.

function alphabeta(node, depth, α, β)         
    (* β represents previous player best choice - doesn't want it if α would worsen it *)
    if node is a terminal node or depth = 0
        return the heuristic value of node
    foreach child of node
        α := max(α, -alphabeta(child, depth-1, -β, -α))     
        (* use symmetry, -β becomes subsequently pruned α *)
        if β≤α
            break                             (* Beta cut-off *)
    return α
Heuristic improvements

Further improvement can be achieved without sacrificing accuracy, by using ordering to search parts of the tree that are likely to force alpha-beta cutoffs early. For example, in chess, moves that take pieces may be examined before moves that do not, or moves that have scored highly in through the game-tree analysis may be evaluated before others. Another common, and very cheap, heuristic is the , where the last move that caused a beta-cutoff at the same level in the tree search is always examined first. This idea can be generalized into a set of .

Alpha-beta search can be made even faster by considering only a narrow search window (generally determined by guesswork based on experience). This is known as aspiration search. In the extreme case, the search is performed with alpha and beta equal; a technique known as zero-window search, null-window search, or scout search. This is particularly useful for win/loss searches near the end of a game where the extra depth gained from the narrow window and a simple win/loss evaluation function may lead to a conclusive result. If an aspiration search fails, it is straightforward to detect whether it failed high (high edge of window was too low) or low (lower edge of window was too high). This gives information about what window values might be useful in a re-search of the position.

 

Other algorithms

More advanced algorithms that are even faster while still being able to compute the exact minimax value are known, such as and .

Since the minimax algorithm and its variants are inherently , a strategy such as is usually used in conjunction with alpha-beta so that a reasonably good move can be returned even if the algorithm is interrupted before it has finished execution. Another advantage of using iterative deepening is that searches at shallower depths give move-ordering hints that can help produce cutoffs for higher depth searches much earlier than would otherwise be possible.

Algorithms like , on the other hand, use the strategy. This can potentially make them more time-efficient, but typically at a heavy cost in space-efficiency.[]

 

References

  1. McCarthy, John (LaTeX2HTML ). . Retrieved on -.
  2. Newell, Allen and Herbert A. Simon (March 1976). "". Communications of the ACM, Vol. 19, No. 3. 
  3. Richards, D.J. and Hart, T.P. ( to ). . Massachusetts Institute of Technology. Retrieved on -.
  4. Kotok, Alan (XHTML ). . Retrieved on -.
  5. (May 1987). 159-171. J. Wiley & Sons. Retrieved on -.
  6. * Knuth, D. E., and Moore, R. W. (1975). "An Analysis of Alpha-Beta Pruning". Artificial Intelligence Vol. 6, No. 4: 293-326. 
  7. Abramson, Bruce (June 1989). "". ACM Computing Surveys, Vol. 21, No. 2. 
  8. & (2003), (2nd ed.), Upper Saddle River, NJ: Prentice Hall, , <> 

External links

阅读(2626) | 评论(0) | 转发(0) |
0

上一篇:Lucene Field

下一篇:人工智能资源

给主人留下些什么吧!~~