Simplify verification search (#1362)

1. avoid recursive call of verification.
   For the interested side to move recursion makes no sense.
   For the other side it could make sense in case of mutual zugzwang,
   but I was not able to figure out any concrete problematic position.
   Allows the removal of 2 local variables.
   
2. avoid further reduction by removing R += ONE_PLY;

Benchmark with zugzwang-suite (see #1338), max 45 secs per position:
Patch  solves 33 out of 37
Master solves 31 out of 37

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 76188 W: 13866 L: 13840 D: 48482
http://tests.stockfishchess.org/tests/view/5a5612ed0ebc590297da516c

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 40479 W: 5247 L: 5152 D: 30080
http://tests.stockfishchess.org/tests/view/5a56f7d30ebc590299e4550e

bench: 5340015
This commit is contained in:
Günther Demetz
2018-01-13 09:01:23 +01:00
committed by Marco Costalba
parent aa88261a8f
commit 1b6459195c
3 changed files with 7 additions and 12 deletions
+5 -8
View File
@@ -676,7 +676,7 @@ namespace {
if ( !PvNode
&& eval >= beta
&& ss->staticEval >= beta - 36 * depth / ONE_PLY + 225
&& (ss->ply >= thisThread->nmp_ply || ss->ply % 2 == thisThread->pair))
&& (ss->ply >= thisThread->nmp_ply || ss->ply % 2 != thisThread->nmp_odd))
{
assert(eval - beta >= 0);
@@ -698,21 +698,18 @@ namespace {
if (nullValue >= VALUE_MATE_IN_MAX_PLY)
nullValue = beta;
if (depth < 12 * ONE_PLY && abs(beta) < VALUE_KNOWN_WIN)
if (abs(beta) < VALUE_KNOWN_WIN && (depth < 12 * ONE_PLY || thisThread->nmp_ply))
return nullValue;
// Do verification search at high depths
R += ONE_PLY;
// disable null move pruning for side to move for the first part of the remaining search tree
int nmp_ply = thisThread->nmp_ply;
int pair = thisThread->pair;
thisThread->nmp_ply = ss->ply + 3 * (depth-R) / 4;
thisThread->pair = (ss->ply % 2) == 0;
thisThread->nmp_odd = ss->ply % 2;
Value v = depth-R < ONE_PLY ? qsearch<NonPV, false>(pos, ss, beta-1, beta)
: search<NonPV>(pos, ss, beta-1, beta, depth-R, false, true);
thisThread->pair = pair;
thisThread->nmp_ply = nmp_ply;
thisThread->nmp_odd = thisThread->nmp_ply = 0;
if (v >= beta)
return nullValue;