Class NNPP

All Implemented Interfaces:
Serializable, Copyable

public class NNPP extends ContinuousDistribution implements Serializable
A nonstationary non-Poisson arrival process (NNPP) generated by thinning.

The target rate function lambda(t) on [0, S] is either an exponential-polynomial-trigonometric function with multiple periodicities (EPTMP), lambda(t) = exp(sum_i alpha_i t^i + sum_k gamma_k sin(omega_k t + phi_k)), or a piecewise-linear interpolation of knots. A piecewise-constant majorizer lamTilde >= lambda on Q equal subintervals is built deterministically (golden-section search for EPTMP, exact for piecewise linear). Arrivals are generated by inverting the majorizing mean-value function muTilde at the epochs of a unit-rate equilibrium renewal process with Weibull gaps of squared coefficient of variation C (the dispersion ratio), and each candidate at time t is accepted with probability lambda(t)/lamTilde(t).

With C = 1 the renewal gaps are Exp(1) and the method is the Lewis-Shedler thinning of a nonhomogeneous Poisson process. With C != 1 it is SCIATA (Liu, Kuhl, Liu and Wilson), designed for C in (0, 2].

Cyclic (default): lambda(t) = lambda(t mod S) and the renewal process continues across cycles. Non-cyclic: zero intensity past S.

Like NHPP this is not a renewal process: getSCV(), getSkewness(), evalCDF(double) and evalLST(double) return NaN; getMean() is S / mu(S).

The process representation (getProcess()) has seven entries: {majBreakpoints (1x(Q+1)), majRates (1xQ), cyclic (0/1), dispersion, kind (1 eptmp, 2 pwlinear), params (row), horizon}, where params is [m+1, p, alpha_0..alpha_m, gamma_1..gamma_p, omega_1..omega_p, phi_1..phi_p] for EPTMP and [n, times_0..times_{n-1}, rates_0..rates_{n-1}] for piecewise linear.

Solver support. Only LDES, and only as an arrival process.

