mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 16:47:37 +00:00
Changed a option name more descriptive, "Training" -> "PruneAtShallowDepthOnPvNode". The default value was changed but the default behavior is not changed.
Changed to set a global option prune_at_shallow_depth_on_pv_node on a callback function.
This commit is contained in:
+7
-5
@@ -54,6 +54,10 @@ using std::string;
|
|||||||
using Eval::evaluate;
|
using Eval::evaluate;
|
||||||
using namespace Search;
|
using namespace Search;
|
||||||
|
|
||||||
|
#if defined(EVAL_LEARN)
|
||||||
|
bool Search::prune_at_shallow_depth_on_pv_node = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Different node types, used as a template parameter
|
// Different node types, used as a template parameter
|
||||||
@@ -68,8 +72,6 @@ namespace {
|
|||||||
return Value(223 * (d - improving));
|
return Value(223 * (d - improving));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool training;
|
|
||||||
|
|
||||||
// Reductions lookup table, initialized at startup
|
// Reductions lookup table, initialized at startup
|
||||||
int Reductions[MAX_MOVES]; // [depth or moveNumber]
|
int Reductions[MAX_MOVES]; // [depth or moveNumber]
|
||||||
|
|
||||||
@@ -195,8 +197,6 @@ void Search::init() {
|
|||||||
|
|
||||||
for (int i = 1; i < MAX_MOVES; ++i)
|
for (int i = 1; i < MAX_MOVES; ++i)
|
||||||
Reductions[i] = int((22.0 + std::log(Threads.size())) * std::log(i));
|
Reductions[i] = int((22.0 + std::log(Threads.size())) * std::log(i));
|
||||||
|
|
||||||
training = Options["Training"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1011,7 +1011,9 @@ moves_loop: // When in check, search starts from here
|
|||||||
|
|
||||||
// Step 12. Pruning at shallow depth (~200 Elo)
|
// Step 12. Pruning at shallow depth (~200 Elo)
|
||||||
if ( !rootNode
|
if ( !rootNode
|
||||||
&& !(training && PvNode)
|
#ifdef EVAL_LEARN
|
||||||
|
&& !(!prune_at_shallow_depth_on_pv_node && PvNode)
|
||||||
|
#endif
|
||||||
&& pos.non_pawn_material(us)
|
&& pos.non_pawn_material(us)
|
||||||
&& bestValue > VALUE_TB_LOSS_IN_MAX_PLY)
|
&& bestValue > VALUE_TB_LOSS_IN_MAX_PLY)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ namespace Search {
|
|||||||
constexpr int CounterMovePruneThreshold = 0;
|
constexpr int CounterMovePruneThreshold = 0;
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(EVAL_LEARN)
|
||||||
|
extern bool prune_at_shallow_depth_on_pv_node;
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Stack struct keeps track of the information we need to remember from nodes
|
/// Stack struct keeps track of the information we need to remember from nodes
|
||||||
/// shallower and deeper in the tree during the search. Each search thread has
|
/// shallower and deeper in the tree during the search. Each search thread has
|
||||||
/// its own array of Stack objects, indexed by the current ply.
|
/// its own array of Stack objects, indexed by the current ply.
|
||||||
|
|||||||
+7
-1
@@ -42,6 +42,11 @@ void on_threads(const Option& o) { Threads.set(size_t(o)); }
|
|||||||
void on_tb_path(const Option& o) { Tablebases::init(o); }
|
void on_tb_path(const Option& o) { Tablebases::init(o); }
|
||||||
void on_use_NNUE(const Option& ) { Eval::init_NNUE(); }
|
void on_use_NNUE(const Option& ) { Eval::init_NNUE(); }
|
||||||
void on_eval_file(const Option& ) { Eval::init_NNUE(); }
|
void on_eval_file(const Option& ) { Eval::init_NNUE(); }
|
||||||
|
#ifdef EVAL_LEARN
|
||||||
|
void on_prune_at_shallow_depth_on_pv_node(const Option& o) {
|
||||||
|
Search::prune_at_shallow_depth_on_pv_node = o;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Our case insensitive less() function as required by UCI protocol
|
/// Our case insensitive less() function as required by UCI protocol
|
||||||
bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const {
|
bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const {
|
||||||
@@ -69,7 +74,6 @@ void init(OptionsMap& o) {
|
|||||||
o["Move Overhead"] << Option(10, 0, 5000);
|
o["Move Overhead"] << Option(10, 0, 5000);
|
||||||
o["Slow Mover"] << Option(100, 10, 1000);
|
o["Slow Mover"] << Option(100, 10, 1000);
|
||||||
o["nodestime"] << Option(0, 0, 10000);
|
o["nodestime"] << Option(0, 0, 10000);
|
||||||
o["Training"] << Option(false);
|
|
||||||
o["UCI_Chess960"] << Option(false);
|
o["UCI_Chess960"] << Option(false);
|
||||||
o["UCI_AnalyseMode"] << Option(false);
|
o["UCI_AnalyseMode"] << Option(false);
|
||||||
o["UCI_LimitStrength"] << Option(false);
|
o["UCI_LimitStrength"] << Option(false);
|
||||||
@@ -96,6 +100,8 @@ void init(OptionsMap& o) {
|
|||||||
// Evalsave by default. This folder shall be prepared in advance.
|
// Evalsave by default. This folder shall be prepared in advance.
|
||||||
// Automatically create a folder under this folder like "0/", "1/", ... and save the evaluation function file there.
|
// Automatically create a folder under this folder like "0/", "1/", ... and save the evaluation function file there.
|
||||||
o["EvalSaveDir"] << Option("evalsave");
|
o["EvalSaveDir"] << Option("evalsave");
|
||||||
|
// Prune at shallow depth on PV nodes. Setting this value to true gains elo in shallow search.
|
||||||
|
o["PruneAtShallowDepthOnPvNode"] << Option(false, on_prune_at_shallow_depth_on_pv_node);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user