From: Stefan Geschwentner Date: Fri, 5 Nov 2021 12:49:28 +0000 (+0100) Subject: Tweak initial aspiration window. X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=a0259d8ab9661b7f625474d2cbe18481ef69bbf2;ds=sidebyside Tweak initial aspiration window. Maintain for each root move an exponential average of the search value with a weight ratio of 2:1 (new value vs old values). Then the average score is used as the center of the initial aspiration window instead of the previous score. Stats indicate (see PR) that the deviation for previous score is in general greater than using average score, so later seems a better estimation of the next search value. This is probably the reason this patch succeded besides smoothing the sometimes wild swings in search score. An additional observation is that at higher depth previous score is above but average score below zero. So for average score more/less fail/low highs should be occur than previous score. STC: LLR: 2.97 (-2.94,2.94) <0.00,2.50> Total: 59792 W: 15106 L: 14792 D: 29894 Ptnml(0-2): 144, 6718, 15869, 7010, 155 https://tests.stockfishchess.org/tests/view/61841612d7a085ad008eef06 LTC: LLR: 2.94 (-2.94,2.94) <0.50,3.00> Total: 46448 W: 11835 L: 11537 D: 23076 Ptnml(0-2): 21, 4756, 13374, 5050, 23 https://tests.stockfishchess.org/tests/view/618463abd7a085ad008eef3e closes https://github.com/official-stockfish/Stockfish/pull/3776 Bench: 6719976 --- diff --git a/src/search.cpp b/src/search.cpp index 6c894c17..090a7931 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -376,7 +376,7 @@ void Thread::search() { // Reset aspiration window starting size if (rootDepth >= 4) { - Value prev = rootMoves[pvIdx].previousScore; + Value prev = rootMoves[pvIdx].averageScore; delta = Value(17) + int(prev) * prev / 16384; alpha = std::max(prev - delta,-VALUE_INFINITE); beta = std::min(prev + delta, VALUE_INFINITE); @@ -1280,6 +1280,8 @@ moves_loop: // When in check, search starts here RootMove& rm = *std::find(thisThread->rootMoves.begin(), thisThread->rootMoves.end(), move); + rm.averageScore = rm.averageScore != -VALUE_INFINITE ? (2 * value + rm.averageScore) / 3 : value; + // PV move or new best move? if (moveCount == 1 || value > alpha) { diff --git a/src/search.h b/src/search.h index ba9d0677..7a5d5bdf 100644 --- a/src/search.h +++ b/src/search.h @@ -73,6 +73,7 @@ struct RootMove { Value score = -VALUE_INFINITE; Value previousScore = -VALUE_INFINITE; + Value averageScore = -VALUE_INFINITE; int selDepth = 0; int tbRank = 0; Value tbScore;