Skip to content

Commit 42b7dbc

Browse files
xoto10snicolet
authored andcommitted
Tuned values for search constants
Tuned search constants after many search patches since the last successful tune. 1st LTC @ 60+0.6 th 1 : LLR: 2.97 (-2.94,2.94) {0.25,1.75} Total: 57656 W: 7369 L: 7036 D: 43251 Ptnml(0-2): 393, 5214, 17336, 5437, 448 https://tests.stockfishchess.org/tests/view/5ee1e074f29b40b0fc95af19 SMP LTC @ 20+0.2 th 8 : LLR: 2.95 (-2.94,2.94) {0.25,1.75} Total: 83576 W: 9731 L: 9341 D: 64504 Ptnml(0-2): 464, 7062, 26369, 7406, 487 https://tests.stockfishchess.org/tests/view/5ee35a21f29b40b0fc95b008 The changes were rebased on top of a successful patch by Viz (see #2734) and two different ways of doing this were tested. The successful test modified the constants in the patch by Viz in a similar manner to the tuning run: LTC (rebased) @ 60+0.6 th 1 : LLR: 2.94 (-2.94,2.94) {0.25,1.75} Total: 193384 W: 24241 L: 23521 D: 145622 Ptnml(0-2): 1309, 17497, 58472, 17993, 1421 https://tests.stockfishchess.org/tests/view/5ee43319ca6c451633a995f9 Further work: the recent patch to quantize eval #2733 affects search quit quite a bit, so doing another tune in, say, three months time might be a good idea. closes #2735 Bench 4246971
1 parent 4d65761 commit 42b7dbc

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

