Skip to content

Commit

Permalink
- improving の処理、追加。
Browse files Browse the repository at this point in the history
- singularの係数調整。
  • Loading branch information
yaneurao committed Nov 27, 2024
1 parent e6d31cb commit ec9f51f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions source/engine/yaneuraou-engine/yaneuraou-param.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,16 @@ PARAM_DEFINE PARAM_SINGULAR_EXTENSION_DEPTH = 4;

// singular extensionのsingular betaを計算するときのマージン
// 重要度 ★★★★☆
// 元の値 = Stockfish 16 : 64 , Stockfish 17 : 54 , step = 8
// 元の値 = Stockfish 16 : 64 , Stockfish 17 : 54,56 , step = 8
// [PARAM] min:16,max:1024,step:4,interval:1,time_rate:1,fixed
PARAM_DEFINE PARAM_SINGULAR_MARGIN1 = 54;
PARAM_DEFINE PARAM_SINGULAR_MARGIN1 = 56;

// singular extensionのsingular betaを計算するときの係数
// 重要度 ★★★★☆
// 自己対局だとすごく強くなって見えるかもしれないが、まやかしである。
// 元の値 = Stockfish 16 : 57 , Stockfish 17 : 77 , step = 8
// 元の値 = Stockfish 16 : 57 , Stockfish 17 : 77,79 , step = 8
// [PARAM] min:0,max:1024,step:8,interval:2,time_rate:1,fixed
PARAM_DEFINE PARAM_SINGULAR_MARGIN2 = 77;
PARAM_DEFINE PARAM_SINGULAR_MARGIN2 = 79;

//
// LMR
Expand Down
13 changes: 8 additions & 5 deletions source/engine/yaneuraou-engine/yaneuraou-search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,9 @@ Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, boo

return beta + (eval - beta) / 3;

// ここでimproving計算しなおす。
improving |= ss->staticEval >= beta + 100;

// -----------------------
// Step 9. Null move search with verification search (~35 Elo)
// Step 9. 検証探索を伴うnull move探索(約35 Elo)
Expand Down Expand Up @@ -2751,7 +2754,7 @@ Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, boo
if (!rootNode
&& move == ttData.move
&& !excludedMove // 再帰的なsingular延長を除外する。
&& depth >= PARAM_SINGULAR_EXTENSION_DEPTH/*4*/ - (thisThread->completedDepth > 36) + ss->ttPv
&& depth >= PARAM_SINGULAR_EXTENSION_DEPTH/*4*/ - (thisThread->completedDepth > 33) + ss->ttPv
/* && ttValue != VALUE_NONE Already implicit in the next condition */
&& std::abs(ttData.value) < VALUE_TB_WIN_IN_MAX_PLY // 詰み絡みのスコアはsingular extensionはしない。(Stockfish 10~)
&& (ttData.bound & BOUND_LOWER)
Expand All @@ -2762,8 +2765,8 @@ Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, boo
{
// このmargin値は評価関数の性質に合わせて調整されるべき。
Value singularBeta = ttData.value
- (PARAM_SINGULAR_MARGIN1/*54*/
+ PARAM_SINGULAR_MARGIN2/*77*/ * (ss->ttPv && !PvNode)) * depth / 64;
- (PARAM_SINGULAR_MARGIN1
+ PARAM_SINGULAR_MARGIN2 * (ss->ttPv && !PvNode)) * depth / 64;
Depth singularDepth = newDepth / 2;

// move(ttMove)の指し手を以下のsearch()での探索から除外
Expand All @@ -2778,8 +2781,8 @@ Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, boo
// (延長され続けるとまずいので何らかの考慮は必要)
if (value < singularBeta)
{
int doubleMargin = 262 * PvNode - 204 * !ttCapture;
int tripleMargin = 97 + 266 * PvNode - 255 * !ttCapture + 94 * ss->ttPv;
int doubleMargin = 249 * PvNode - 194 * !ttCapture;
int tripleMargin = 94 + 287 * PvNode - 249 * !ttCapture + 99 * ss->ttPv;

// We make sure to limit the extensions in some way to avoid a search explosion
// 2重延長を制限することで探索の組合せ爆発を回避する。
Expand Down

0 comments on commit ec9f51f

Please sign in to comment.