Skip to content

Commit

Permalink
TESTING: Add --terminator for testing purposes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mardak committed Apr 2, 2019
1 parent 1f86254 commit fd3885c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/mcts/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ const OptionId SearchParams::kTemperatureVisitOffsetId{
"Adjusts visits by this value when picking a move with a temperature. If a "
"negative offset reduces visits for a particular move below zero, that "
"move is not picked. If no moves can be picked, no temperature is used."};
const OptionId SearchParams::kTerminatorId{
"terminator", "Terminator", "I'll be back!"};
const OptionId SearchParams::kNoiseId{
"noise", "DirichletNoise",
"Add Dirichlet noise to root node prior probabilities. This allows the "
Expand Down Expand Up @@ -194,6 +196,7 @@ void SearchParams::Populate(OptionsParser* options) {
options->Add<FloatOption>(kTemperatureWinpctCutoffId, 0.0f, 100.0f) = 100.0f;
options->Add<FloatOption>(kTemperatureVisitOffsetId, -1000.0f, 1000.0f) =
0.0f;
options->Add<BoolOption>(kTerminatorId) = false;
options->Add<BoolOption>(kNoiseId) = false;
options->Add<BoolOption>(kVerboseStatsId) = false;
options->Add<BoolOption>(kLogLiveStatsId) = false;
Expand Down Expand Up @@ -226,6 +229,7 @@ SearchParams::SearchParams(const OptionsDict& options)
kCpuct(options.Get<float>(kCpuctId.GetId())),
kCpuctBase(options.Get<float>(kCpuctBaseId.GetId())),
kCpuctFactor(options.Get<float>(kCpuctFactorId.GetId())),
kTerminator(options.Get<bool>(kTerminatorId.GetId())),
kNoise(options.Get<bool>(kNoiseId.GetId())),
kSmartPruningFactor(options.Get<float>(kSmartPruningFactorId.GetId())),
kFpuAbsolute(options.Get<std::string>(kFpuStrategyId.GetId()) ==
Expand Down
3 changes: 3 additions & 0 deletions src/mcts/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class SearchParams {
return options_.Get<float>(kTemperatureWinpctCutoffId.GetId());
}

bool GetTerminator() const { return kTerminator; }
bool GetNoise() const { return kNoise; }
bool GetVerboseStats() const {
return options_.Get<bool>(kVerboseStatsId.GetId());
Expand Down Expand Up @@ -110,6 +111,7 @@ class SearchParams {
static const OptionId kTemperatureEndgameId;
static const OptionId kTemperatureWinpctCutoffId;
static const OptionId kTemperatureVisitOffsetId;
static const OptionId kTerminatorId;
static const OptionId kNoiseId;
static const OptionId kVerboseStatsId;
static const OptionId kLogLiveStatsId;
Expand Down Expand Up @@ -141,6 +143,7 @@ class SearchParams {
const float kCpuct;
const float kCpuctBase;
const float kCpuctFactor;
const bool kTerminator;
const bool kNoise;
const float kSmartPruningFactor;
const bool kFpuAbsolute;
Expand Down
2 changes: 1 addition & 1 deletion src/mcts/search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ void SearchWorker::DoBackupUpdateSingleNode(
}

// For the first visit to a terminal, maybe convert ancestors to terminal too.
auto can_convert = node->IsTerminal() && !node->GetN();
auto can_convert = params_.GetTerminator() && node->IsTerminal() && !node->GetN();

// Backup V value up to a root. After 1 visit, V = Q.
float v = node_to_process.v;
Expand Down

0 comments on commit fd3885c

Please sign in to comment.