mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Make futility and razor margins more tunable
Restructure RazorMargins and FutilityMargins arrays so that their values can be more easily tuned. Add RazorApprMargins array which replaces razorAtDepthOne concept, because setting RazorApprMargin very high value at ply one is same as not razoring there at all. Comment out setting razoring and futility margins through uci to avoid errors while tuning. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
f010b6db71
commit
342ceb1c91
2 changed files with 27 additions and 24 deletions
|
@ -180,14 +180,21 @@ namespace {
|
|||
|
||||
// Margins for futility pruning in the quiescence search, and at frontier
|
||||
// and near frontier nodes
|
||||
Value FutilityMarginQS;
|
||||
Value FutilityMargins[6] = { Value(0x100), Value(0x200), Value(0x250),
|
||||
Value(0x2A0), Value(0x340), Value(0x3A0) };
|
||||
const Value FutilityMarginQS = Value(0x80);
|
||||
|
||||
//remaining depth: 1 ply 1.5 ply 2 ply 2.5 ply 3 ply 3.5 ply
|
||||
const Value FutilityMargins[12] = { Value(0x100), Value(0x120), Value(0x200), Value(0x220), Value(0x250), Value(0x270),
|
||||
// 4 ply 4.5 ply 5 ply 5.5 ply 6 ply 6.5 ply
|
||||
Value(0x2A0), Value(0x2C0), Value(0x340), Value(0x360), Value(0x3A0), Value(0x3C0)};
|
||||
|
||||
// Razoring
|
||||
const bool RazorAtDepthOne = false;
|
||||
Depth RazorDepth;
|
||||
Value RazorMargin;
|
||||
const Depth RazorDepth = 4*OnePly;
|
||||
|
||||
//remaining depth: 1 ply 1.5 ply 2 ply 2.5 ply 3 ply 3.5 ply
|
||||
const Value RazorMargins[6] = { Value(0x180), Value(0x300), Value(0x300), Value(0x3C0), Value(0x3C0), Value(0x3C0) };
|
||||
|
||||
//remaining depth: 1 ply 1.5 ply 2 ply 2.5 ply 3 ply 3.5 ply
|
||||
const Value RazorApprMargins[6] = { Value(0x100000), Value(0x300), Value(0x300), Value(0x300), Value(0x300), Value(0x300) };
|
||||
|
||||
// Last seconds noise filtering (LSN)
|
||||
bool UseLSNFiltering;
|
||||
|
@ -437,13 +444,13 @@ void think(const Position &pos, bool infinite, bool ponder, int side_to_move,
|
|||
UseQSearchFutilityPruning = get_option_value_bool("Futility Pruning (Quiescence Search)");
|
||||
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 Scale Factor (Main Search)");
|
||||
for (int i = 0; i < 6; i++)
|
||||
FutilityMargins[i] = (FutilityMargins[i] * fmScale) / 100;
|
||||
//FutilityMarginQS = value_from_centipawns(get_option_value_int("Futility Margin (Quiescence Search)"));
|
||||
//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;
|
||||
|
||||
RazorDepth = (get_option_value_int("Maximum Razoring Depth") + 1) * OnePly;
|
||||
RazorMargin = value_from_centipawns(get_option_value_int("Razoring Margin"));
|
||||
//RazorDepth = (get_option_value_int("Maximum Razoring Depth") + 1) * OnePly;
|
||||
//RazorMargin = value_from_centipawns(get_option_value_int("Razoring Margin"));
|
||||
|
||||
UseLSNFiltering = get_option_value_bool("LSN filtering");
|
||||
LSNTime = get_option_value_int("LSN Time Margin (sec)") * 1000;
|
||||
|
@ -1310,17 +1317,14 @@ namespace {
|
|||
}
|
||||
// Null move search not allowed, try razoring
|
||||
else if ( !value_is_mate(beta)
|
||||
&& approximateEval < beta - RazorMargin
|
||||
&& depth < RazorDepth
|
||||
&& (RazorAtDepthOne || depth > OnePly)
|
||||
&& approximateEval < beta - RazorApprMargins[int(depth) - 2]
|
||||
&& 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 - RazorMargin / 4)
|
||||
|| (depth <= 2*OnePly && v < beta - RazorMargin)
|
||||
|| (depth <= OnePly && v < beta - RazorMargin / 2))
|
||||
return v;
|
||||
if (v < beta - RazorMargins[int(depth) - 2])
|
||||
return v;
|
||||
}
|
||||
|
||||
// Go with internal iterative deepening if we don't have a TT move
|
||||
|
@ -1379,8 +1383,7 @@ namespace {
|
|||
{
|
||||
if (futilityValue == VALUE_NONE)
|
||||
futilityValue = evaluate(pos, ei, threadID)
|
||||
+ FutilityMargins[int(depth)/2 - 1]
|
||||
+ 32 * (depth & 1);
|
||||
+ FutilityMargins[int(depth) - 2];
|
||||
|
||||
if (futilityValue < beta)
|
||||
{
|
||||
|
|
|
@ -128,10 +128,10 @@ namespace {
|
|||
o["Selective Plies"] = Option(7, 0, 10);
|
||||
o["Futility Pruning (Main Search)"] = Option(true);
|
||||
o["Futility Pruning (Quiescence Search)"] = Option(true);
|
||||
o["Futility Margin (Quiescence Search)"] = Option(50, 0, 1000);
|
||||
o["Futility Margin Scale Factor (Main Search)"] = Option(100, 0, 1000);
|
||||
o["Maximum Razoring Depth"] = Option(3, 0, 4);
|
||||
o["Razoring Margin"] = Option(300, 150, 600);
|
||||
//o["Futility Margin (Quiescence Search)"] = Option(50, 0, 1000);
|
||||
//o["Futility Margin Scale Factor (Main Search)"] = Option(100, 0, 1000);
|
||||
//o["Maximum Razoring Depth"] = Option(3, 0, 4);
|
||||
//o["Razoring Margin"] = Option(300, 150, 600);
|
||||
o["LSN filtering"] = Option(true);
|
||||
o["LSN Time Margin (sec)"] = Option(4, 1, 10);
|
||||
o["LSN Value Margin"] = Option(200, 100, 600);
|
||||
|
|
Loading…
Add table
Reference in a new issue