Expand description
A fixed-capacity sum tree for weighted sampling, the structure used in prioritized experience replay.
Priorities live in the leaves of a complete binary tree packed into a flat
array. Every internal node stores the sum of its two children, so the total
weight and “find the leaf at cumulative weight s” are both
O(log capacity). Writes are a ring buffer: once full, the oldest leaf is
overwritten.
Structs§
- SumTree
- A binary sum tree holding exactly
capacityleaves.