Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59d5af56f3 |
No files matched your search
+12
-5
@@ -650,7 +650,7 @@ void Searcher::playout() {
|
|||||||
edge_path_.clear();
|
edge_path_.clear();
|
||||||
|
|
||||||
// How the playout ended; it decides what happens to the last node.
|
// How the playout ended; it decides what happens to the last node.
|
||||||
enum Leaf { NEW_NODE, TERMINAL, NOT_EXPANDED, PATH_DRAW, DEPTH_LIMIT } leaf;
|
enum Leaf { NEW_NODE, TERMINAL, NOT_EXPANDED, PATH_DRAW, STOPPED } leaf;
|
||||||
u32 idx = tree_.root();
|
u32 idx = tree_.root();
|
||||||
path_.push_back(idx);
|
path_.push_back(idx);
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
@@ -712,17 +712,24 @@ void Searcher::playout() {
|
|||||||
}
|
}
|
||||||
idx = edge.child;
|
idx = edge.child;
|
||||||
path_.push_back(idx);
|
path_.push_back(idx);
|
||||||
if (depth >= MAX_PLAYOUT_DEPTH) {
|
// Stop rule (KataGo, plan variant 5a): a child that already has more
|
||||||
|
// visits than this edge (other move orders reached it) is ahead of
|
||||||
|
// what this edge needs. The playout ends there: the edge counts the
|
||||||
|
// visit with the child's current value, and the child is left as it
|
||||||
|
// is. In a tree the two counts are equal and this never happens. The
|
||||||
|
// depth limit ends a playout the same way.
|
||||||
|
if (tree_.node(idx).visits > edge.visits || depth >= MAX_PLAYOUT_DEPTH) {
|
||||||
value = -tree_.node(idx).q;
|
value = -tree_.node(idx).q;
|
||||||
leaf = DEPTH_LIMIT;
|
leaf = STOPPED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The last node. A new node already has its one visit (N = base = 1); a
|
// The last node. A new node already has its one visit (N = base = 1); a
|
||||||
// terminal node and a node that could not be expanded count one more visit
|
// terminal node and a node that could not be expanded count one more visit
|
||||||
// of their own value (q = u stays). A path draw has no node, and a node at
|
// of their own value (q = u stays). A path draw has no node, and a node
|
||||||
// the depth limit is left as it is: only the edge into it counts the visit.
|
// where the playout stopped is left as it is: only the edge into it counts
|
||||||
|
// the visit.
|
||||||
if (leaf == TERMINAL || leaf == NOT_EXPANDED) {
|
if (leaf == TERMINAL || leaf == NOT_EXPANDED) {
|
||||||
Node& node = tree_.node(path_.back());
|
Node& node = tree_.node(path_.back());
|
||||||
node.visits++;
|
node.visits++;
|
||||||
|
|||||||
+9
-9
@@ -71,15 +71,15 @@ u16 position_check(const Position& pos);
|
|||||||
// check, about 80 bits.
|
// check, about 80 bits.
|
||||||
class Tree {
|
class Tree {
|
||||||
public:
|
public:
|
||||||
// Edges per node the arenas are sized for: the edge arena gets 192 of
|
// Edges per node the arenas are sized for: the edge arena gets 128 of
|
||||||
// every 224 bytes, the node arena 32 (plus the table). In the graph
|
// every 160 bytes, the node arena 32. Measured in step 1 of the MCGS plan
|
||||||
// almost every node gets expanded, so it holds about 20 edges per node
|
// (docs/mcgs-log.md, edges per visited node): 13 on average in 5 s
|
||||||
// in middlegames (step 1: 18 per distinct position without collections),
|
// searches without collections, 19-21 in middlegames, 3.6-5.5 in simple
|
||||||
// and with 8 the edge arena filled first. Collections over the 16 bench
|
// endgames, and 3-9 right after collections (pruned nodes keep their node
|
||||||
// positions at 5 s and Hash 64 (local, one noisy run): 8 edges gave 67,
|
// but lose their edges). Over the 16 bench positions at 5 s and Hash 64,
|
||||||
// 12 gave 53, 16 gave 51 and 20 gave 57; 16 already moves collections into
|
// 8 gave 184 collections (main: 200), as few as 13 did, without 13's
|
||||||
// the endgames, which fill the node arena first.
|
// 2-3x more collections in the endgames (which fill the node arena first).
|
||||||
static constexpr size_t EDGES_PER_NODE = 12;
|
static constexpr size_t EDGES_PER_NODE = 8;
|
||||||
|
|
||||||
// Splits `bytes` between the node arena, the edge arena and the table.
|
// Splits `bytes` between the node arena, the edge arena and the table.
|
||||||
void resize_bytes(size_t bytes);
|
void resize_bytes(size_t bytes);
|
||||||
|
|||||||
Reference in new issue
Block a user