See Also:
  • Field Details

  • Method Details

    • eptmp

      public static NNPP eptmp(double[] alpha, double[] gamma, double[] omega, double[] phi, double horizon, double dispersion, boolean cyclic, int Q)
      EPTMP rate function on [0, horizon].
      Parameters:
      alpha - polynomial coefficients alpha_0..alpha_m (length >= 1)
      gamma - sine amplitudes (length p >= 0)
      omega - sine angular frequencies (length p)
      phi - sine phases (length p)
      horizon - S
      dispersion - C > 0 (1 = Lewis-Shedler thinning)
      cyclic - whether lambda repeats with period S
      Q - number of majorizer subintervals
    • eptmp

      public static NNPP eptmp(double[] alpha, double[] gamma, double[] omega, double[] phi, double horizon, double dispersion, boolean cyclic)
      EPTMP with dispersion, cyclic flag and default Q.
    • eptmp

      public static NNPP eptmp(double[] alpha, double[] gamma, double[] omega, double[] phi, double horizon, double dispersion)
      EPTMP with dispersion, cyclic, default Q.
    • eptmp

      public static NNPP eptmp(double[] alpha, double[] gamma, double[] omega, double[] phi, double horizon)
      EPTMP Poisson (C = 1), cyclic, default Q.
    • piecewiseLinear

      public static NNPP piecewiseLinear(double[] times, double[] rates, double dispersion, boolean cyclic, int Q)
      Piecewise-linear rate function through the knots (times[j], rates[j]).
      Parameters:
      times - knot times, times[0] = 0, strictly increasing; horizon = times[n-1]
      rates - non-negative knot rates
      dispersion - C > 0
      cyclic - whether lambda repeats with period S
      Q - number of majorizer subintervals
    • piecewiseLinear

      public static NNPP piecewiseLinear(double[] times, double[] rates, double dispersion, boolean cyclic)
      Piecewise linear with dispersion, cyclic flag and default Q.
    • piecewiseLinear

      public static NNPP piecewiseLinear(double[] times, double[] rates, double dispersion)
      Piecewise linear with dispersion, cyclic, default Q.
    • piecewiseLinear

      public static NNPP piecewiseLinear(double[] times, double[] rates)
      Piecewise linear Poisson (C = 1), cyclic, default Q.
    • fromProcess

      public static NNPP fromProcess(MatrixCell cell)
      Rebuilds an NNPP from its seven-entry process cell (sn.proc layout). The majorizer is recomputed from the parameters; it is deterministic, so it equals the one carried by the cell.
    • getRateAt

      public double getRateAt(double t)
      The target intensity lambda(t); zero past a non-cyclic horizon.
    • getMajorizerAt

      public double getMajorizerAt(double t)
      The majorizing intensity at time t; zero past a non-cyclic horizon.
    • getMeanValue

      public double getMeanValue(double t)
      The target mean-value function mu(t) = integral_0^t lambda(u) du.
    • getMeanValueMajorizer

      public double getMeanValueMajorizer(double t)
      The majorizing mean-value function muTilde(t).
    • getMeanValueMajorizer

      public double getMeanValueMajorizer()
      muTilde(S).
    • getMeanValueMajorizerInverse

      public double getMeanValueMajorizerInverse(double u)
      Public inverse of muTilde (absolute time).
    • weibullParams

      public static double[] weibullParams(double C)
      Weibull {shape, scale} with mean 1 and SCV C. C = 1 gives {1, 1}.
    • newStream

      public NNPP.Stream newStream()
      Creates a fresh sampling stream starting at time 0.
    • resetSampleClock

      public void resetSampleClock()
      Restarts the sample(int, java.util.Random) path at time 0.
    • sample

      public double[] sample(int n, Random random)
      Draws n successive interarrival times along one sample path starting at time 0. As for NHPP.sample(int, java.util.Random), the path continues across calls; resetSampleClock() restarts it. Once a non-cyclic process is exhausted the remaining samples are 0.
      Specified by:
      sample in class Distribution
      Parameters:
      n - the number of samples to generate
      random - the random number generator to use
      Returns:
      array of random samples
    • sample

      public double[] sample(int n)
      Description copied from class: Distribution
      Generates random samples from this distribution using default random generator.
      Overrides:
      sample in class Distribution
      Parameters:
      n - the number of samples to generate
      Returns:
      array of random samples
    • sampleArrivalTimes

      public double[] sampleArrivalTimes(int n, Random random)
      n successive absolute arrival times of a fresh path from 0 (+Inf once exhausted).
    • getTimeAverageRate

      public double getTimeAverageRate()
    • getMean

      public double getMean()
      Description copied from class: Distribution
      Gets the mean (expected value) of this distribution.
      Specified by:
      getMean in class Distribution
      Returns:
      the mean value
    • getRate

      public double getRate()
      Description copied from class: Distribution
      Gets the rate of this distribution (inverse of mean).
      Overrides:
      getRate in class Distribution
      Returns:
      the rate value (1/mean)
    • getSCV

      public double getSCV()
      Returns NaN: an NNPP is not a renewal process (see NHPP.getSCV()).
      Specified by:
      getSCV in class Distribution
      Returns:
      the squared coefficient of variation
    • getSkewness

      public double getSkewness()
      Description copied from class: Distribution
      Gets the skewness of this distribution. Skewness measures the asymmetry of the probability distribution.
      Specified by:
      getSkewness in class Distribution
      Returns:
      the skewness value
    • evalCDF

      public double evalCDF(double t)
      Description copied from class: Distribution
      Evaluates the cumulative distribution function (CDF) at the given point.
      Specified by:
      evalCDF in class Distribution
      Parameters:
      t - the point at which to evaluate the CDF
      Returns:
      the CDF value at point t
    • evalLST

      public double evalLST(double s)
      Description copied from class: Distribution
      Evaluate the Laplace-Stieltjes Transform at s
      Specified by:
      evalLST in class ContinuousDistribution
      Parameters:
      s - the Laplace domain variable
      Returns:
      the LST value at s
    • getProcess

      public MatrixCell getProcess()
      Description copied from class: ContinuousDistribution
      Gets the process representation with actual distribution parameters. Returns a MatrixCell containing the distribution parameters.
      Specified by:
      getProcess in class ContinuousDistribution
      Returns:
      MatrixCell with distribution-specific parameters
    • getMajorizer

      public double[][] getMajorizer()
      Majorizer {breakpoints (Q+1), rates (Q)}.
    • getAcceptanceRate

      public double getAcceptanceRate()
      mu(S) / muTilde(S): long-run fraction of candidates accepted.
    • getDispersion

      public double getDispersion()
    • isCyclic

      public boolean isCyclic()
    • getHorizon

      public double getHorizon()
    • getQ

      public int getQ()
    • getWeibullShape

      public double getWeibullShape()
    • getWeibullScale

      public double getWeibullScale()
    • getMethod

      public String getMethod()
      "thinning" when C == 1, otherwise "sciata".
    • getKind

      public String getKind()
      "eptmp" or "pwlinear".
    • getKindCode

      public int getKindCode()
    • getAlpha

      public double[] getAlpha()
    • getGamma

      public double[] getGamma()
    • getOmega

      public double[] getOmega()
    • getPhi

      public double[] getPhi()
    • getTimes

      public double[] getTimes()
    • getRates

      public double[] getRates()
    • getParamRow

      public double[] getParamRow()
      The params row of the process cell.
    • toString

      public String toString()
      Overrides:
      toString in class Object