tuned TM values

Tuned 70k games at 240+2.4 th 2: https://tests.stockfishchess.org/tests/view/6783b1b16ddf09c0b4b703f5

Failed STC:
LLR: -2.93 (-2.94,2.94) <0.00,2.00>
Total: 491872 W: 128260 L: 127804 D: 235808
Ptnml(0-2): 1579, 55449, 131572, 55609, 1727
https://tests.stockfishchess.org/tests/view/6785a045460e2910c51de4b8

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 154824 W: 39315 L: 38874 D: 76635
Ptnml(0-2): 110, 15809, 45147, 16222, 124
https://tests.stockfishchess.org/tests/view/678ac722c00c743bc9e9fc35

Passed VLTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 77404 W: 19825 L: 19452 D: 38127
Ptnml(0-2): 18, 7262, 23765, 7643, 14
https://tests.stockfishchess.org/tests/view/678b2a98c00c743bc9ea048c

closes https://github.com/official-stockfish/Stockfish/pull/5796

No functional change
This commit is contained in:
Shawn Xu
2025-01-13 15:22:00 -08:00
committed by Joost VandeVondele
parent c94bcf62e4
commit 738ac2a100
2 changed files with 29 additions and 24 deletions

View File

@@ -446,17 +446,19 @@ void Search::Worker::iterative_deepening() {
// Do we have time for the next iteration? Can we stop searching now?
if (limits.use_time_management() && !threads.stop && !mainThread->stopOnPonderhit)
{
int nodesEffort = rootMoves[0].effort * 100 / std::max(size_t(1), size_t(nodes));
int nodesEffort = rootMoves[0].effort * 100000 / std::max(size_t(1), size_t(nodes));
double fallingEval = (11 + 2 * (mainThread->bestPreviousAverageScore - bestValue)
+ (mainThread->iterValue[iterIdx] - bestValue))
/ 100.0;
fallingEval = std::clamp(fallingEval, 0.580, 1.667);
double fallingEval =
(11.396 + 2.035 * (mainThread->bestPreviousAverageScore - bestValue)
+ 0.968 * (mainThread->iterValue[iterIdx] - bestValue))
/ 100.0;
fallingEval = std::clamp(fallingEval, 0.5786, 1.6752);
// If the bestMove is stable over several iterations, reduce time accordingly
timeReduction = lastBestMoveDepth + 8 < completedDepth ? 1.495 : 0.687;
double reduction = (1.48 + mainThread->previousTimeReduction) / (2.17 * timeReduction);
double bestMoveInstability = 1 + 1.88 * totBestMoveChanges / threads.size();
timeReduction = lastBestMoveDepth + 8 < completedDepth ? 1.4857 : 0.7046;
double reduction =
(1.4540 + mainThread->previousTimeReduction) / (2.1593 * timeReduction);
double bestMoveInstability = 0.9929 + 1.8519 * totBestMoveChanges / threads.size();
double totalTime =
mainThread->tm.optimum() * fallingEval * reduction * bestMoveInstability;
@@ -467,7 +469,7 @@ void Search::Worker::iterative_deepening() {
auto elapsedTime = elapsed();
if (completedDepth >= 10 && nodesEffort >= 97 && elapsedTime > totalTime * 0.739
if (completedDepth >= 10 && nodesEffort >= 97056 && elapsedTime > totalTime * 0.6540
&& !mainThread->ponder)
threads.stop = true;
@@ -482,7 +484,7 @@ void Search::Worker::iterative_deepening() {
threads.stop = true;
}
else
threads.increaseDepth = mainThread->ponder || elapsedTime <= totalTime * 0.506;
threads.increaseDepth = mainThread->ponder || elapsedTime <= totalTime * 0.5138;
}
mainThread->iterValue[iterIdx] = bestValue;

View File

@@ -88,17 +88,19 @@ void TimeManagement::init(Search::LimitsType& limits,
const TimePoint scaledInc = limits.inc[us] / scaleFactor;
// Maximum move horizon of 50 moves
int mtg = limits.movestogo ? std::min(limits.movestogo, 50) : 50;
int centiMTG = limits.movestogo ? std::min(limits.movestogo * 100, 5000) : 5051;
// If less than one second, gradually reduce mtg
if (scaledTime < 1000 && double(mtg) / scaledInc > 0.05)
if (scaledTime < 1000 && double(centiMTG) / scaledInc > 5.051)
{
mtg = scaledTime * 0.05;
centiMTG = scaledTime * 5.051;
}
// Make sure timeLeft is > 0 since we may use it as a divisor
TimePoint timeLeft = std::max(TimePoint(1), limits.time[us] + limits.inc[us] * (mtg - 1)
- moveOverhead * (2 + mtg));
TimePoint timeLeft =
std::max(TimePoint(1),
limits.time[us]
+ (limits.inc[us] * (centiMTG - 100) - moveOverhead * (200 + centiMTG)) / 100);
// x basetime (+ z increment)
// If there is a healthy increment, timeLeft can exceed the actual available
@@ -107,31 +109,32 @@ void TimeManagement::init(Search::LimitsType& limits,
{
// Extra time according to timeLeft
if (originalTimeAdjust < 0)
originalTimeAdjust = 0.3285 * std::log10(timeLeft) - 0.4830;
originalTimeAdjust = 0.3128 * std::log10(timeLeft) - 0.4354;
// Calculate time constants based on current time left.
double logTimeInSec = std::log10(scaledTime / 1000.0);
double optConstant = std::min(0.00308 + 0.000319 * logTimeInSec, 0.00506);
double maxConstant = std::max(3.39 + 3.01 * logTimeInSec, 2.93);
double optConstant = std::min(0.0032116 + 0.000321123 * logTimeInSec, 0.00508017);
double maxConstant = std::max(3.3977 + 3.03950 * logTimeInSec, 2.94761);
optScale = std::min(0.0122 + std::pow(ply + 2.95, 0.462) * optConstant,
0.213 * limits.time[us] / timeLeft)
optScale = std::min(0.0121431 + std::pow(ply + 2.94693, 0.461073) * optConstant,
0.213035 * limits.time[us] / timeLeft)
* originalTimeAdjust;
maxScale = std::min(6.64, maxConstant + ply / 12.0);
maxScale = std::min(6.67704, maxConstant + ply / 11.9847);
}
// x moves in y seconds (+ z increment)
else
{
optScale = std::min((0.88 + ply / 116.4) / mtg, 0.88 * limits.time[us] / timeLeft);
maxScale = 1.3 + 0.11 * mtg;
optScale =
std::min((0.88 + ply / 116.4) / (centiMTG / 100.0), 0.88 * limits.time[us] / timeLeft);
maxScale = 1.3 + 0.11 * (centiMTG / 100.0);
}
// Limit the maximum possible time for this move
optimumTime = TimePoint(optScale * timeLeft);
maximumTime =
TimePoint(std::min(0.825 * limits.time[us] - moveOverhead, maxScale * optimumTime)) - 10;
TimePoint(std::min(0.825179 * limits.time[us] - moveOverhead, maxScale * optimumTime)) - 10;
if (options["Ponder"])
optimumTime += optimumTime / 4;