Scoring a batch of candidate laws¶
lawset.score_many(candidates, buffer, exclude=None) returns the same ordered
triples as sequential score calls, including duplicates. It does not admit laws
or count statistical tests. The default preserves lazy iterator interleaving.
When callbacks and inputs are stable throughout the call, use
lawset.score_many(candidates, buffer, stable=True) to build the active-law view
once per action. This is an explicit owner promise: callbacks must not mutate
closure state, laws, candidates or evidence during the call. Views are local to
one call; mutable callbacks need the default sequential path. Existing optional
memo=True semantics are unchanged. No speed or quality gain is guaranteed.
stable must be the boolean True or False; strings and numeric flags are
rejected before consuming the candidate iterator.
For an unbound law set, after changing a fallback callable's closure or table,
call lawset.set_base(the_same_callable) explicitly. This refreshes its fallback
view and score memo, preserving laws, admission counts and budgets. Changes to
arbitrary mutable callbacks are not detected automatically. Bound exceptions
still require a new declared version= and retire according to their existing
contract; reusing the current bound version is not a refresh.
Old fallback masks owned by that law set are removed from its known live buffers
on refresh. Tracking uses weak buffer references and does not clear other owners'
masks or effect caches. This bounds accumulation from repeated explicit fallback
refreshes, not all memory used by a growing evidence buffer.