Class NHPP

All Implemented Interfaces:
Serializable, Copyable

public class NHPP extends ContinuousDistribution implements Serializable
A non-homogeneous Poisson process (NHPP) with a piecewise-constant intensity.

The intensity is a step function of the wall clock: segment i covers [breakpoints[i], breakpoints[i+1]) and carries rate rates[i], so breakpoints has one more entry than rates. With cyclic = true the schedule repeats, giving a cyclic Poisson process.

Two horizon conventions:

  • cyclic: the schedule repeats with period T = breakpoints[n] - breakpoints[0]; the active segment at time t is found from (t - breakpoints[0]) mod T.
  • non-cyclic: the intensity is zero outside [breakpoints[0], breakpoints[n]), so the process emits nothing once the schedule is exhausted. A non-cyclic NHPP is therefore a transient construct: run to steady state it converges to the empty system, and callers should use a time span within the horizon.

This is not a renewal process. Successive intervals are dependent, because the position within the schedule carries over from one event to the next. Accordingly the scalar summaries that presuppose an i.i.d. interval distribution -- getSCV(), getSkewness(), evalCDF(double), evalLST(double) -- are undefined here and return NaN rather than a representative exponential value, which would silently misreport the process as Poisson. The schedule itself is the parameterisation: read it with getRateSchedule(). getMean() is well defined and returns the arrival-stationary (Palm) mean interval 1/timeAverageRate.

The process representation stores:

  • getProcess().get(0) - 1x(n+1) matrix of breakpoints
  • getProcess().get(1) - 1xn matrix of rates
  • getProcess().get(2) - 1x1 matrix, 1 if cyclic else 0

Solver support. Only the LDES simulation engine honours the exact schedule; every analytical solver rejects a model using it via the standard unsupported-feature check.

See Also:
  • Constructor Details

    • NHPP

      public NHPP(double[] breakpoints, double[] rates, boolean cyclic)
      Creates an NHPP with a piecewise-constant intensity.
      Parameters:
      breakpoints - strictly increasing segment boundaries, length n+1
      rates - non-negative rate on each segment, length n
      cyclic - whether the schedule repeats with the horizon as period
    • NHPP

      public NHPP(double[] breakpoints, double[] rates)
      Creates a cyclic NHPP.
  • Method Details

    • getBreakpoints

      public double[] getBreakpoints()
      Returns a copy of the segment breakpoints, length n+1.
    • getRates

      public double[] getRates()
      Returns a copy of the per-segment rates, length n.
    • isCyclic

      public boolean isCyclic()
      Whether the schedule repeats with period getPeriod().
    • getNumSegments

      public int getNumSegments()
      Returns the number of segments in the schedule.
    • getPeriod

      public double getPeriod()
      Returns the horizon length, which is the period when cyclic.
    • getTimeAverageRate

      public double getTimeAverageRate()
      Returns the time-average rate over the horizon, sum(rates[i]*width[i]) / sum(width[i]).

      For a cyclic schedule this is the long-run arrival rate. For a non-cyclic one it is the average over the active horizon only, since the intensity is zero afterwards.

    • getRateAt

      public double getRateAt(double t)
      The rate in force at wall-clock time t; zero past a non-cyclic horizon.
    • getRateSchedule

      public NHPP.RateSchedule getRateSchedule()
      Returns the rate schedule. This is the parameterisation of the process; the scalar interval summaries are not.
    • 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
    • getSCV

      public double getSCV()
      Returns NaN: an NHPP is not a renewal process, so there is no i.i.d. interval distribution for an SCV to summarise. Returning a representative value here would report a time-varying process as an exponential one to every consumer of sn.scv.
      Specified by:
      getSCV in class Distribution
      Returns:
      the squared coefficient of variation
    • getSkewness

      public double getSkewness()
      Returns NaN; see getSCV().
      Specified by:
      getSkewness in class Distribution
      Returns:
      the skewness value
    • evalCDF

      public double evalCDF(double t)
      Returns NaN; see getSCV().
      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)
      Returns NaN; see getSCV().
      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
    • resetSampleClock

      public void resetSampleClock()
      Restarts the sample(int, java.util.Random) clock at the start of the schedule.
    • sample

      public double[] sample(int n, Random random)
      Draws n successive interarrival times along one sample path.

      The intensity depends on absolute time, so this advances an internal clock across calls: consecutive samples form a realisation of the process starting at breakpoints[0], not independent draws from a marginal. Use resetSampleClock() to restart the path. A non-cyclic schedule that runs out returns 0 for every remaining sample, the intensity there being zero.

      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
    • nextInterval

      public double nextInterval(double from, double residual)
      Solves integral_{from}^{from+x} lambda(u) du = residual for x, walking the schedule forward and consuming the budget segment by segment. Returns 0 when a non-cyclic horizon is exhausted first, which callers read as "no further event".

      This is exact for an NHPP: conditional on no event since the last one, the residual is governed by the intensity from the current instant onward, so a holding time drawn under a rate that has since changed is not a sample from this process.

      Parameters:
      from - wall-clock origin
      residual - an Exp(1) budget of cumulative intensity
    • toString

      public String toString()
      Overrides:
      toString in class Object