Class FJ_quorum
Each branch is summarised by its first two moments and expanded into a discrete step CDF by a two-moment fit. The CDF of the k-th order statistic is then assembled by the inclusion-exclusion identity
F_(k)(t) = sum_{i=k..n} (-1)^(i-k) * C(i-1, k-1) * e_i(F_1(t), ..., F_n(t))
where e_i is the i-th elementary symmetric polynomial of the branch CDFs, evaluated by the
memoised recurrence in
invalid reference
#symmetric
For identically distributed branches the result agrees with
FJ_order_stat.fj_order_stat_cdf(double, int, int), which is the closed binomial form of
the same quantity; this class generalises it to heterogeneous branches, which is what an LQN
AND-join with a quorum requires since its branches carry different demands.
Follows the formulation of Omari, Franks, Woodside and Pan, as implemented in LQNS 6.x (randomvar.cc, DiscreteCDFs::quorumKofN and DiscretePoints::estimateCDF).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA discrete step function on a finite, increasing time grid. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLargest branch count accepted byquorumKofN(jline.api.fj.FJ_quorum.StepCDF[], int). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FJ_quorum.StepCDFPointwise sum of two step functions on the union of their time grids.static FJ_quorum.StepCDFPointwise product of two step functions on the union of their time grids.static FJ_quorum.StepCDFquorumKofN(FJ_quorum.StepCDF[] branches, int k) CDF of the k-th smallest of n independent branch completion times.static double[]quorumMoments(double[] branchMeans, double[] branchVariances, int k) Mean and variance of the completion time of a k-of-n join whose branches are given by their first two moments.static FJ_quorum.StepCDFthreePointFit(double mean, double variance) Two-moment fit of a branch completion time to a three-point discrete distribution.
-
Field Details
-
MAX_BRANCHES
public static final int MAX_BRANCHESLargest branch count accepted byquorumKofN(jline.api.fj.FJ_quorum.StepCDF[], int).The evaluation is cubic in the branch count, so this bounds the work at roughly 1e8 elementary operations. An LQN AND-join with more branches than this is degenerate; the limit exists to turn a silent hang into an immediate, explicable failure.
- See Also:
-
-
Constructor Details
-
FJ_quorum
public FJ_quorum()
-
-
Method Details
-
threePointFit
Two-moment fit of a branch completion time to a three-point discrete distribution.Matches the mean and variance exactly. A zero standard deviation degenerates to a single deterministic point, and a zero mean yields the empty step function.
- Parameters:
mean- branch mean completion time, must be non-negativevariance- branch variance, must be non-negative- Returns:
- the fitted step CDF
-
add
Pointwise sum of two step functions on the union of their time grids. -
multiply
Pointwise product of two step functions on the union of their time grids.An empty operand annihilates the product, matching the convention that an absent branch distribution contributes no mass.
-
quorumKofN
CDF of the k-th smallest of n independent branch completion times.Evaluated pointwise on the union of the branch grids. At each time the number of completed branches is Poisson-binomial, so its distribution is built by the recurrence q_j <- q_{j-1} * F_i + q_j * (1 - F_i) over branches i, and the k-th order statistic is the upper tail sum_{j>=k} q_j.
This is the same quantity as the inclusion-exclusion identity sum_{i=k..n} (-1)^(i-k) C(i-1,k-1) e_i(F_1..F_n) used by LQNS, but every term here is a probability in [0, 1] and no term is subtracted, so it does not suffer the catastrophic cancellation that the alternating binomial sum incurs as n grows.
- Parameters:
branches- the branch CDFs, one per branchk- the quorum count, in [1, branches.length]- Returns:
- the step CDF of the k-th order statistic
- Throws:
IllegalArgumentException- if k is out of range or there are more thanMAX_BRANCHESbranches
-
quorumMoments
public static double[] quorumMoments(double[] branchMeans, double[] branchVariances, int k) Mean and variance of the completion time of a k-of-n join whose branches are given by their first two moments.This is the entry point used by the layered solver: each branch mean and variance comes from the residence time and variance accumulated along that branch of the activity graph.
- Parameters:
branchMeans- per-branch mean completion timesbranchVariances- per-branch variances, same length as branchMeansk- the quorum count, in [1, branchMeans.length]- Returns:
- a two-element array holding the mean and the variance of the join completion time
-