feat: hard time limit for moves still open at the soft limit
With smart pruning most searches stop early and the clock piles up: after move 40 of 8+0.08 self-play about 5 s of the 8 s were left. A diagnostic of 202 searches showed 190 settled early; the 12 that reached the time limit were the open ones (the best move had a median 50% of the root visits, and was the best by Q in only 3 of 12). So reaching the soft limit (the old allocation) is itself the sign of an open move. Under a game clock such a search now runs on, with smart pruning measured against a hard limit of min(3 x soft, remaining / 3), until it settles or reaches that limit. movetime, nodes and infinite are unchanged (their hard limit is the soft one). Self-play diagnostic at 8+0.08 (3 games, 80 plies), main -> this: average time per move 152-156 -> 162-189 ms, longest move about 350 -> 860-1040 ms, clock left after move 40 4.8-5.4 -> 2.4-5.0 s. go movetime 500 still stops at 480 ms; a 300 ms clock uses 6 ms. 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
ca921ce2e2
commit
bf62fe185f
2 files changed
+18
-8
No files matched your search
+4
-2
@@ -151,7 +151,9 @@ private:
|
||||
std::vector<u64> prev_history_;
|
||||
|
||||
Clock::time_point start_time_;
|
||||
i64 time_limit_ms_ = 0;
|
||||
i64 time_limit_ms_ = 0; // soft limit
|
||||
i64 hard_limit_ms_ = 0;
|
||||
static constexpr i64 HARD_LIMIT_FACTOR = 3;
|
||||
// The limit comes from the game clock (not movetime), so stopping early saves time.
|
||||
bool clock_search_ = false;
|
||||
std::vector<u32> root_start_visits_;
|
||||
@@ -187,7 +189,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;
|
||||
bool best_move_settled(i64 ms, i64 limit_ms) const;
|
||||
|
||||
u32 best_child(u32 idx) const;
|
||||
void print_info() const;
|
||||
|
||||
Reference in new issue
Block a user