src/search.cpp

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,26 @@ namespace {
6565
constexpr uint64_t TtHitAverageResolution = 1024;
6666

6767
// Razor and futility margins
68-
constexpr int RazorMargin = 531;
68+
constexpr int RazorMargin = 516;
6969
Value futility_margin(Depth d, bool improving) {
70-
return Value(217 * (d - improving));
70+
return Value(224 * (d - improving));
7171
}
7272

7373
// Reductions lookup table, initialized at startup
7474
int Reductions[MAX_MOVES]; // [depth or moveNumber]
7575

7676
Depth reduction(bool i, Depth d, int mn) {
7777
int r = Reductions[d] * Reductions[mn];
78-
return (r + 511) / 1024 + (!i && r > 1007);
78+
return (r + 529) / 1024 + (!i && r > 1050);
7979
}
8080

8181
constexpr int futility_move_count(bool improving, Depth depth) {
82-
return (4 + depth * depth) / (2 - improving);
82+
return (3 + depth * depth) / (2 - improving);
8383
}
8484

8585
// History and stats update bonus, based on depth
8686
int stat_bonus(Depth d) {
87-
return d > 15 ? -8 : 19 * d * d + 155 * d - 132;
87+
return d > 15 ? 28 : 19 * d * d + 135 * d - 136;
8888
}
8989

9090
// Add a small random component to draw evaluations to avoid 3fold-blindness
@@ -194,7 +194,7 @@ namespace {
194194
void Search::init() {
195195

196196
for (int i = 1; i < MAX_MOVES; ++i)
197-
Reductions[i] = int((24.8 + std::log(Threads.size())) * std::log(i));
197+
Reductions[i] = int((24.9 + std::log(Threads.size())) * std::log(i));
198198
}
199199

200200

@@ -408,7 +408,7 @@ void Thread::search() {
408408
beta = std::min(prev + delta, VALUE_INFINITE);
409409

410410
// Adjust contempt based on root move's previousScore (dynamic contempt)
411-
int dct = ct + (102 - ct / 2) * prev / (abs(prev) + 157);
411+
int dct = ct + (104 - ct / 2) * prev / (abs(prev) + 143);
412412

413413
contempt = (us == WHITE ? make_score(dct, dct / 2)
414414
: -make_score(dct, dct / 2));
@@ -506,13 +506,13 @@ void Thread::search() {
506506
&& !Threads.stop
507507
&& !mainThread->stopOnPonderhit)
508508
{
509-
double fallingEval = (332 + 6 * (mainThread->bestPreviousScore - bestValue)
510-
+ 6 * (mainThread->iterValue[iterIdx] - bestValue)) / 704.0;
509+
double fallingEval = (293 + 6 * (mainThread->bestPreviousScore - bestValue)
510+
+ 6 * (mainThread->iterValue[iterIdx] - bestValue)) / 742.0;
511511
fallingEval = Utility::clamp(fallingEval, 0.5, 1.5);
512512

513513
// If the bestMove is stable over several iterations, reduce time accordingly
514-
timeReduction = lastBestMoveDepth + 9 < completedDepth ? 1.94 : 0.91;
515-
double reduction = (1.41 + mainThread->previousTimeReduction) / (2.27 * timeReduction);
514+
timeReduction = lastBestMoveDepth + 10 < completedDepth ? 1.93 : 0.96;
515+
double reduction = (1.36 + mainThread->previousTimeReduction) / (2.21 * timeReduction);
516516

517517
// Use part of the gained time from a previous stable move for the current move
518518
for (Thread* th : Threads)
@@ -537,7 +537,7 @@ void Thread::search() {
537537
}
538538
else if ( Threads.increaseDepth
539539
&& !mainThread->ponder
540-
&& Time.elapsed() > totalTime * 0.6)
540+
&& Time.elapsed() > totalTime * 0.57)
541541
Threads.increaseDepth = false;
542542
else
543543
Threads.increaseDepth = true;
@@ -819,18 +819,18 @@ namespace {
819819
// Step 9. Null move search with verification search (~40 Elo)
820820
if ( !PvNode
821821
&& (ss-1)->currentMove != MOVE_NULL
822-
&& (ss-1)->statScore < 23397
822+
&& (ss-1)->statScore < 24714
823823
&& eval >= beta
824824
&& eval >= ss->staticEval
825-
&& ss->staticEval >= beta - 32 * depth - 30 * improving + 120 * ttPv + 292
825+
&& ss->staticEval >= beta - 29 * depth - 31 * improving + 119 * ttPv + 299
826826
&& !excludedMove
827827
&& pos.non_pawn_material(us)
828828
&& (ss->ply >= thisThread->nmpMinPly || us != thisThread->nmpColor))
829829
{
830830
assert(eval - beta >= 0);
831831

832832
// Null move dynamic reduction based on depth and value
833-
Depth R = (854 + 68 * depth) / 258 + std::min(int(eval - beta) / 192, 3);
833+
Depth R = (793 + 70 * depth) / 252 + std::min(int(eval - beta) / 192, 3);
834834

835835
ss->currentMove = MOVE_NULL;
836836
ss->continuationHistory = &thisThread->continuationHistory[0][0][NO_PIECE][0];
@@ -870,10 +870,10 @@ namespace {
870870
// If we have a good enough capture and a reduced search returns a value
871871
// much above beta, we can (almost) safely prune the previous move.
872872
if ( !PvNode
873-
&& depth >= 5
873+
&& depth > 5
874874
&& abs(beta) < VALUE_TB_WIN_IN_MAX_PLY)
875875
{
876-
Value raisedBeta = beta + 189 - 45 * improving;
876+
Value raisedBeta = beta + 182 - 48 * improving;
877877
assert(raisedBeta < VALUE_INFINITE);
878878
MovePicker mp(pos, ttMove, raisedBeta - ss->staticEval, &captureHistory);
879879
int probCutCount = 0;
@@ -904,7 +904,7 @@ namespace {
904904

905905
// If the qsearch held, perform the regular search
906906
if (value >= raisedBeta)
907-
value = -search<NonPV>(pos, ss+1, -raisedBeta, -raisedBeta+1, depth - 4, !cutNode);
907+
value = -search<NonPV>(pos, ss+1, -raisedBeta, -raisedBeta+1, depth - 5, !cutNode);
908908

909909
pos.undo_move(move);
910910

@@ -1003,15 +1003,15 @@ namespace {
10031003
// Futility pruning: parent node (~5 Elo)
10041004
if ( lmrDepth < 6
10051005
&& !ss->inCheck
1006-
&& ss->staticEval + 235 + 172 * lmrDepth <= alpha
1006+
&& ss->staticEval + 252 + 176 * lmrDepth <= alpha
10071007
&& (*contHist[0])[movedPiece][to_sq(move)]
10081008
+ (*contHist[1])[movedPiece][to_sq(move)]
10091009
+ (*contHist[3])[movedPiece][to_sq(move)]
1010-
+ (*contHist[5])[movedPiece][to_sq(move)] / 2 < 31400)
1010+
+ (*contHist[5])[movedPiece][to_sq(move)] / 2 < 30251)
10111011
continue;
10121012

10131013
// Prune moves with negative SEE (~20 Elo)
1014-
if (!pos.see_ge(move, Value(-(32 - std::min(lmrDepth, 18)) * lmrDepth * lmrDepth)))
1014+
if (!pos.see_ge(move, Value(-(31 - std::min(lmrDepth, 18)) * lmrDepth * lmrDepth)))
10151015
continue;
10161016
}
10171017
else
@@ -1027,11 +1027,11 @@ namespace {
10271027
&& lmrDepth < 6
10281028
&& !(PvNode && abs(bestValue) < 2)
10291029
&& !ss->inCheck
1030-
&& ss->staticEval + 270 + 384 * lmrDepth + PieceValue[MG][type_of(pos.piece_on(to_sq(move)))] <= alpha)
1030+
&& ss->staticEval + 264 + 397 * lmrDepth + PieceValue[MG][type_of(pos.piece_on(to_sq(move)))] <= alpha)
10311031
continue;
10321032

10331033
// See based pruning
1034-
if (!pos.see_ge(move, Value(-194) * depth)) // (~25 Elo)
1034+
if (!pos.see_ge(move, Value(-192) * depth)) // (~25 Elo)
10351035
continue;
10361036
}
10371037
}
@@ -1144,12 +1144,12 @@ namespace {
11441144
|| moveCountPruning
11451145
|| ss->staticEval + PieceValue[EG][pos.captured_piece()] <= alpha
11461146
|| cutNode
1147-
|| thisThread->ttHitAverage < 375 * TtHitAverageResolution * TtHitAverageWindow / 1024))
1147+
|| thisThread->ttHitAverage < 399 * TtHitAverageResolution * TtHitAverageWindow / 1024))
11481148
{
11491149
Depth r = reduction(improving, depth, moveCount);
11501150

11511151
// Decrease reduction if the ttHit running average is large
1152-
if (thisThread->ttHitAverage > 500 * TtHitAverageResolution * TtHitAverageWindow / 1024)
1152+
if (thisThread->ttHitAverage > 492 * TtHitAverageResolution * TtHitAverageWindow / 1024)
11531153
r--;
11541154

11551155
// Reduction if other threads are searching this position.
@@ -1195,14 +1195,14 @@ namespace {
11951195
- 4926;
11961196

11971197
// Decrease/increase reduction by comparing opponent's stat score (~10 Elo)
1198-
if (ss->statScore >= -102 && (ss-1)->statScore < -114)
1198+
if (ss->statScore >= -99 && (ss-1)->statScore < -116)
11991199
r--;
12001200

1201-
else if ((ss-1)->statScore >= -116 && ss->statScore < -154)
1201+
else if ((ss-1)->statScore >= -117 && ss->statScore < -150)
12021202
r++;
12031203

12041204
// Decrease/increase reduction for moves with a good/bad history (~30 Elo)
1205-
r -= ss->statScore / 16434;
1205+
r -= ss->statScore / 15896;
12061206
}
12071207
else
12081208
{
@@ -1474,7 +1474,7 @@ namespace {
14741474
if (PvNode && bestValue > alpha)
14751475
alpha = bestValue;
14761476

1477-
futilityBase = bestValue + 154;
1477+
futilityBase = bestValue + 138;
14781478
}
14791479

14801480
const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory,

0 commit comments

Comments
 (0)