Skip to content

Commit de0414b

Browse files
committed
Merge branch 'master' into cp-master
2 parents edb55d3 + daf933e commit de0414b

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

src/mcts/params.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ const OptionId SearchParams::kTemperatureWinpctCutoffId{
8484
"probability less than X than the best move) are not considered at all."};
8585
const OptionId SearchParams::kTemperatureVisitOffsetId{
8686
"temp-visit-offset", "TempVisitOffset",
87-
"Reduces visits by this value when picking a move with a temperature. When "
88-
"the offset is less than number of visits for a particular move, that move "
89-
"is not picked at all."};
87+
"Adjusts visits by this value when picking a move with a temperature. If a "
88+
"negative offset reduces visits for a particular move below zero, that "
89+
"move is not picked. If no moves can be picked, no temperature is used."};
9090
const OptionId SearchParams::kNoiseId{
9191
"noise", "DirichletNoise",
9292
"Add Dirichlet noise to root node prior probabilities. This allows the "
@@ -200,7 +200,7 @@ void SearchParams::Populate(OptionsParser* options) {
200200
options->Add<IntOption>(kTemperatureCutoffMoveId, 0, 1000) = 0;
201201
options->Add<FloatOption>(kTemperatureEndgameId, 0.0f, 100.0f) = 0.0f;
202202
options->Add<FloatOption>(kTemperatureWinpctCutoffId, 0.0f, 100.0f) = 100.0f;
203-
options->Add<FloatOption>(kTemperatureVisitOffsetId, -0.99999f, 1000.0f) =
203+
options->Add<FloatOption>(kTemperatureVisitOffsetId, -1000.0f, 1000.0f) =
204204
0.0f;
205205
options->Add<BoolOption>(kNoiseId) = false;
206206
options->Add<BoolOption>(kVerboseStatsId) = false;

src/mcts/search.cc

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,12 @@ void Search::UpdateKLDGain() {
342342
if (prev_dist_.size() != 0) {
343343
double sum1 = 0.0;
344344
double sum2 = 0.0;
345-
for (int i = 0; i < new_visits.size(); i++) {
345+
for (decltype(new_visits)::size_type i = 0; i < new_visits.size(); i++) {
346346
sum1 += prev_dist_[i];
347347
sum2 += new_visits[i];
348348
}
349349
double kldgain = 0.0;
350-
for (int i = 0; i < new_visits.size(); i++) {
350+
for (decltype(new_visits)::size_type i = 0; i < new_visits.size(); i++) {
351351
double o_p = prev_dist_[i] / sum1;
352352
double n_p = new_visits[i] / sum2;
353353
if (prev_dist_[i] != 0) {
@@ -437,8 +437,8 @@ void Search::UpdateRemainingMoves() {
437437
if (time_since_start > kSmartPruningToleranceMs) {
438438
const auto nps = 1000LL *
439439
(total_playouts_ + kSmartPruningToleranceNodes) /
440-
time_since_start +
441-
1;
440+
time_since_start +
441+
1;
442442
const int64_t remaining_time = GetTimeToDeadline();
443443
// Put early_exit scaler here so calculation doesn't have to be done on
444444
// every node.
@@ -454,8 +454,8 @@ void Search::UpdateRemainingMoves() {
454454
// Add kMiniBatchSize, as it's possible to exceed visits limit by that
455455
// number.
456456
const auto remaining_visits = limits_.visits - total_playouts_ -
457-
initial_visits_ +
458-
params_.GetMiniBatchSize() - 1;
457+
initial_visits_ + params_.GetMiniBatchSize() -
458+
1;
459459

460460
if (remaining_visits < remaining_playouts_)
461461
remaining_playouts_ = remaining_visits;
@@ -516,15 +516,12 @@ int Search::PopulateRootMoveLimit(MoveList* root_moves) const {
516516
(board.ours() | board.theirs()).count() > syzygy_tb_->max_cardinality()) {
517517
return 0;
518518
}
519-
520-
int best_rank = syzygy_tb_->root_probe(
521-
played_history_.Last(),
522-
params_.GetSyzygyFastPlay() ||
523-
played_history_.DidRepeatSinceLastZeroingMove(),
524-
root_moves);
525-
if (!best_rank)
526-
best_rank = syzygy_tb_->root_probe_wdl(played_history_.Last(), root_moves);
527-
return best_rank;
519+
return syzygy_tb_->root_probe(
520+
played_history_.Last(),
521+
params_.GetSyzygyFastPlay() ||
522+
played_history_.DidRepeatSinceLastZeroingMove(),
523+
root_moves) ||
524+
syzygy_tb_->root_probe_wdl(played_history_.Last(), root_moves);
528525
}
529526

530527
// Computes the best move, maybe with temperature (according to the settings).
@@ -606,7 +603,7 @@ std::vector<EdgeAndNode> Search::GetBestChildrenNoTemperature(Node* parent,
606603
// Final sort pass.
607604
const auto middle = (static_cast<int>(edges.size()) > count)
608605
? edges.begin() + count
609-
: edges.end();
606+
: edges.end();
610607
std::partial_sort(edges.begin(), middle, edges.end(), std::greater<El>());
611608

612609
std::vector<EdgeAndNode> res;

0 commit comments

Comments
 (0)