depth_proportional_resolution_tapered_algo
Maintain constant size complexity and evenly-spaced strata.
The tapered depth-proportional resolution policy ensures estimates of MRCA rank will have uncertainty bounds less than or equal to a user-specified proportion of the largest number of strata deposited on either column. Thus, MRCA rank estimate uncertainty scales as O(n) with respect to the greater number of strata deposited on either column.
Under the tapered depth-proportional resolution policy, the number of strata retained (i.e., space complexity) scales as O(1) with respect to the number of strata deposited.
This functor’s retention policy implementation guarantees that columns will retain appropriate strata so that for any two columns with m and n strata deposited, the rank of the most recent common ancestor can be determined with uncertainty of at most
bound = floor(max(m, n) / depth_proportional_resolution)
ranks. Achieving this limit on uncertainty requires retaining sufficient strata so that no more than bound ranks elapsed between any two strata. This policy accumulates retained strata at a fixed interval until twice as many as depth_proportional_resolution are at hand. Then, every other retained stratum is purged gradually from back to front until the cycle repeats with a new twice-as-wide interval between retained strata.
See Also
- StratumRetentionPredicateDepthProportionalResolution:
For a predicate retention policy that achieves the same guarantees for tapered depth-proportional resolution but purges unnecessary strata more aggressively and abruptly.
Classes
Functor to provide member function implementation in Policy class. |
|
Functor to provide member function implementation in Policy class. |
|
Functor to provide member function implementation in Policy class. |
|
Functor to provide member function implementation in Policy class. |
|
Functor to provide member function implementation in Policy class. |
|
Functor to provide member function implementation in Policy class. |
|
Functor to provide member function implementation in Policy class. |
|
Functor to provide member function implementation in Policy class. |
|
Functor to implement the tapered depth-proportional resolution stratum retention policy, for use with HereditaryStratigraphicColumn. |
|
Functor to provide member function implementation in Policy class. |
|
Instantiate policy implementation for particular policy specification parameters. |
|
Contains all policy parameters, if any. |
- class CalcMrcaUncertaintyAbsExact
Functor to provide member function implementation in Policy class.
- __call__(policy: PolicyCouplerBase, first_num_strata_deposited: int, second_num_strata_deposited: int, actual_rank_of_mrca: int) int [source]
Exactly how much uncertainty to estimate rank of MRCA?
- __init__(policy_spec: PolicySpec | None) None [source]
- class CalcMrcaUncertaintyAbsUpperBound
Functor to provide member function implementation in Policy class.
- __call__(policy: PolicyCouplerBase, first_num_strata_deposited: int, second_num_strata_deposited: int, actual_rank_of_mrca: int) int [source]
At most, how much absolute uncertainty to estimate rank of MRCA? Inclusive.
- __init__(policy_spec: PolicySpec | None) None [source]
- class CalcMrcaUncertaintyAbsUpperBoundAtPessimalRank
- class CalcMrcaUncertaintyAbsUpperBoundPessimalRank
Functor to provide member function implementation in Policy class.
- __call__(policy: PolicyCouplerBase, first_num_strata_deposited: int | None, second_num_strata_deposited: int | None) int [source]
Calculate rank for which upper bound on absolute MRCA uncertainty is pessimized.
- __init__(policy_spec: PolicySpec | None) None [source]
- class CalcMrcaUncertaintyRelExact
- class CalcMrcaUncertaintyRelUpperBound
Functor to provide member function implementation in Policy class.
- __call__(policy: PolicyCouplerBase, first_num_strata_deposited: int, second_num_strata_deposited: int, actual_rank_of_mrca: int) float [source]
At most, how much relative uncertainty to estimate rank of MRCA? Inclusive.
- __init__(policy_spec: PolicySpec | None) None [source]
- class CalcMrcaUncertaintyRelUpperBoundAtPessimalRank
- class CalcMrcaUncertaintyRelUpperBoundPessimalRank
Functor to provide member function implementation in Policy class.
- __call__(policy: PolicyCouplerBase, first_num_strata_deposited: int, second_num_strata_deposited: int) int [source]
Calculate rank for which upper bound on relative MRCA uncertainty is pessimized.
- __init__(policy_spec: PolicySpec | None) None [source]
- class CalcNumStrataRetainedExact
Functor to provide member function implementation in Policy class.
- __call__(policy: PolicyCouplerBase, num_strata_deposited: int) int [source]
Exactly how many strata are retained after n deposited?
- __init__(policy_spec: PolicySpec | None) None [source]
- class CalcNumStrataRetainedUpperBound
Functor to provide member function implementation in Policy class.
- __call__(policy: PolicyCouplerBase, num_strata_deposited: int) int [source]
At most, how many strata are retained after n deposited? Inclusive.
- __init__(policy_spec: PolicySpec | None = None) None [source]
- class CalcRankAtColumnIndex
Functor to provide member function implementation in Policy class.
- __call__(policy: PolicyCouplerBase | None, index: int, num_strata_deposited: int | None) int [source]
After n strata have been deposited, what will the rank of the stratum at column index k be?
Enables a HereditaryStratigraphicColumn using this predicate to optimize away storage of rank annotations on strata. Takes into the account the possibility for in-progress stratum depositions that haven’t been reflected in num_strata_deposited.
- __init__(policy_spec: PolicySpec | None) None [source]
- class GenDropRanks
Functor to implement the tapered depth-proportional resolution stratum retention policy, for use with HereditaryStratigraphicColumn.
This functor enacts the tapered depth-proportional resolution policy by specifying the set of strata ranks that should be purged from a hereditary stratigraphic column when the nth stratum is deposited.
- __call__(policy: PolicyCouplerBase, num_stratum_depositions_completed: int, retained_ranks: Iterable[int] | None) Iterator[int] [source]
Decide which strata within the stratagraphic column should be purged.
Every time a new stratum is deposited, this method is called to determine which strata should be purged. All strata at ranks yielded from this functor are immediately purged from the column, meaning that for a stratum to persist it must not be yielded by this functor each and every time a new stratum is deposited.
Parameters
- policy: Policy
Policy this functor enacts.
- num_stratum_depositions_completedint
The number of strata that have already been deposited, not including the latest stratum being deposited which prompted the current purge operation.
- retained_ranksiterator over int
An iterator over ranks of strata currently retained within the hereditary stratigraphic column. Not used in this functor.
Returns
- iterator over int
The ranks of strata that should be purged from the hereditary
stratigraphic column at this deposition step.
See Also
- depth_proportional_resolution_tapered_algo:
For details on the rationale, implementation, and guarantees of the tapered depth-proportional resolution stratum retention policy.
- __init__(policy_spec: PolicySpec | None) None [source]
- class IterRetainedRanks
Functor to provide member function implementation in Policy class.
- __call__(policy: PolicyCouplerBase, num_strata_deposited: int) Iterator[int] [source]
Iterate over retained strata ranks at num_strata_deposited in ascending order.
- __init__(policy_spec: PolicySpec | None) None [source]
- class Policy
Instantiate policy implementation for particular policy specification parameters.
- GetEvalCtor() str
- GetSpec() PolicySpec
Get policy’s parameter specification.
- WithoutCalcRankAtColumnIndex() PolicyCoupler
Make a copy of this policy instance with CalcRankAtColumnIndex disabled.
Useful to prevent optimization-out of strata rank number storage in a stratum ordered store backing a hereditary stratigraphic column.
- __init__(*args, parameterizer: Callable[[Type], PolicySpecBase | None] | None = None, policy_spec: PolicySpecBase | None = None, **kwargs)
Construct a PolicyCoupler instance.
If policy_spec is not provided, all arguments are forwarded to policy spec initializer.
- __repr__() str
Return repr(self).
- __str__() str
Return str(self).
- policy_spec_t
alias of
PolicySpec
- CalcMrcaUncertaintyAbsUpperBound: Callable
- CalcMrcaUncertaintyAbsUpperBoundPessimalRank: Callable
- CalcMrcaUncertaintyAbsUpperBoundAtPessimalRank: Callable
- CalcMrcaUncertaintyRelUpperBound: Callable
- CalcMrcaUncertaintyRelUpperBoundAtPessimalRank: Callable
- CalcMrcaUncertaintyRelUpperBoundPessimalRank: Callable
- CalcNumStrataRetainedUpperBound: Callable
- CalcMrcaUncertaintyAbsExact: Callable | None
- CalcMrcaUncertaintyRelExact: Callable | None
- CalcNumStrataRetainedExact: Callable | None
- CalcRankAtColumnIndex: Callable | None
- IterRetainedRanks: Callable | None
- GenDropRanks: Callable
- class PolicySpec
Contains all policy parameters, if any.
- __init__(depth_proportional_resolution: int)[source]
Construct the policy spec.
Parameters
- depth_proportional_resolutionint
The desired minimum number of intervals for the rank of the MRCA to be able to be distinguished between. The uncertainty of MRCA rank estimates provided under the tapered depth-proportional resolution policy will scale as total number of strata deposited divided by depth_proportional_resolution.