带有换位表的Alpha-beta修剪

问题描述

我不明白为什么原样使用表条目的标志。考虑例如Negamax with alpha-beta pruning and transposition tables的伪代码,并专注于TT部分。

(* Transposition Table Lookup; node is the lookup key for ttEntry *)
ttEntry := transpositionTableLookup(node)
if ttEntry is valid and ttEntry.depth ≥ depth then
    if ttEntry.flag = EXACT then
        return ttEntry.value
    else if ttEntry.flag = LOWERBOUND then
        α := max(α,ttEntry.value)
    else if ttEntry.flag = UPPERBOUND then
        β := min(β,ttEntry.value)

    if α ≥ β then
        return ttEntry.value

没关系。如果条目包含精确值的下限,我们尝试从左侧缩小窗口,依此类推。

(* Transposition Table Store; node is the lookup key for ttEntry *)
ttEntry.value := value
if value ≤ alphaOrig then
    ttEntry.flag := UPPERBOUND
else if value ≥ β then
    ttEntry.flag := LOWERBOUND
else
    ttEntry.flag := EXACT
ttEntry.depth := depth  
transpositionTableStore(node,ttEntry)

这部分我不明白。如果 value 太小,为什么还要设置UPPERBOUND标志? value 位于搜索窗口的左侧-小于已知的下限- alpha 。因此,看来 value 应该是LOWERBOUND。

从我的测试以及每个人都使用该版本的事实可以看出,我肯定对这种逻辑有误。但是我不明白为什么。

解决方法

第二个问题,这个问题很简单:)

实际上,如果子节点值太高而无法导致beta截止( value≥β),则意味着父节点的移动至少与 value ,但也许还有一些更好的举措。因此, value 是精确节点值的LOWERBOUND。

值≤alphaOrig 表示所有移动都比 alphaOrig 差。这意味着是所有举动后果的上限。

Lower和Upper是当前节点的值的边界,而不是根节点,正如我所暗示的那样。