Package org.oristool.models.gspn.chains
Class FoxGlynn
java.lang.Object
org.oristool.models.gspn.chains.FoxGlynn
- All Implemented Interfaces:
Interval
Computation of Poisson probabilities using Fox-Glynn algorithm.
This implementation is based on:
- Computing Poisson Probabilities by Bennet L. Fox and Peter W. Glynn (1988) for the "Weighter" algorithm.
- Understanding Fox and Glynn's "Computing Poisson probabilities" by David N. Jansen (2011) for the "Finder" algorithm.
-
Method Summary
Modifier and TypeMethodDescriptionstatic FoxGlynn
compute
(double lambda, double error) Computes the Fox-Glynn approximation of Poisson probabilities.static FoxGlynn
computeReduced
(double lambda, double error) Computes a reduced Fox-Glynn approximation of Poisson probabilities.int
Returns the point used to truncate the left tail of the Poisson distribution.double
poissonProb
(int i) Returns the Poisson probability for a point in the approximation.int
Returns the point used to truncate the right tail of the Poisson distribution.double
Returns a normalization constant for the Poisson approximation.double
weight
(int i) Returns the weight of a point in the approximation.
-
Method Details
-
leftPoint
public int leftPoint()Returns the point used to truncate the left tail of the Poisson distribution. -
rightPoint
public int rightPoint()Returns the point used to truncate the right tail of the Poisson distribution.- Specified by:
rightPoint
in interfaceInterval
- Returns:
- last point of the Poisson distribution approximation
-
weight
public double weight(int i) Returns the weight of a point in the approximation.The input index must belong to the range
[leftPoint(), rightPoint()]
.- Parameters:
i
- time point- Returns:
- weight for the given point
- Throws:
IndexOutOfBoundsException
- unlessleftPoint() <= i <= rightPoint()
-
totalWeight
public double totalWeight()Returns a normalization constant for the Poisson approximation.- Returns:
- normalization constant
-
poissonProb
public double poissonProb(int i) Returns the Poisson probability for a point in the approximation.The input index must belong to the range
[leftPoint(), rightPoint()]
.- Parameters:
i
- time point- Returns:
- Poisson probability for the given point
- Throws:
IndexOutOfBoundsException
- unlessleftPoint() <= i <= rightPoint()
-
computeReduced
Computes a reduced Fox-Glynn approximation of Poisson probabilities.After bounding tails and computing Poisson probabilities with Fox-Glynn algorithm, a simple heuristic is applied to reduce the size of the distribution (under the target error).
- Parameters:
lambda
- rate of the Poisson distributionerror
- the maximum allowed value of probabilities not included- Returns:
- truncation points and weights/probabilities between them
- Throws:
IllegalStateException
- if underflow can occur or the tails cannot be bounded
-
compute
Computes the Fox-Glynn approximation of Poisson probabilities.- Parameters:
lambda
- rate of the Poisson distributionerror
- the maximum allowed value of probabilities not included- Returns:
- truncation points and weights/probabilities between them
- Throws:
IllegalStateException
- if underflow can occur or the tails cannot be bounded
-