artificial-intelligence - 如何修复锥形评估采取更多节点
问题描述
我刚刚实施了锥形评估,但我不确定我是否真的完成了它,因为它只会破坏移动顺序。
我正在使用这个 fen 进行测试:r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1
所以这是锥形 eval 的信息:
info depth 1 score cp 18.000000 nodes 65 time 116 pv e2a6
info depth 2 score cp 18.000000 nodes 165 time 402 pv e2a6 b4c3
info depth 3 score cp 18.000000 nodes 457 time 568 pv e2a6 b4c3 d2c3
info depth 4 score cp 18.000000 nodes 3833 time 1108 pv e2a6 b4c3 d2c3 h3g2
info depth 5 score cp 17.000000 nodes 12212 time 1875 pv e2a6 e6d5 c3d5
info depth 6 score cp 17.000000 nodes 77350 time 4348 pv e2a6 e6d5 c3d5
bestmove e2a6 ponder e6d5
并且没有锥形评估:
info depth 1 score cp 19.000000 nodes 75 time 66 pv e2a6
info depth 2 score cp 19.000000 nodes 175 time 182 pv e2a6 b4c3
info depth 3 score cp 19.000000 nodes 398 time 371 pv e2a6 b4c3 d2c3
info depth 4 score cp 19.000000 nodes 3650 time 947 pv e2a6 b4c3 d2c3 h3g2
info depth 5 score cp 18.000000 nodes 10995 time 1849 pv e2a6 e6d5 c3d5
info depth 6 score cp 18.000000 nodes 75881 time 4334 pv e2a6 e6d5 c3d5
bestmove e2a6 ponder e6d5
您可以看到,没有锥形 eval 的节点实际上比另一个节点少,我只是想知道这是否有必要,或者我只是执行错误。
我的相位函数:
int totalPhase = pawnPhase * 16 + knightPhase * 4 + bishopPhase * 4 + rookPhase * 4 + queenPhase * 2;
int phase = totalPhase;
for each piece in node {
if piece is pawn, phase -= pawnPhase
else if piece is knight, phase -= knightPhase
...
}
return (phase * 256 + (totalPhase / 2)) / totalPhase;
然后我在 eval 函数中添加了插值:
for (each piece in node) {
...score material weights and positional scores, etc.
}
evaluation = ((mgEvaluation * (256 - phase)) + (egEvaluation * phase)) / 256;
我在这个网站上得到了公式:Tapered Eval
如果这确实是必要的,有人可以给我提示来优化它吗?
解决方案
Tapered eval 非常有用并且需要使用,因为早期/中期游戏中的策略与最终游戏中的策略截然不同。您没有提及如何对移动进行排序,但是由于锥形评估在棋盘方表 (PST) 中为您提供了不同的数字,用于中间游戏位置,移动排序与以前略有不同是很自然的。你得到的结果非常接近,而且似乎是合理的。
用锥形 eval 测试起始位置,看看它给出的结果与使用 PST 打开的正常 eval 相同。对残局位置也做同样的事情,对残局只做 PST,这也应该给出相同的结果。