Class FoxGlynn

java.lang.Object
org.oristool.models.gspn.chains.FoxGlynn
All Implemented Interfaces:
Interval

public final class FoxGlynn extends Object implements 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 Type
    Method
    Description
    static 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • leftPoint

      public int leftPoint()
      Returns the point used to truncate the left tail of the Poisson distribution.
      Specified by:
      leftPoint in interface Interval
      Returns:
      first point of the Poisson distribution approximation
    • rightPoint

      public int rightPoint()
      Returns the point used to truncate the right tail of the Poisson distribution.
      Specified by:
      rightPoint in interface Interval
      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 - unless leftPoint() <= 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 - unless leftPoint() <= i <= rightPoint()
    • computeReduced

      public static FoxGlynn computeReduced(double lambda, double error)
      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 distribution
      error - 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

      public static FoxGlynn compute(double lambda, double error)
      Computes the Fox-Glynn approximation of Poisson probabilities.
      Parameters:
      lambda - rate of the Poisson distribution
      error - 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