-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go nodes 0
does infinite search
#2003
Comments
Here seems to be the problem : In the file src/mcts/stoppers/stoppers.h
For some reason when limit = 0, nodes_limit is changed to 4000000000ll which makes |
This 4'000'000'000 was introduced to prevent number of nodes overflowing uint32 (e.g. in // common.cc // "go nodes" stopper.
int64_t node_limit = 0;
if (params.nodes) {
if (options.Get<bool>(kNodesAsPlayoutsId)) {
stopper->AddStopper(std::make_unique<PlayoutsStopper>(
*params.nodes, options.Get<float>(kSmartPruningFactorId) > 0.0f));
} else {
node_limit = *params.nodes;
}
}
// always limit nodes to avoid exceeding the limit 4000000000. That number is
// default when node_limit = 0.
stopper->AddStopper(std::make_unique<VisitsStopper>(
node_limit, options.Get<float>(kSmartPruningFactorId) > 0.0f));
Also I can see that you posted a snippet from |
Indeed i confused // src/mcts/stoppers/stoppers.h // Watches visits (total tree nodes) and predicts remaining visits.
class VisitsStopper : public SearchStopper {
public:
VisitsStopper(int64_t limit, bool populate_remaining_playouts)
: nodes_limit_(limit ? limit : 4000000000ll),
populate_remaining_playouts_(populate_remaining_playouts) {}
int64_t GetVisitsLimit() const { return nodes_limit_; }
bool ShouldStop(const IterationStats&, StoppersHints*) override;
private:
const int64_t nodes_limit_;
const bool populate_remaining_playouts_;
};
But how exactly is this preventing uint32 overflow ? Since a check on 0 doesn't mean it has overflowed for more than 0 ? Or am I missing something |
If the limit is set to 0, the |
-node_limit is set to 4000000000 in the case that params.nodes is not initialized. -node_limit is set to params.nodes if params.nodes is initialized as 0 or another int as value
node_limits value now follows the value passed to the stopper in common.cc (= 4000000000 if params.nodes was not initialized, = params.nodes if params.nodes was initialized to an int, 0 included)
since GoParams.nodes is an std::optional, it's initialization status can be checked through params.nodes.has_value() instead of params.nodes, which returns false if params.nodes is set to 0 (source of the problem). I find it odd that addStopper initiated with node_limit is run outside of the 'else' block. Meaning that if params.nodes is initiated 2 stoppers, one having 0 as a node_limit are initiated. Is there a particular reason for this? |
i believe PR #2056 fixes the issue |
It should stop immediately instead (or do one iteration when the tree is empty).
The text was updated successfully, but these errors were encountered: