feat: expand nodes on their second visit
Most leaves are visited only once. Their first visit now only settles terminal states and evaluates the position; the move list, the priors and the child nodes are created when search comes back a second time. The root is expanded before the first playout, so a search always has a move. With the value network the tree is full on nearly every move at 8+0.08 with Hash=64 (hashfull 1000 in a 30-ply self-play diagnostic); with this change many moves stay at 320-890. The -DRIGBY_VERIFY_TREE build passed 1700 tree checks in UCI-driven self-play with 1 MB and 16 MB Hash, and a 1-playout search still returns a move. Rebased from the earlier expand-second-visit branch onto the network main, without the tree collection it was built on. Bench: 546018 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6057476214
commit
cdeb318016
2 files changed
+40
-10
No files matched your search
+5
-1
@@ -117,7 +117,11 @@ private:
|
||||
bool tree_full_ = false;
|
||||
|
||||
void playout();
|
||||
float expand(u32 idx, const Position& pos, int depth);
|
||||
// First visit of a node: settles terminal states, otherwise evaluates.
|
||||
float evaluate_leaf(u32 idx, const Position& pos, int depth);
|
||||
// Second visit: creates the children with their priors. False when the
|
||||
// arena is full (a collection is then scheduled).
|
||||
bool expand(u32 idx, const Position& pos);
|
||||
u32 select_child(u32 idx) const;
|
||||
bool is_repetition(const Position& pos) const;
|
||||
// Finds the node for `root` in the previous tree and makes it the root.
|
||||
|
||||
Reference in new issue
Block a user