AngouriMath
BudgetLedger
Description
Summary
The accounting side of a WorkBudget: what has been spent so far, and
what stopped the computation if anything has.
what stopped the computation if anything has.
Remarks
that they can be shared; the drawing-down is one object mutated in program order.
The alternative — threading a remaining count through as an immutable value — has to
split the count at every branch of a search, and there is no right split: an
even one starves the branch that needed the work, giving it all to the first starves
the rest, and a branch that fails then needs a protocol for handing back what it did
not spend. A single ledger drawn down in program order needs none of that, is exactly
reproducible as long as the algorithm's own order is defined — which
#746's third
design principle requires anyway — and bounds the search as a whole rather than each
branch of it, which is the difference between a bound and a suggestion.
down is what makes a call bounded end to end. Giving each stage a budget of its own
bounds each stage and leaves the whole unbounded, which is how
#896 arose:
the same call is bounded or not depending on which internal path accepted it, and
that is worse to debug than either extreme.
Spend(System.Int64) before doing a unit of work, Require(System.Boolean,System.String) before letting
a structure grow — and declines when told to. Nothing is interrupted, nothing is
aborted, and there is no second thread to make the answer depend on scheduling. The
cost is that an algorithm which does not ask cannot be bounded, which is the honest
trade: a bound that is enforced from outside is a thread abort, and a thread abort in
the middle of a rewrite leaves no answer worth having.
question answers "no" without re-testing, so the reason cannot be overwritten by
whatever the algorithm happened to ask next on its way out.
Members
Exhausted
PropertyFor(System.String,AngouriMath.Core.Budgets.WorkBudget)
MethodOutcome
MethodReport
MethodSpend(System.Int64)
Method
Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 4378 pages online