Skip to content

Commit

Permalink
Soft futility pruning, take 2. Bench: 4336799
Browse files Browse the repository at this point in the history
  • Loading branch information
snicolet committed Feb 13, 2018
1 parent fe5f9a0 commit 0e78abb
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/search.cpp
Expand Up @@ -68,7 +68,7 @@ namespace {

// Razoring and futility margins
const int RazorMargin = 600;
Value futility_margin(Depth d) { return Value(150 * d / ONE_PLY); }
Value futility_margin(Depth d) { return Value(30 + 150 * d / ONE_PLY); }

// Futility and reductions lookup tables, initialized at startup
int FutilityMoveCounts[2][16]; // [improving][depth]
Expand Down Expand Up @@ -665,22 +665,7 @@ namespace {
if (skipEarlyPruning || !pos.non_pawn_material(pos.side_to_move()))
goto moves_loop;

// Step 7. Futility pruning: child node (skipped when in check)
if ( !rootNode
&& depth < 7 * ONE_PLY
&& eval - 30 > beta
&& eval < VALUE_KNOWN_WIN) // Do not return unproven wins
{
if (eval - futility_margin(depth) >= beta)
return eval;

if (depth < 4 * ONE_PLY)
depth = std::max(DEPTH_ZERO, depth - ONE_PLY);
}

assert(depth >= DEPTH_ZERO);

// Step 8. Razoring (skipped when in check)
// Step 7. Razoring (skipped when in check)
if ( !PvNode
&& depth < 4 * ONE_PLY
&& eval + RazorMargin <= alpha)
Expand All @@ -694,6 +679,21 @@ namespace {
return v;
}

// Step 8. Futility pruning: child node (skipped when in check)
if ( !rootNode
&& depth < 7 * ONE_PLY
&& eval - 30 > beta
&& eval < VALUE_KNOWN_WIN) // Do not return unproven wins
{
if (depth < 4 * ONE_PLY)
depth = std::max(DEPTH_ZERO, depth - ONE_PLY);

if (eval - futility_margin(depth) >= beta)
return eval;
}

assert(depth >= DEPTH_ZERO);

// Step 9. Null move search with verification search
if ( !PvNode
&& eval >= beta
Expand Down

1 comment on commit 0e78abb

@jerrydonaldwatson
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the intention here to modify the futility margin for low depths as well as the soft futility? Because by reducing depth before accessing futility_margin() we are effectively reducing the futility margins at low depths in addition to the reduction.

Margins:
Base:
depth 1 150
depth 2 300
depth 3 450
depth 4 600

This patch:
depth 1 30
depth 2 180
depth 3 330
depth 4 600

etc.

Please sign in to comment.