From 95049461416e53b7a7e2482e5d4f5851d88ffbe8 Mon Sep 17 00:00:00 2001 From: yaneurao Date: Wed, 27 Nov 2024 19:58:40 +0900 Subject: [PATCH] =?UTF-8?q?-=20futilityMult=E3=81=AE=E4=BF=82=E6=95=B0?= =?UTF-8?q?=E8=AA=BF=E6=95=B4=E3=80=82=20-=20stat=5Fbonus,=20stat=5Fmalus?= =?UTF-8?q?=E3=81=AE=E4=BF=82=E6=95=B0=E8=AA=BF=E6=95=B4=E3=80=82=20-=20fa?= =?UTF-8?q?llingEval=E3=81=AE=E4=BF=82=E6=95=B0=E8=AA=BF=E6=95=B4=E3=80=82?= =?UTF-8?q?=20-=20captureHistory=E3=81=AE=E5=88=9D=E6=9C=9F=E5=80=A4?= =?UTF-8?q?=E3=80=810=20=E2=87=A8=20-758=20=E3=81=AB=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=E3=80=82=20-=20continuationHistory=E3=81=AE=E5=88=9D=E6=9C=9F?= =?UTF-8?q?=E5=80=A4=E3=80=81678=20=E2=87=A8=20648=20=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=80=82=20-=20Reductions=E3=81=AE=E5=88=9D=E6=9C=9F?= =?UTF-8?q?=E5=8C=96=E4=BF=82=E6=95=B0=E8=AA=BF=E6=95=B4=E3=80=82PARAM=5FR?= =?UTF-8?q?EDUCTIONS=5FPARAM1=201843=20=E2=87=A8=201943?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/yaneuraou-engine/yaneuraou-param.h | 12 +++++------ .../yaneuraou-engine/yaneuraou-search.cpp | 20 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/source/engine/yaneuraou-engine/yaneuraou-param.h b/source/engine/yaneuraou-engine/yaneuraou-param.h index f520ce03e..9b92b183d 100644 --- a/source/engine/yaneuraou-engine/yaneuraou-param.h +++ b/source/engine/yaneuraou-engine/yaneuraou-param.h @@ -27,9 +27,9 @@ // Reductionsテーブルの初期化用 // 重要度 ★★★★★ -// 元の値 = Stockfish 16 : 2037 , Stockfish 17 : 1843 ,step = 8 +// 元の値 = Stockfish 16 : 2037 , Stockfish 17(2024.8) : 1843 ,Stockfish 17(2024.11) : 1943 , step = 8 // [PARAM] min:1500,max:2500,step:2,interval:2,time_rate:1,fixed -PARAM_DEFINE PARAM_REDUCTIONS_PARAM1 = 1843; +PARAM_DEFINE PARAM_REDUCTIONS_PARAM1 = 1943; // Reductionの計算式に出てくる定数 // 重要度 ★★★★☆ @@ -58,14 +58,14 @@ PARAM_DEFINE PARAM_REDUCTION_GAMMA = 795; // 深さに比例したfutility pruning // 重要度 ★★★★☆ -// 元の値 = 118 , step = 20 +// 元の値 = 109 , step = 20 // [PARAM] min:100,max:300,step:10,interval:2,time_rate:1,fixed -PARAM_DEFINE PARAM_FUTILITY_MARGIN_ALPHA1 = 118; +PARAM_DEFINE PARAM_FUTILITY_MARGIN_ALPHA1 = 109; // 重要度 ★★★★☆ -// 元の値 = 33 , step = 10 +// 元の値 = 27 , step = 10 // [PARAM] min:10,max:200,step:5,interval:1,time_rate:1, -PARAM_DEFINE PARAM_FUTILITY_MARGIN_ALPHA2 = 33; +PARAM_DEFINE PARAM_FUTILITY_MARGIN_ALPHA2 = 27; // 重要度 ★★★★☆ // 元の値 = 138 , step = 30 diff --git a/source/engine/yaneuraou-engine/yaneuraou-search.cpp b/source/engine/yaneuraou-engine/yaneuraou-search.cpp index bc13f3558..e76c2a81d 100644 --- a/source/engine/yaneuraou-engine/yaneuraou-search.cpp +++ b/source/engine/yaneuraou-engine/yaneuraou-search.cpp @@ -197,7 +197,7 @@ namespace { // depth(残り探索深さ)に応じたfutility margin。 // ※ RazoringはStockfish12で効果がないとされてしまい除去された。 Value futility_margin(Depth d, bool noTtCutNode, bool improving, bool oppWorsening) { - Value futilityMult = Value(PARAM_FUTILITY_MARGIN_ALPHA1 - PARAM_FUTILITY_MARGIN_ALPHA2 * noTtCutNode); + Value futilityMult = Value(PARAM_FUTILITY_MARGIN_ALPHA1 - PARAM_FUTILITY_MARGIN_ALPHA2 * noTtCutNode); Value improvingDeduction = Value(int(improving) * futilityMult * 2); Value worseningDeduction = Value(int(oppWorsening) * futilityMult / 3); return Value(futilityMult * d - improvingDeduction - worseningDeduction); @@ -254,8 +254,8 @@ Value to_corrected_static_eval(Value v /*, const Worker& w, const Position& pos const auto micv = w.minorPieceCorrectionHistory[us][minor_piece_index(pos)]; const auto wnpcv = w.nonPawnCorrectionHistory[WHITE][us][non_pawn_index(pos)]; const auto bnpcv = w.nonPawnCorrectionHistory[BLACK][us][non_pawn_index(pos)]; - const auto cv = - (6245 * pcv + 3442 * mcv + 3471 * macv + 5958 * micv + 6566 * (wnpcv + bnpcv)) / 131072; + const auto cv = + (6384 * pcv + 3583 * macv + 6492 * micv + 6725 * (wnpcv + bnpcv) + cntcv * 5880) / 131072; v += cv; return std::clamp(v, VALUE_TB_LOSS_IN_MAX_PLY + 1, VALUE_TB_WIN_IN_MAX_PLY - 1); @@ -270,7 +270,7 @@ Value to_corrected_static_eval(Value v /*, const Worker& w, const Position& pos // History and stats update bonus, based on depth // depthに基づく、historyとstatsのupdate bonus -int stat_bonus(Depth d) { return std::min(179 * d - 108, 1598); } +int stat_bonus(Depth d) { return std::min(168 * d - 100, 1718); } // → やねうら王では、Stockfishの統計値、統計ボーナスに関して手を加えないことにしているので // この値はStockfishの値そのまま。 @@ -280,7 +280,7 @@ int stat_bonus(Depth d) { return std::min(179 * d - 108, 1598); } // 「統計的なペナルティ」または「マイナスの修正値」を計算するために使用される。 // この関数は、ある行動が望ましくない結果をもたらした場合に、その行動の評価を減少させるために使われる // TODO : あとで -int stat_malus(Depth d) { return std::min(820 * d - 261, 2246); } +int stat_malus(Depth d) { return std::min(768 * d - 257, 2351); } #if 0 @@ -468,7 +468,8 @@ void Search::clear() ; for (size_t i = 1; i < reductions.size(); ++i) - reductions[i] = int((PARAM_REDUCTIONS_PARAM1 / 100.0 /*(100で割ったあとの数値が)18.43*/ + std::log(THREAD_SIZE) / 2) * std::log(i)); + reductions[i] = int((PARAM_REDUCTIONS_PARAM1 / 100.0 /*(100で割ったあとの数値が)19.43*/ + + std::log(THREAD_SIZE) / 2) * std::log(i)); // TODO あとで // ここ、log(THREAD_SIZE)/2 の /2 のところ、何か良さげな係数を掛けて調整すべきだと思う。 @@ -1101,7 +1102,7 @@ void Thread::search() beta = std::min(avg + delta, VALUE_INFINITE); // Adjust optimism based on root move's previousScore (~4 Elo) - //optimism[us] = 132 * avg / (std::abs(avg) + 89); + //optimism[ us] = 150 * avg / (std::abs(avg) + 85); //optimism[~us] = -optimism[us]; // → このoptimismは、StockfishのNNUE評価関数で何やら使っているようなのだが…。 @@ -1310,8 +1311,9 @@ void Thread::search() { // 1つしか合法手がない(one reply)であるだとか、利用できる時間を使いきっているだとか、 - double fallingEval = (1067 + 223 * (mainThread->bestPreviousAverageScore - bestValue) - + 97 * (mainThread->iterValue[iterIdx] - bestValue)) / 10000.0; + double fallingEval = (11 + 2 * (mainThread->bestPreviousAverageScore - bestValue) + + (mainThread->iterValue[iterIdx] - bestValue)) + / 100.0; fallingEval = std::clamp(fallingEval, 0.580, 1.667); // If the bestMove is stable over several iterations, reduce time accordingly