Skip to content

Commit a0259d8

Browse files
locutus2vondele
authored andcommitted
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 #3776 Bench: 6719976
1 parent 45e5e65 commit a0259d8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/search.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ void Thread::search() {
376376
// Reset aspiration window starting size
377377
if (rootDepth >= 4)
378378
{
379-
Value prev = rootMoves[pvIdx].previousScore;
379+
Value prev = rootMoves[pvIdx].averageScore;
380380
delta = Value(17) + int(prev) * prev / 16384;
381381
alpha = std::max(prev - delta,-VALUE_INFINITE);
382382
beta = std::min(prev + delta, VALUE_INFINITE);
@@ -1280,6 +1280,8 @@ namespace {
12801280
RootMove& rm = *std::find(thisThread->rootMoves.begin(),
12811281
thisThread->rootMoves.end(), move);
12821282

1283+
rm.averageScore = rm.averageScore != -VALUE_INFINITE ? (2 * value + rm.averageScore) / 3 : value;
1284+
12831285
// PV move or new best move?
12841286
if (moveCount == 1 || value > alpha)
12851287
{

src/search.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ struct RootMove {
7373

7474
Value score = -VALUE_INFINITE;
7575
Value previousScore = -VALUE_INFINITE;
76+
Value averageScore = -VALUE_INFINITE;
7677
int selDepth = 0;
7778
int tbRank = 0;
7879
Value tbScore;

0 commit comments

Comments
 (0)