Safer razoring formula
authorMarco Costalba <mcostalba@gmail.com>
Sun, 28 Dec 2008 11:55:33 +0000 (12:55 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 28 Dec 2008 11:55:33 +0000 (12:55 +0100)
Add also the possibility to razor at ply one.
It is disable dby default but it seems stronger
against Stockfish itself. It is still not clear if
is stronger against other engines. By now leave
disabled.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>

src/search.cpp
src/ucioption.cpp

index aaa2f51..39dcf97 100644 (file)
@@ -169,6 +169,7 @@ namespace {
                                Value(0x2A0), Value(0x340), Value(0x3A0) };
 
   // Razoring
+  const bool RazorAtDepthOne = false;
   Depth RazorDepth = 4*OnePly;
   Value RazorMargin = Value(0x300);
 
@@ -416,7 +417,7 @@ void think(const Position &pos, bool infinite, bool ponder, int side_to_move,
   UseFutilityPruning = get_option_value_bool("Futility Pruning (Main Search)");
 
   FutilityMarginQS = value_from_centipawns(get_option_value_int("Futility Margin (Quiescence Search)"));
-  int fmScale = get_option_value_int("Futility Margin (Main Serach)");
+  int fmScale = get_option_value_int("Futility Margin Scale Factor (Main Search)");
   for (int i = 0; i < 6; i++)
       FutilityMargins[i] = (FutilityMargins[i] * fmScale) / 100;
 
@@ -1241,12 +1242,14 @@ namespace {
     else if (   !value_is_mate(beta)
              && approximateEval < beta - RazorMargin
              && depth < RazorDepth
-             && depth > OnePly
+             && (RazorAtDepthOne || depth > OnePly)
              && ttMove == MOVE_NONE
              && !pos.has_pawn_on_7th(pos.side_to_move()))
     {
         Value v = qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID);
-        if (v < beta - RazorMargin / 2 - int(depth - OnePly) * RazorMargin / 8)
+        if (   (v < beta - RazorMargin - RazorMargin / 4)
+            || (depth <= 2*OnePly && v < beta - RazorMargin)
+            || (depth <=   OnePly && v < beta - RazorMargin / 2))
             return v;
     }
 
index e3ebaf1..5c78c00 100644 (file)
@@ -124,7 +124,7 @@ namespace {
     o.push_back(Option("Futility Pruning (Main Search)", true));
     o.push_back(Option("Futility Pruning (Quiescence Search)", true));
     o.push_back(Option("Futility Margin (Quiescence Search)", 50, 0, 1000));
-    o.push_back(Option("Futility Margin (Main Serach)", 100, 0, 1000));
+    o.push_back(Option("Futility Margin Scale Factor (Main Search)", 100, 0, 1000));
     o.push_back(Option("Maximum Razoring Depth", 3, 0, 4));
     o.push_back(Option("Razoring Margin", 300, 150, 600));
     o.push_back(Option("LSN filtering", true));