Extend intermediate LMR to root search
authorMarco Costalba <mcostalba@gmail.com>
Wed, 2 Jun 2010 10:47:53 +0000 (11:47 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 3 Jun 2010 11:17:05 +0000 (12:17 +0100)
Almost no change, but it is in sync with what we do in search
and in any case the ELO difference is very small (because the
events when the intermediate research triggers are very rare),
too small to be measured, we just verify we don't have any
unexpected regressions.

After 802 games at 1+0 full QUAD
Mod vs Orig +114 =581 -107 +3 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index 6715d6808f3f26dc28261108247203b62eb1823f..91b7a867603841eb9612310039ca429b21983b62 100644 (file)
@@ -892,17 +892,31 @@ namespace {
                         ss->reduction = reduction<PV>(depth, i - MultiPV + 2);
                         if (ss->reduction)
                         {
+                            assert(newDepth-ss->reduction >= OnePly);
+
                             // Reduced depth non-pv search using alpha as upperbound
                             value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth-ss->reduction);
                             doFullDepthSearch = (value > alpha);
                         }
+
+                        // The move failed high, but if reduction is very big we could
+                        // face a false positive, retry with a less aggressive reduction,
+                        // if the move fails high again then go with full depth search.
+                        if (doFullDepthSearch && ss->reduction > 2 * OnePly)
+                        {
+                            assert(newDepth - OnePly >= OnePly);
+
+                            ss->reduction = OnePly;
+                            value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth-ss->reduction);
+                            doFullDepthSearch = (value > alpha);
+                        }
+                        ss->reduction = Depth(0); // Restore original reduction
                     }
 
                     // Step 15. Full depth search
                     if (doFullDepthSearch)
                     {
                         // Full depth non-pv search using alpha as upperbound
-                        ss->reduction = Depth(0);
                         value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth);
 
                         // If we are above alpha then research at same depth but as PV