How do you derive the time complexity of alpha-beta pruning?

后端 未结 1 1995
醉酒成梦
醉酒成梦 2021-02-06 05:03

I understand the basics of minimax and alpha-beta pruning. In all the literature, they talk about the time complexity for the best case is O(b^(d/2)) where b = branching factor

相关标签:
1条回答
  • 2021-02-06 05:35

    O(b^(d/2)) correspond to the best case time complexity of alpha-beta pruning. Explanation:

    With an (average or constant) branching factor of b, and a search depth of d plies, the maximum number of leaf node positions evaluated (when the move ordering is pessimal) is O(bb...*b) = O(b^d) – the same as a simple minimax search. If the move ordering for the search is optimal (meaning the best moves are always searched first), the number of leaf node positions evaluated is about O(b*1*b*1*...*b) for odd depth and O(b*1*b*1*...*1) for even depth, or O(b^(d/2)). In the latter case, where the ply of a search is even, the effective branching factor is reduced to its square root, 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.

    Put simply, you "skip" every two level:

    enter image description here

    O describes the limiting behavior of a function when the argument tends towards a particular value or infinity, so in your case comparing precisely O(b^(d/2)) with small values of b and d doesn't really make sense.

    0 讨论(0)
提交回复
热议问题