Skip to content

Commit a6fd17f

Browse files
XInTheDarkDisservin
authored andcommitted
VLTC search tune
Search parameters were tuned using 152k games at 180+1.8. Passed VLTC: https://tests.stockfishchess.org/tests/view/65a7a81979aa8af82b973a20 LLR: 2.94 (-2.94,2.94) <0.00,2.00> Total: 117338 W: 29244 L: 28848 D: 59246 Ptnml(0-2): 24, 12474, 33267, 12890, 14 Passed VVLTC: https://tests.stockfishchess.org/tests/view/65ab246679aa8af82b977982 LLR: 2.94 (-2.94,2.94) <0.50,2.50> Total: 28164 W: 7239 L: 6957 D: 13968 Ptnml(0-2): 3, 2651, 8490, 2937, 1 STC Elo estimate: https://tests.stockfishchess.org/tests/view/65ac7c0979aa8af82b9792a6 Elo: -0.53 ± 2.0 (95%) LOS: 30.4% Total: 30000 W: 7688 L: 7734 D: 14578 Ptnml(0-2): 102, 3617, 7614, 3559, 108 nElo: -1.03 ± 3.9 (95%) PairsRatio: 0.99 closes #5003 Bench: 1235377
1 parent a901474 commit a6fd17f

File tree

2 files changed

+39
-39
lines changed

2 files changed

+39
-39
lines changed

