From 7d2c73a2aeaca26066c6f180b47cf17bf34256b8 Mon Sep 17 00:00:00 2001 From: PGG106 Date: Tue, 4 Feb 2025 10:02:09 +0100 Subject: [PATCH] Use LTC tuned values for history (85000 games) (#510) Passed STC: Elo | 9.72 +- 4.32 (95%) SPRT | 8.0+0.08s Threads=1 Hash=16MB LLR | 2.92 (-2.25, 2.89) [0.00, 3.00] Games | N: 7006 W: 1809 L: 1613 D: 3584 Penta | [28, 782, 1686, 980, 27] Passed LTC: Elo | 7.48 +- 3.60 (95%) SPRT | 40.0+0.40s Threads=1 Hash=64MB LLR | 2.92 (-2.25, 2.89) [0.00, 3.00] Games | N: 8504 W: 2057 L: 1874 D: 4573 Penta | [9, 889, 2269, 1080, 5] Bench: 13180468 --- src/history.cpp | 46 ++++++++++++++++++---- src/init.h | 2 + src/tune.h | 100 ++++++++++++++++++++++++++++++------------------ src/types.h | 2 +- 4 files changed, 104 insertions(+), 46 deletions(-) diff --git a/src/history.cpp b/src/history.cpp index 5a6cfe1a..59b1f541 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -12,11 +12,35 @@ GetScore: this is simply a getter for a specific entry of the history table */ int history_bonus(const int depth) { - return std::min(16 * depth * depth + 32 * depth + 16, historyBonusMax()); + return std::min(historyBonusMul() * depth + historyBonusOffset(), historyBonusMax()); } int history_malus(const int depth) { - return std::min(16 * depth * depth + 32 * depth + 16, historyMalusMax()); + return std::min(historyMalusMul() * depth + historyMalusOffset(), historyMalusMax()); +} + +int capthistory_bonus(const int depth) { + return std::min(capthistoryBonusMul() * depth + capthistoryBonusOffset(), capthistoryBonusMax()); +} + +int capthistory_malus(const int depth) { + return std::min(capthistoryMalusMul() * depth + capthistoryMalusOffset(), capthistoryMalusMax()); +} + +int conthistory_bonus(const int depth) { + return std::min(conthistoryBonusMul() * depth + conthistoryBonusOffset(), conthistoryBonusMax()); +} + +int conthistory_malus(const int depth) { + return std::min(roothistoryMalusMul() * depth + roothistoryMalusOffset(), roothistoryMalusMax()); +} + +int roothistory_bonus(const int depth) { + return std::min(roothistoryBonusMul() * depth + roothistoryBonusOffset(), roothistoryBonusMax()); +} + +int roothistory_malus(const int depth) { + return std::min(roothistoryMalusMul() * depth + roothistoryMalusOffset(), roothistoryMalusMax()); } void updateHHScore(const Position* pos, SearchData* sd, const Move move, int bonus) { @@ -68,34 +92,40 @@ void updateCapthistScore(const Position* pos, SearchData* sd, const Move move, i // Update all histories void UpdateHistories(const Position* pos, SearchData* sd, SearchStack* ss, const int depth, const Move bestMove, const MoveList* quietMoves, const MoveList* noisyMoves, const bool rootNode) { const int bonus = history_bonus(depth); + const int capthist_bonus = capthistory_bonus(depth); + const int conthist_bonus = conthistory_bonus(depth); + const int roothist_bonus = roothistory_bonus(depth); const int malus = history_malus(depth); + const int conthist_malus = conthistory_malus(depth); + const int roothist_malus = roothistory_malus(depth); + const int capthist_malus = capthistory_malus(depth); if (!isTactical(bestMove)) { // increase bestMove HH and CH score updateHHScore(pos, sd, bestMove, bonus); - updateCHScore(ss, bestMove, bonus); + updateCHScore(ss, bestMove, conthist_bonus); if (rootNode) - updateRHScore(pos, sd, bestMove, bonus); + updateRHScore(pos, sd, bestMove, roothist_bonus); // Loop through all the quiet moves for (int i = 0; i < quietMoves->count; i++) { // For all the quiets moves that didn't cause a cut-off decrease the HH score const Move move = quietMoves->moves[i].move; if (move == bestMove) continue; updateHHScore(pos, sd, move, -malus); - updateCHScore(ss, move, -malus); + updateCHScore(ss, move, -conthist_malus); if (rootNode) - updateRHScore(pos, sd, move, -malus); + updateRHScore(pos, sd, move, -roothist_malus); } } else { // increase the bestMove Capthist score - updateCapthistScore(pos, sd, bestMove, bonus); + updateCapthistScore(pos, sd, bestMove, capthist_bonus); } // For all the noisy moves that didn't cause a cut-off, even is the bestMove wasn't a noisy move, decrease the capthist score for (int i = 0; i < noisyMoves->count; i++) { const Move move = noisyMoves->moves[i].move; if (move == bestMove) continue; - updateCapthistScore(pos, sd, move, -malus); + updateCapthistScore(pos, sd, move, -capthist_malus); } } diff --git a/src/init.h b/src/init.h index 03b245e3..e36c4684 100644 --- a/src/init.h +++ b/src/init.h @@ -16,3 +16,5 @@ void InitNewGame(ThreadData* td); void InitAttackTables(); void InitAll(); +// has to be exposed for tuning refreshes +void InitReductions(); diff --git a/src/tune.h b/src/tune.h index 1cebe3dc..0bfc74ff 100644 --- a/src/tune.h +++ b/src/tune.h @@ -88,49 +88,75 @@ inline bool updateTuneVariable(std::string tune_variable_name, int value) // TM STUFF // SOFT/HARD bounds -TUNE_PARAM(baseMultiplier, 59, 20, 150, 7, 0.002) -TUNE_PARAM(incMultiplier, 84, 50, 150, 5, 0.002) -TUNE_PARAM(maxBoundMultiplier, 73, 50, 90, 2, 0.002) -TUNE_PARAM(optTimeMultiplier, 79, 50, 90, 2, 0.002) -TUNE_PARAM(maxTimeMultiplier, 284, 100, 500, 20, 0.002) +TUNE_PARAM(baseMultiplier, 55, 20, 150, 7, 0.002) +TUNE_PARAM(incMultiplier, 94, 50, 150, 5, 0.002) +TUNE_PARAM(maxBoundMultiplier, 74, 50, 90, 2, 0.002) +TUNE_PARAM(optTimeMultiplier, 81, 50, 90, 2, 0.002) +TUNE_PARAM(maxTimeMultiplier, 264, 100, 500, 20, 0.002) // Bestmove stability -TUNE_PARAM(bmScale1, 247, 50, 300, 10, 0.002) +TUNE_PARAM(bmScale1, 256, 50, 300, 10, 0.002) TUNE_PARAM(bmScale2, 147, 50, 200, 10, 0.002) -TUNE_PARAM(bmScale3, 116, 50, 150, 6, 0.002) -TUNE_PARAM(bmScale4, 90, 40, 110, 5, 0.002) -TUNE_PARAM(bmScale5, 65, 35, 100, 5, 0.002) +TUNE_PARAM(bmScale3, 123, 50, 150, 6, 0.002) +TUNE_PARAM(bmScale4, 95, 40, 110, 5, 0.002) +TUNE_PARAM(bmScale5, 74, 35, 100, 5, 0.002) // Eval stability -TUNE_PARAM(evalScale1, 120, 90, 160, 4, 0.002) -TUNE_PARAM(evalScale2, 118, 80, 150, 4, 0.002) -TUNE_PARAM(evalScale3, 103, 80, 150, 4, 0.002) -TUNE_PARAM(evalScale4, 100, 60, 130, 4, 0.002) -TUNE_PARAM(evalScale5, 83, 40, 110, 4, 0.002) +TUNE_PARAM(evalScale1, 121, 90, 160, 4, 0.002) +TUNE_PARAM(evalScale2, 120, 80, 150, 4, 0.002) +TUNE_PARAM(evalScale3, 98, 80, 150, 4, 0.002) +TUNE_PARAM(evalScale4, 91, 60, 130, 4, 0.002) +TUNE_PARAM(evalScale5, 91, 40, 110, 4, 0.002) // Node Tm -TUNE_PARAM(nodeTmBase, 152, 100, 300, 10, 0.002) -TUNE_PARAM(nodeTmMultiplier, 183, 80, 250, 8, 0.002) - +TUNE_PARAM(nodeTmBase, 143, 100, 300, 10, 0.002) +TUNE_PARAM(nodeTmMultiplier, 194, 80, 250, 8, 0.002) // Search -TUNE_PARAM(rfpDepthMargin, 79, 40, 200, 10, 0.002) -TUNE_PARAM(rfpImprovingMargin, 79, 40, 200, 10, 0.002) -TUNE_PARAM(rfpIIRMargin, 79, 40, 200, 10, 0.002) -TUNE_PARAM(nmpReductionEvalDivisor, 195, 100, 400, 20, 0.002) -TUNE_PARAM(razoringCoeff, 243, 100, 400, 20, 0.002) -TUNE_PARAM(historyQuietLmrDivisor, 8177, 1, 16383, 100, 0.002) -TUNE_PARAM(historyNoisyLmrDivisor, 5941, 1, 16383, 100, 0.002) -TUNE_PARAM(doDeeperBaseMargin, 117, 1, 200, 20, 0.002) -TUNE_PARAM(qsBaseFutility, 295, -500, 500, 25, 0.002) -TUNE_PARAM(historyBonusMax, 1286, 1, 4096, 256, 0.002) -TUNE_PARAM(historyMalusMax, 1286, 1, 4096, 256, 0.002) -TUNE_PARAM(lmrQuietBase, 106, 40, 150, 7, 0.002) -TUNE_PARAM(lmrQuietDivisor, 229, 150, 500, 15, 0.002) -TUNE_PARAM(lmrNoisyBase, -27, -70, 100, 7, 0.002) -TUNE_PARAM(lmrNoisytDivisor, 234, 150, 500, 15, 0.002) -TUNE_PARAM(seeQuietMargin, -93, -150, -20, 5, 0.002) -TUNE_PARAM(seeNoisyMargin, -34, -100, -1, 3, 0.002) -TUNE_PARAM(futilityCoeff0, 242, 40, 300, 10, 0.002) -TUNE_PARAM(futilityCoeff1, 137, 40, 200, 10, 0.002) -TUNE_PARAM(lmrDepthDivisor, 8135, 1, 16383, 100, 0.002) +TUNE_PARAM(rfpDepthMargin, 98, 40, 200, 10, 0.002) +TUNE_PARAM(rfpImprovingMargin, 70, 40, 200, 10, 0.002) +TUNE_PARAM(rfpIIRMargin, 96, 40, 200, 10, 0.002) +TUNE_PARAM(nmpReductionEvalDivisor, 215, 100, 400, 20, 0.002) +TUNE_PARAM(razoringCoeff, 226, 100, 400, 20, 0.002) +TUNE_PARAM(historyQuietLmrDivisor, 8123, 1, 16383, 100, 0.002) +TUNE_PARAM(historyNoisyLmrDivisor, 5882, 1, 16383, 100, 0.002) +TUNE_PARAM(doDeeperBaseMargin, 113, 1, 200, 20, 0.002) +TUNE_PARAM(qsBaseFutility, 269, -500, 500, 25, 0.002) +// HH +TUNE_PARAM(historyBonusMul, 310, 1, 1500, 32, 0.002) +TUNE_PARAM(historyBonusOffset, -98, -1024, 1024, 64, 0.002) +TUNE_PARAM(historyBonusMax, 2203, 1, 4096, 256, 0.002) +TUNE_PARAM(historyMalusMul, 408, 1, 1500, 32, 0.002) +TUNE_PARAM(historyMalusOffset, -3, -1024, 1024, 64, 0.002) +TUNE_PARAM(historyMalusMax, 1050, 1, 4096, 256, 0.002) +// Capthist +TUNE_PARAM(capthistoryBonusMul, 300, 1, 1500, 32, 0.002) +TUNE_PARAM(capthistoryBonusOffset, 34, -1024, 1024, 64, 0.002) +TUNE_PARAM(capthistoryBonusMax, 2200, 1, 4096, 256, 0.002) +TUNE_PARAM(capthistoryMalusMul, 311, 1, 1500, 32, 0.002) +TUNE_PARAM(capthistoryMalusOffset, -109, -1024, 1024, 64, 0.002) +TUNE_PARAM(capthistoryMalusMax, 1634, 1, 4096, 256, 0.002) +// Conthist +TUNE_PARAM(conthistoryBonusMul, 233, 1, 1500, 32, 0.002) +TUNE_PARAM(conthistoryBonusOffset, -96, -1024, 1024, 64, 0.002) +TUNE_PARAM(conthistoryBonusMax, 2164, 1, 4096, 256, 0.002) +TUNE_PARAM(conthistoryMalusMul, 338, 1, 1500, 32, 0.002) +TUNE_PARAM(conthistoryMalusOffset, -14, -1024, 1024, 64, 0.002) +TUNE_PARAM(conthistoryMalusMax, 1815, 1, 4096, 256, 0.002) +// Roothist +TUNE_PARAM(roothistoryBonusMul, 220, 1, 1500, 32, 0.002) +TUNE_PARAM(roothistoryBonusOffset, 186, -1024, 1024, 64, 0.002) +TUNE_PARAM(roothistoryBonusMax, 1979, 1, 4096, 256, 0.002) +TUNE_PARAM(roothistoryMalusMul, 401, 1, 1500, 32, 0.002) +TUNE_PARAM(roothistoryMalusOffset, 0, -1024, 1024, 64, 0.002) +TUNE_PARAM(roothistoryMalusMax, 1083, 1, 4096, 256, 0.002) +// LMR +TUNE_PARAM(lmrQuietBase, 102, 40, 150, 7, 0.002) +TUNE_PARAM(lmrQuietDivisor, 222, 150, 500, 15, 0.002) +TUNE_PARAM(lmrNoisyBase, -43, -70, 100, 7, 0.002) +TUNE_PARAM(lmrNoisytDivisor, 229, 150, 500, 15, 0.002) +TUNE_PARAM(seeQuietMargin, -92, -150, -20, 5, 0.002) +TUNE_PARAM(seeNoisyMargin, -30, -100, -1, 3, 0.002) +TUNE_PARAM(futilityCoeff0, 257, 40, 300, 10, 0.002) +TUNE_PARAM(futilityCoeff1, 117, 40, 200, 10, 0.002) +TUNE_PARAM(lmrDepthDivisor, 8107, 1, 16383, 100, 0.002) diff --git a/src/types.h b/src/types.h index 3a7411ae..38f1e9c1 100644 --- a/src/types.h +++ b/src/types.h @@ -4,7 +4,7 @@ // include the tune stuff here to give it global visibility #include "tune.h" -#define NAME "Alexandria-7.1.9" +#define NAME "Alexandria-7.1.10" inline int reductions[2][64][64]; inline int lmp_margin[64][2];