Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/mcts/search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,8 @@ void SearchWorker::DoBackupUpdateSingleNode(
// Nothing left to do without ancestors to update.
if (!p) break;

bool old_update_parent_bounds = update_parent_bounds;

// Try setting parent bounds except the root or those already terminal.
update_parent_bounds = update_parent_bounds && p != search_->root_node_ &&
!p->IsTerminal() && MaybeSetBounds(p, m);
Expand All @@ -1535,8 +1537,16 @@ void SearchWorker::DoBackupUpdateSingleNode(

// Update the stats.
// Best move.
// If update_parent_bounds was set, we just adjusted bounds on the
// previous loop or there was no previous loop, so if n is a terminal, it
// just became that way and could be a candidate for changing the current
// best edge. Otherwise a visit can only change best edge if its to an edge
// that isn't already the best and the new n is equal or greater to the old
// n.
if (p == search_->root_node_ &&
search_->current_best_edge_.GetN() <= n->GetN()) {
(old_update_parent_bounds && n->IsTerminal() ||
n != search_->current_best_edge_.node() &&
search_->current_best_edge_.GetN() <= n->GetN())) {
search_->current_best_edge_ =
search_->GetBestChildNoTemperature(search_->root_node_, 0);
}
Expand Down