src/search.cpp

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace {
5555

5656
// Futility margin
5757
Value futility_margin(Depth d, bool noTtCutNode, bool improving) {
58-
Value futilityMult = 116 - 44 * noTtCutNode;
58+
Value futilityMult = 114 - 47 * noTtCutNode;
5959
return (futilityMult * d - 3 * futilityMult / 2 * improving);
6060
}
6161

@@ -66,15 +66,15 @@ constexpr int futility_move_count(bool improving, Depth depth) {
6666
// Add correctionHistory value to raw staticEval and guarantee evaluation does not hit the tablebase range
6767
Value to_corrected_static_eval(Value v, const Worker& w, const Position& pos) {
6868
auto cv = w.correctionHistory[pos.side_to_move()][pawn_structure_index<Correction>(pos)];
69-
v += cv * std::abs(cv) / 16384;
69+
v += cv * std::abs(cv) / 14095;
7070
return std::clamp(int(v), VALUE_TB_LOSS_IN_MAX_PLY + 1, VALUE_TB_WIN_IN_MAX_PLY - 1);
7171
}
7272

7373
// History and stats update bonus, based on depth
74-
int stat_bonus(Depth d) { return std::min(268 * d - 352, 1153); }
74+
int stat_bonus(Depth d) { return std::min(265 * d - 349, 1112); }
7575

7676
// History and stats update malus, based on depth
77-
int stat_malus(Depth d) { return std::min(400 * d - 354, 1201); }
77+
int stat_malus(Depth d) { return std::min(482 * d - 326, 1172); }
7878

7979
// Add a small random component to draw evaluations to avoid 3-fold blindness
8080
Value value_draw(size_t nodes) { return VALUE_DRAW - 1 + Value(nodes & 0x2); }
@@ -334,12 +334,12 @@ void Search::Worker::iterative_deepening() {
334334

335335
// Reset aspiration window starting size
336336
Value avg = rootMoves[pvIdx].averageScore;
337-
delta = Value(9) + int(avg) * avg / 14847;
337+
delta = Value(9) + int(avg) * avg / 13181;
338338
alpha = std::max(avg - delta, -VALUE_INFINITE);
339339
beta = std::min(avg + delta, int(VALUE_INFINITE));
340340

341341
// Adjust optimism based on root move's averageScore (~4 Elo)
342-
optimism[us] = 121 * avg / (std::abs(avg) + 109);
342+
optimism[us] = 132 * avg / (std::abs(avg) + 98);
343343
optimism[~us] = -optimism[us];
344344

345345
// Start with a small aspiration window and, in the case of a fail
@@ -769,7 +769,7 @@ Value Search::Worker::search(
769769
// Use static evaluation difference to improve quiet move ordering (~9 Elo)
770770
if (((ss - 1)->currentMove).is_ok() && !(ss - 1)->inCheck && !priorCapture)
771771
{
772-
int bonus = std::clamp(-13 * int((ss - 1)->staticEval + ss->staticEval), -1652, 1546);
772+
int bonus = std::clamp(-13 * int((ss - 1)->staticEval + ss->staticEval), -1680, 1406);
773773
bonus = bonus > 0 ? 2 * bonus : bonus / 2;
774774
thisThread->mainHistory[~us][((ss - 1)->currentMove).from_to()] << bonus;
775775
if (type_of(pos.piece_on(prevSq)) != PAWN && ((ss - 1)->currentMove).type_of() != PROMOTION)
@@ -790,7 +790,7 @@ Value Search::Worker::search(
790790
// If eval is really low check with qsearch if it can exceed alpha, if it can't,
791791
// return a fail low.
792792
// Adjust razor margin according to cutoffCnt. (~1 Elo)
793-
if (eval < alpha - 472 - (284 - 165 * ((ss + 1)->cutoffCnt > 3)) * depth * depth)
793+
if (eval < alpha - 435 - (327 - 167 * ((ss + 1)->cutoffCnt > 3)) * depth * depth)
794794
{
795795
value = qsearch<NonPV>(pos, ss, alpha - 1, alpha);
796796
if (value < alpha)
@@ -799,17 +799,17 @@ Value Search::Worker::search(
799799

800800
// Step 8. Futility pruning: child node (~40 Elo)
801801
// The depth condition is important for mate finding.
802-
if (!ss->ttPv && depth < 9
802+
if (!ss->ttPv && depth < 11
803803
&& eval - futility_margin(depth, cutNode && !ss->ttHit, improving)
804-
- (ss - 1)->statScore / 337
804+
- (ss - 1)->statScore / 327
805805
>= beta
806-
&& eval >= beta && eval < 29008 // smaller than TB wins
806+
&& eval >= beta && eval < 27734 // smaller than TB wins
807807
&& (!ttMove || ttCapture))
808808
return beta > VALUE_TB_LOSS_IN_MAX_PLY ? (eval + beta) / 2 : eval;
809809

810810
// Step 9. Null move search with verification search (~35 Elo)
811-
if (!PvNode && (ss - 1)->currentMove != Move::null() && (ss - 1)->statScore < 17496
812-
&& eval >= beta && eval >= ss->staticEval && ss->staticEval >= beta - 23 * depth + 304
811+
if (!PvNode && (ss - 1)->currentMove != Move::null() && (ss - 1)->statScore < 17787
812+
&& eval >= beta && eval >= ss->staticEval && ss->staticEval >= beta - 22 * depth + 313
813813
&& !excludedMove && pos.non_pawn_material(us) && ss->ply >= thisThread->nmpMinPly
814814
&& beta > VALUE_TB_LOSS_IN_MAX_PLY)
815815
{
@@ -863,7 +863,7 @@ Value Search::Worker::search(
863863
if (cutNode && depth >= 8 && !ttMove)
864864
depth -= 2;
865865

866-
probCutBeta = beta + 163 - 67 * improving;
866+
probCutBeta = beta + 173 - 73 * improving;
867867

868868
// Step 11. ProbCut (~10 Elo)
869869
// If we have a good enough capture (or queen promotion) and a reduced search returns a value
@@ -923,7 +923,7 @@ Value Search::Worker::search(
923923
moves_loop: // When in check, search starts here
924924

925925
// Step 12. A small Probcut idea, when we are in check (~4 Elo)
926-
probCutBeta = beta + 425;
926+
probCutBeta = beta + 427;
927927
if (ss->inCheck && !PvNode && ttCapture && (tte->bound() & BOUND_LOWER)
928928
&& tte->depth() >= depth - 4 && ttValue >= probCutBeta
929929
&& std::abs(ttValue) < VALUE_TB_WIN_IN_MAX_PLY && std::abs(beta) < VALUE_TB_WIN_IN_MAX_PLY)
@@ -1006,15 +1006,15 @@ Value Search::Worker::search(
10061006
{
10071007
Piece capturedPiece = pos.piece_on(move.to_sq());
10081008
int futilityEval =
1009-
ss->staticEval + 238 + 305 * lmrDepth + PieceValue[capturedPiece]
1009+
ss->staticEval + 277 + 298 * lmrDepth + PieceValue[capturedPiece]
10101010
+ thisThread->captureHistory[movedPiece][move.to_sq()][type_of(capturedPiece)]
10111011
/ 7;
10121012
if (futilityEval < alpha)
10131013
continue;
10141014
}
10151015

10161016
// SEE based pruning for captures and checks (~11 Elo)
1017-
if (!pos.see_ge(move, -187 * depth))
1017+
if (!pos.see_ge(move, -203 * depth))
10181018
continue;
10191019
}
10201020
else
@@ -1026,18 +1026,18 @@ Value Search::Worker::search(
10261026
+ thisThread->pawnHistory[pawn_structure_index(pos)][movedPiece][move.to_sq()];
10271027

10281028
// Continuation history based pruning (~2 Elo)
1029-
if (lmrDepth < 6 && history < -3752 * depth)
1029+
if (lmrDepth < 6 && history < -4195 * depth)
10301030
continue;
10311031

1032-
history += 2 * thisThread->mainHistory[us][move.from_to()];
1032+
history += 69 * thisThread->mainHistory[us][move.from_to()] / 32;
10331033

1034-
lmrDepth += history / 7838;
1034+
lmrDepth += history / 6992;
10351035
lmrDepth = std::max(lmrDepth, -1);
10361036

10371037
// Futility pruning: parent node (~13 Elo)
1038-
if (!ss->inCheck && lmrDepth < 14
1039-
&& ss->staticEval + (bestValue < ss->staticEval - 57 ? 124 : 71)
1040-
+ 118 * lmrDepth
1038+
if (!ss->inCheck && lmrDepth < 15
1039+
&& ss->staticEval + (bestValue < ss->staticEval - 63 ? 137 : 64)
1040+
+ 111 * lmrDepth
10411041
<= alpha)
10421042
continue;
10431043

@@ -1064,11 +1064,11 @@ Value Search::Worker::search(
10641064
// so changing them requires tests at these types of time controls.
10651065
// Recursive singular search is avoided.
10661066
if (!rootNode && move == ttMove && !excludedMove
1067-
&& depth >= 4 - (thisThread->completedDepth > 27) + 2 * (PvNode && tte->is_pv())
1067+
&& depth >= 4 - (thisThread->completedDepth > 31) + 2 * (PvNode && tte->is_pv())
10681068
&& std::abs(ttValue) < VALUE_TB_WIN_IN_MAX_PLY && (tte->bound() & BOUND_LOWER)
10691069
&& tte->depth() >= depth - 3)
10701070
{
1071-
Value singularBeta = ttValue - (66 + 58 * (ss->ttPv && !PvNode)) * depth / 64;
1071+
Value singularBeta = ttValue - (58 + 52 * (ss->ttPv && !PvNode)) * depth / 64;
10721072
Depth singularDepth = newDepth / 2;
10731073

10741074
ss->excludedMove = move;
@@ -1082,7 +1082,7 @@ Value Search::Worker::search(
10821082
singularQuietLMR = !ttCapture;
10831083

10841084
// Avoid search explosion by limiting the number of double extensions
1085-
if (!PvNode && value < singularBeta - 17 && ss->doubleExtensions <= 11)
1085+
if (!PvNode && value < singularBeta - 16 && ss->doubleExtensions <= 12)
10861086
{
10871087
extension = 2;
10881088
depth += depth < 15;
@@ -1109,7 +1109,7 @@ Value Search::Worker::search(
11091109

11101110
// If we are on a cutNode but the ttMove is not assumed to fail high over current beta (~1 Elo)
11111111
else if (cutNode)
1112-
extension = depth < 19 ? -2 : -1;
1112+
extension = depth < 20 ? -2 : -1;
11131113

11141114
// If the ttMove is assumed to fail low over the value of the reduced search (~1 Elo)
11151115
else if (ttValue <= value)
@@ -1122,14 +1122,14 @@ Value Search::Worker::search(
11221122

11231123
// Quiet ttMove extensions (~1 Elo)
11241124
else if (PvNode && move == ttMove && move == ss->killers[0]
1125-
&& (*contHist[0])[movedPiece][move.to_sq()] >= 4325)
1125+
&& (*contHist[0])[movedPiece][move.to_sq()] >= 4111)
11261126
extension = 1;
11271127

11281128
// Recapture extensions (~1 Elo)
11291129
else if (PvNode && move == ttMove && move.to_sq() == prevSq
11301130
&& thisThread->captureHistory[movedPiece][move.to_sq()]
11311131
[type_of(pos.piece_on(move.to_sq()))]
1132-
> 4146)
1132+
> 4484)
11331133
extension = 1;
11341134
}
11351135

@@ -1189,10 +1189,10 @@ Value Search::Worker::search(
11891189
ss->statScore = 2 * thisThread->mainHistory[us][move.from_to()]
11901190
+ (*contHist[0])[movedPiece][move.to_sq()]
11911191
+ (*contHist[1])[movedPiece][move.to_sq()]
1192-
+ (*contHist[3])[movedPiece][move.to_sq()] - 3817;
1192+
+ (*contHist[3])[movedPiece][move.to_sq()] - 4119;
11931193

11941194
// Decrease/increase reduction for moves with a good/bad history (~25 Elo)
1195-
r -= ss->statScore / 14767;
1195+
r -= ss->statScore / 15373;
11961196

11971197
// Step 17. Late moves reduction / extension (LMR, ~117 Elo)
11981198
// We use various heuristics for the sons of a node after the first son has
@@ -1215,7 +1215,7 @@ Value Search::Worker::search(
12151215
{
12161216
// Adjust full-depth search based on LMR results - if the result
12171217
// was good enough search deeper, if it was bad enough search shallower.
1218-
const bool doDeeperSearch = value > (bestValue + 53 + 2 * newDepth); // (~1 Elo)
1218+
const bool doDeeperSearch = value > (bestValue + 51 + 2 * newDepth); // (~1 Elo)
12191219
const bool doShallowerSearch = value < bestValue + newDepth; // (~2 Elo)
12201220

12211221
newDepth += doDeeperSearch - doShallowerSearch;
@@ -1331,7 +1331,7 @@ Value Search::Worker::search(
13311331
else
13321332
{
13331333
// Reduce other moves if we have found at least one score improvement (~2 Elo)
1334-
if (depth > 2 && depth < 12 && beta < 13782 && value > -11541)
1334+
if (depth > 2 && depth < 12 && beta < 13195 && value > -12346)
13351335
depth -= 2;
13361336

13371337
assert(depth > 0);
@@ -1370,7 +1370,7 @@ Value Search::Worker::search(
13701370
// Bonus for prior countermove that caused the fail low
13711371
else if (!priorCapture && prevSq != SQ_NONE)
13721372
{
1373-
int bonus = (depth > 6) + (PvNode || cutNode) + ((ss - 1)->statScore < -18782)
1373+
int bonus = (depth > 5) + (PvNode || cutNode) + ((ss - 1)->statScore < -16797)
13741374
+ ((ss - 1)->moveCount > 10);
13751375
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq,
13761376
stat_bonus(depth) * bonus);
@@ -1529,7 +1529,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta,
15291529
if (bestValue > alpha)
15301530
alpha = bestValue;
15311531

1532-
futilityBase = ss->staticEval + 182;
1532+
futilityBase = ss->staticEval + 186;
15331533
}
15341534

15351535
const PieceToHistory* contHist[] = {(ss - 1)->continuationHistory,
@@ -1609,7 +1609,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta,
16091609
continue;
16101610

16111611
// Do not search moves with bad enough SEE values (~5 Elo)
1612-
if (!pos.see_ge(move, -77))
1612+
if (!pos.see_ge(move, -76))
16131613
continue;
16141614
}
16151615

@@ -1764,7 +1764,7 @@ void update_all_stats(const Position& pos,
17641764

17651765
if (!pos.capture_stage(bestMove))
17661766
{
1767-
int bestMoveBonus = bestValue > beta + 173 ? quietMoveBonus // larger bonus
1767+
int bestMoveBonus = bestValue > beta + 177 ? quietMoveBonus // larger bonus
17681768
: stat_bonus(depth); // smaller bonus
17691769

17701770
// Increase stats for the best move in case it was a quiet move

src/search.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ class Worker {
205205

206206
Depth reduction(bool i, Depth d, int mn, int delta) {
207207
int reductionScale = reductions[d] * reductions[mn];
208-
return (reductionScale + 1346 - int(delta) * 896 / int(rootDelta)) / 1024
209-
+ (!i && reductionScale > 880);
208+
return (reductionScale + 1177 - int(delta) * 776 / int(rootDelta)) / 1024
209+
+ (!i && reductionScale > 842);
210210
}
211211

212212
// Get a pointer to the search manager, only allowed to be called by the

0 commit comments

Comments
 (0)