reach[j]: the chance that drafts 0 .. j all stand, from the decayed counts. A position never reached yet (its counts still the prior's: tried exactly 1) follows the trend of the two before it, q_last * min(1, q_last / q_before): a lane whose drafts all stand (a code edit) is not held short by the prior until something drafts that deep, and one whose drafts stand less the deeper they go (new code's
| 24 | // a lane whose drafts all stand (a code edit) is not held short by the prior until something drafts that deep, and one |
| 25 | // whose drafts stand less the deeper they go (new code's chains) is not drafted deeper than that falling rate pays |
| 26 | std::vector<double> reach_of(const std::vector<double>& tried, const std::vector<double>& stood, int n) { |
| 27 | std::vector<double> r((size_t) n); |
| 28 | double p = 1.0, q1 = -1.0, q2 = -1.0; // the last two positions' rates (q1 the last), -1 before any |
| 29 | for (int j = 0; j < n; ++j) { |
| 30 | double q = stood[(size_t) j] / tried[(size_t) j]; |
| 31 | if (tried[(size_t) j] == 1.0 && q1 >= 0.0) q = q2 > 0.0 ? q1 * std::min(1.0, q1 / q2) : q1; |
| 32 | r[(size_t) j] = p *= q; |
| 33 | q2 = q1; |
| 34 | q1 = q; |
| 35 | } |
| 36 | return r; |
| 37 | } |
| 38 | } // namespace |
| 39 | |
| 40 | void BatchLane::start(int lane_, const Sampling& s_, const std::mt19937_64& rng_, std::vector<int> ctx_) { |