feat: smart pruning stops clock searches whose best move is settled
Under a game clock a search now stops early when no other root move can catch up with the leading one in the playouts the remaining time still allows (at the speed so far, divided by Lc0's smart-pruning factor 1.33). The saved time goes to later moves, whose allocation is a share of the remaining clock. movetime, nodes and infinite searches are not affected. Only the visits gained in this search count, and the move leading them must also be the most visited overall. Counting the reused tree's visits stopped almost every search at once: the reused best move often has hundreds of thousands of visits no rival could reach (a first version spent 39 ms per move instead of 230 in self-play at 8+0.08). Self-play diagnostic at 8+0.08 (3 games, 80 plies), main -> this: average time per move 230 -> 157 ms, clock left after move 40 2.0 s -> 4.6-5.2 s. The bench is unchanged: it searches by playout count. Bench: 554375 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6f4c3b2656
commit
6da27e2fad
2 files changed
+50
-1
No files matched your search
@@ -152,6 +152,12 @@ private:
|
||||
|
||||
Clock::time_point start_time_;
|
||||
i64 time_limit_ms_ = 0;
|
||||
// The limit comes from the game clock (not movetime), so stopping early saves time.
|
||||
bool clock_search_ = false;
|
||||
std::vector<u32> root_start_visits_;
|
||||
// Lc0's default: the remaining playouts are divided by this before asking
|
||||
// whether another root move could still overtake the best one.
|
||||
static constexpr double SMART_PRUNING_FACTOR = 1.33;
|
||||
u64 iterations_ = 0;
|
||||
u64 depth_sum_ = 0;
|
||||
int seldepth_ = 0;
|
||||
@@ -181,6 +187,7 @@ private:
|
||||
void compute_time_limit(const SearchLimits& limits);
|
||||
i64 elapsed_ms() const;
|
||||
bool should_stop(const SearchLimits& limits) const;
|
||||
bool best_move_settled(i64 ms) const;
|
||||
|
||||
u32 best_child(u32 idx) const;
|
||||
void print_info() const;
|
||||
|
||||
Reference in new issue
Block a user