mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 12:07:43 +00:00
Flag critical search tree in hash table
Introducing new concept, saving principal lines into the transposition table to generate a "critical search tree" which we can reuse later for intelligent pruning/extension decisions. For instance in this patch we just reduce reduction for these lines. But a lot of other ideas are possible. To go further : tune some parameters, how to add or remove lines from the critical search tree, how to use these lines in search choices, etc. STC : LLR: 2.94 (-2.94,2.94) [0.50,4.50] Total: 59761 W: 13321 L: 12863 D: 33577 +2.23 ELO http://tests.stockfishchess.org/tests/view/5c34da5d0ebc596a450c53d3 LTC : LLR: 2.96 (-2.94,2.94) [0.00,3.50] Total: 26826 W: 4439 L: 4191 D: 18196 +2.9 ELO http://tests.stockfishchess.org/tests/view/5c35ceb00ebc596a450c65b2 Special thanks to Miguel Lahoz for his help in transposition table in/out. Bench: 3399866
This commit is contained in:
committed by
Stéphane Nicolet
parent
f69106f7bb
commit
70880b8e24
+19
-7
@@ -577,7 +577,7 @@ namespace {
|
||||
Move ttMove, move, excludedMove, bestMove;
|
||||
Depth extension, newDepth;
|
||||
Value bestValue, value, ttValue, eval, maxValue, pureStaticEval;
|
||||
bool ttHit, inCheck, givesCheck, improving;
|
||||
bool ttHit, pvHit, inCheck, givesCheck, improving;
|
||||
bool captureOrPromotion, doFullDepthSearch, moveCountPruning, skipQuiets, ttCapture, pvExact;
|
||||
Piece movedPiece;
|
||||
int moveCount, captureCount, quietCount;
|
||||
@@ -643,6 +643,7 @@ namespace {
|
||||
ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE;
|
||||
ttMove = rootNode ? thisThread->rootMoves[thisThread->pvIdx].pv[0]
|
||||
: ttHit ? tte->move() : MOVE_NONE;
|
||||
pvHit = ttHit ? tte->pv_hit() : false;
|
||||
|
||||
// At non-PV nodes we check for an early TT cutoff
|
||||
if ( !PvNode
|
||||
@@ -676,6 +677,11 @@ namespace {
|
||||
return ttValue;
|
||||
}
|
||||
|
||||
if ( depth > 6 * ONE_PLY
|
||||
&& !excludedMove
|
||||
&& PvNode)
|
||||
pvHit = true;
|
||||
|
||||
// Step 5. Tablebases probe
|
||||
if (!rootNode && TB::Cardinality)
|
||||
{
|
||||
@@ -709,7 +715,7 @@ namespace {
|
||||
if ( b == BOUND_EXACT
|
||||
|| (b == BOUND_LOWER ? value >= beta : value <= alpha))
|
||||
{
|
||||
tte->save(posKey, value_to_tt(value, ss->ply), b,
|
||||
tte->save(posKey, value_to_tt(value, ss->ply), pvHit, b,
|
||||
std::min(DEPTH_MAX - ONE_PLY, depth + 6 * ONE_PLY),
|
||||
MOVE_NONE, VALUE_NONE);
|
||||
|
||||
@@ -760,7 +766,7 @@ namespace {
|
||||
else
|
||||
ss->staticEval = eval = pureStaticEval = -(ss-1)->staticEval + 2 * Eval::Tempo;
|
||||
|
||||
tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, pureStaticEval);
|
||||
tte->save(posKey, VALUE_NONE, pvHit, BOUND_NONE, DEPTH_NONE, MOVE_NONE, pureStaticEval);
|
||||
}
|
||||
|
||||
// Step 7. Razoring (~2 Elo)
|
||||
@@ -875,6 +881,7 @@ namespace {
|
||||
tte = TT.probe(posKey, ttHit);
|
||||
ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE;
|
||||
ttMove = ttHit ? tte->move() : MOVE_NONE;
|
||||
pvHit = ttHit ? tte->pv_hit() : false;
|
||||
}
|
||||
|
||||
moves_loop: // When in check, search starts from here
|
||||
@@ -1035,6 +1042,10 @@ moves_loop: // When in check, search starts from here
|
||||
{
|
||||
Depth r = reduction<PvNode>(improving, depth, moveCount);
|
||||
|
||||
// Decrease reduction if position is or has been on the PV
|
||||
if (pvHit && !PvNode)
|
||||
r -= ONE_PLY;
|
||||
|
||||
// Decrease reduction if opponent's move count is high (~10 Elo)
|
||||
if ((ss-1)->moveCount > 15)
|
||||
r -= ONE_PLY;
|
||||
@@ -1217,7 +1228,7 @@ moves_loop: // When in check, search starts from here
|
||||
bestValue = std::min(bestValue, maxValue);
|
||||
|
||||
if (!excludedMove)
|
||||
tte->save(posKey, value_to_tt(bestValue, ss->ply),
|
||||
tte->save(posKey, value_to_tt(bestValue, ss->ply), pvHit,
|
||||
bestValue >= beta ? BOUND_LOWER :
|
||||
PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER,
|
||||
depth, bestMove, pureStaticEval);
|
||||
@@ -1247,7 +1258,7 @@ moves_loop: // When in check, search starts from here
|
||||
Move ttMove, move, bestMove;
|
||||
Depth ttDepth;
|
||||
Value bestValue, value, ttValue, futilityValue, futilityBase, oldAlpha;
|
||||
bool ttHit, inCheck, givesCheck, evasionPrunable;
|
||||
bool ttHit, pvHit, inCheck, givesCheck, evasionPrunable;
|
||||
int moveCount;
|
||||
|
||||
if (PvNode)
|
||||
@@ -1281,6 +1292,7 @@ moves_loop: // When in check, search starts from here
|
||||
tte = TT.probe(posKey, ttHit);
|
||||
ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE;
|
||||
ttMove = ttHit ? tte->move() : MOVE_NONE;
|
||||
pvHit = ttHit ? tte->pv_hit() : false;
|
||||
|
||||
if ( !PvNode
|
||||
&& ttHit
|
||||
@@ -1318,7 +1330,7 @@ moves_loop: // When in check, search starts from here
|
||||
if (bestValue >= beta)
|
||||
{
|
||||
if (!ttHit)
|
||||
tte->save(posKey, value_to_tt(bestValue, ss->ply), BOUND_LOWER,
|
||||
tte->save(posKey, value_to_tt(bestValue, ss->ply), pvHit, BOUND_LOWER,
|
||||
DEPTH_NONE, MOVE_NONE, ss->staticEval);
|
||||
|
||||
return bestValue;
|
||||
@@ -1429,7 +1441,7 @@ moves_loop: // When in check, search starts from here
|
||||
if (inCheck && bestValue == -VALUE_INFINITE)
|
||||
return mated_in(ss->ply); // Plies to mate from the root
|
||||
|
||||
tte->save(posKey, value_to_tt(bestValue, ss->ply),
|
||||
tte->save(posKey, value_to_tt(bestValue, ss->ply), pvHit,
|
||||
bestValue >= beta ? BOUND_LOWER :
|
||||
PvNode && bestValue > oldAlpha ? BOUND_EXACT : BOUND_UPPER,
|
||||
ttDepth, bestMove, ss->staticEval);
|
||||
|
||||
Reference in New Issue
Block a user