Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.contactcenters.contact
Class PoissonGammaNortaRatesArrivalProcess

    java.lang.Object
      umontreal.iro.lecuyer.contactcenters.contact.ContactArrivalProcess
          umontreal.iro.lecuyer.contactcenters.contact.PoissonArrivalProcess
              umontreal.iro.lecuyer.contactcenters.contact.PiecewiseConstantPoissonArrivalProcess
                  umontreal.iro.lecuyer.contactcenters.contact.PoissonGammaNortaRatesArrivalProcess

All Implemented Interfaces:
  ContactSource, Initializable, Named, PeriodChangeListener, ToggleElement

    public class PoissonGammaNortaRatesArrivalProcess

extends PiecewiseConstantPoissonArrivalProcess

Represents a doubly-stochastic Gamma-Poisson process with piecewise-constant randomized correlated arrival rates. The base arrival rates λp are constant during each period, but they are not deterministic: for period p, the base rate of the Poisson process is defined as a correlated gamma random variable. The marginal distribution of the rate is gamma with shape parameter αG, p, and scale parameter λG, p (mean αG, p/λG, p). The correlation structure is modelled using Normal copula model with positive definite correlation matrix having elements in [- 1, 1]. If αG, p or λG, p are 0, the resulting arrival rate during period p is always 0. As with the Poisson process with deterministic arrival rates, the generated base arrival rates are multiplied by a busyness factor B to get the arrival rates. Because the values of λ(t) are generated once for a replication, in the `init()` method, not calling this method before the simulation starts could lead to unpredictable arrival rates.

Field Summary

Fields inherited from class umontreal.iro.lecuyer.contactcenters.contact.PiecewiseConstantPoissonArrivalProcess
`busyGen, s_bgammaParam, s_numMC, varianceEpsilon`

Fields inherited from class umontreal.iro.lecuyer.contactcenters.contact.ContactArrivalProcess
`contactEvent`

Constructor Summary
`PoissonGammaNortaRatesArrivalProcess(PeriodChangeEvent pce, ContactFactory factory, double[] galphas, double[] glambdas, double[][] CorrMtx, RandomStream stream, RandomStream busynessStream)` Constructs a new Poisson-gamma arrival process using `factory` to instantiate contacts.

Method Summary
`RandomStream` | `getBusynessStream()` Returns the random stream used to generate the busyness factors for the Poisson arrival process.
`double` | `getExpectedArrivalRate(double st, double et)` Determines the expected mean arrival rate in time interval [s, e] for this arrival process assuming that the expected value of the busyness factor is 1.
`double` | `getExpectedArrivalRate(int p)` Determines the expected arrival rate in period `p` for this arrival process assuming that the expected value of the busyness factor is 1.
`double[]` | `getGammaAlphas()` Returns the parameters αG, p for the gamma rates.
`double[]` | `getGammaLambdas()` Returns the λp parameters for the arrivals rates.
`static PoissonGammaNortaRatesArrivalProcess` | `getInstanceFromMLE(PeriodChangeEvent pce, ContactFactory factory, RandomStream stream, RandomStream busynessStreams, int[][] arrivals, int numObs, int numPeriods, int numMC, CorrelationFit fit)` Constructs a new arrival process with gamma arrival rates estimated by the maximum likelihood method based on the `numObs` observations in array `arrivals`.
`static double[]` | `getMLE(int[][] arrivals, int numObs, int numPeriods, int numMC, CorrelationFit fit, double[][] corr)` Estimates the parameters of a Poisson-gamma-norta-rates arrival process from the number of arrivals in the array `arrivals`.
`double[][]` | `getSigma()` Returns the correlation matrix associated with this arrival process.
`void` | `init()` Initializes the new arrival process.
`void` | `setBusynessStream(RandomStream busynessStream)` Changes the random stream used to generate the busyness factors for the Poisson arrival process.
`void` | `setGammaParams(double[] galphas, double[] glambdas)` Sets the αG, p and λp parameters for the gamma arrival rates to `galphas` and `glambdas`, respectively.
`void` | `setSigma(double[][] CorrMtx)` Sets the associated correlation matrix to `CorrMtx`.
`String` | `toString()`

Methods inherited from class umontreal.iro.lecuyer.contactcenters.contact.PiecewiseConstantPoissonArrivalProcess
`changePeriod, getArrivalRate, getArrivalRate, getInstanceFromMLE, getLambdas, getMLE, getMLENegMulti, getNumMC, getPeriodChangeEvent, getVarianceEpsilon, isNormalizing, setLambdas, setNormalizing, setNumMC, setVarianceEpsilon, startStationary, stop`

Methods inherited from class umontreal.iro.lecuyer.contactcenters.contact.PoissonArrivalProcess
`clearCache, getGenWithCache, getInstanceFromMLE, getLambda, getStream, initCache, isCaching, nextTime, setCaching, setLambda, setStream`

Methods inherited from class umontreal.iro.lecuyer.contactcenters.contact.ContactArrivalProcess
`addNewContactListener, clearNewContactListeners, getArrivalRates, getBusynessFactor, getContactFactory, getExpectedArrivalRateB, getExpectedArrivalRateB, getExpectedArrivalRates, getExpectedArrivalRatesB, getExpectedBusynessFactor, getName, getNewContactListeners, getNextArrivalTime, init, isStarted, notifyNewContact, removeNewContactListener, setBusynessFactor, setContactFactory, setExpectedBusynessFactor, setName, setSimulator, simulator, start, start, stop`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PoissonGammaNortaRatesArrivalProcess

    public PoissonGammaNortaRatesArrivalProcess(PeriodChangeEvent pce,
                                                ContactFactory factory,
                                                double[] galphas,
                                                double[] glambdas,
                                                double[][] CorrMtx,
                                                RandomStream stream,
                                                RandomStream busynessStream)

  Constructs a new Poisson-gamma arrival process using `factory` to instantiate contacts. For each period `p`, the parameters of the gamma rate are given in `galphas[p]` and `glambdas[p]`. The random stream `stream` is used to generate the uniforms for the exponential times whereas the stream `busynessStream` is used to generate the gamma rates.

  Parameters:
    `pce` - the period-change event associated with this object.
    `factory` - the factory creating contacts for this generator.
    `galphas` - the αG, p parameters of the gamma variates.
    `glambdas` - the λG, p parameters of the gamma variates.
    `CorrMtx` - the correlation matrix of the Normal copula model for rates.
    `stream` - random number stream for the exponential variates.
    `busynessStream` - random number stream for the busyness factor.
  Throws:
    `IllegalArgumentException` - if there is not one rate for each period.
    `NullPointerException` - if any argument is `null`.

Method Detail

### getGammaAlphas

    public double[] getGammaAlphas()

  Returns the parameters αG, p for the gamma rates.

  Returns:
    the αG, p parameters for this object.

### getGammaLambdas

    public double[] getGammaLambdas()

  Returns the λp parameters for the arrivals rates.

  Returns:
    the λp parameters.

### setGammaParams

    public void setGammaParams(double[] galphas,
                               double[] glambdas)

  Sets the αG, p and λp parameters for the gamma arrival rates to `galphas` and `glambdas`, respectively.

  Parameters:
    `galphas` - the new αG, p parameters.
    `glambdas` - the new λp parameters.
  Throws:
    `NullPointerException` - if the given arrays are `null`.
    `IllegalArgumentException` - if the length of the given arrays does not correspond to at least the number of periods.

### getSigma

    public double[][] getSigma()

  Returns the correlation matrix associated with this arrival process.

  Returns:
    the associated correlation matrix.

### setSigma

    public void setSigma(double[][] CorrMtx)

  Sets the associated correlation matrix to `CorrMtx`.

  Parameters:
    `CorrMtx` - the new sigma correlation matrix.
  Throws:
    `NullPointerException` - if `CorrMtx` is `null`.
    `IllegalArgumentException` - if `CorrMtx` is not a P×P symmetric and positive-definite matrix.

### getBusynessStream

    public RandomStream getBusynessStream()

  Returns the random stream used to generate the busyness factors for the Poisson arrival process.

  Returns:
    the random stream for the values of λp.

### setBusynessStream

    public void setBusynessStream(RandomStream busynessStream)

  Changes the random stream used to generate the busyness factors for the Poisson arrival process.

  Parameters:
    `busynessStream` - random number generator for the λp values.
  Throws:
    `NullPointerException` - if the parameter is `null`.

### getExpectedArrivalRate

    public double getExpectedArrivalRate(int p)

  Description copied from class: `ContactArrivalProcess`
  Determines the expected arrival rate in period `p` for this arrival process assuming that the expected value of the busyness factor is 1. The arrival rate corresponds to the expected number of arrivals per simulation time unit during the specified period; one must multiply the rate by the period duration to get the expected number of arrivals during the period. If arrival rates are deterministic, this returns the same value as `ContactArrivalProcess.getArrivalRate(int)`.

  If [B]≠1, one should use `ContactArrivalProcess.getExpectedArrivalRateB(int)` which takes the expectation of the busyness factor into account.

  If the expected arrival rate is not available, throws an `UnsupportedOperationException`. This is the default behavior of this method if not overridden by a subclass.

  Overrides:
    `getExpectedArrivalRate` in class `PiecewiseConstantPoissonArrivalProcess`
  Parameters:
    `p` - the queried period index.
  Returns:
    the expected arrival rate in that period.

### getExpectedArrivalRate

    public double getExpectedArrivalRate(double st,
                                         double et)

  Description copied from class: `ContactArrivalProcess`
  Determines the expected mean arrival rate in time interval [s, e] for this arrival process assuming that the expected value of the busyness factor is 1. The arrival rate corresponds to the expected number of arrivals per simulation time unit during the specified interval; one must multiply the rate by the interval length to get the expected number of arrivals during the interval. If arrival rates are deterministic, this returns the same value as `ContactArrivalProcess.getArrivalRate(double,double)`. If λ(t) is the arrival rate at time t, this method returns

  [λ(t)]dt/(e - s).

  If [B]≠1, one should use `ContactArrivalProcess.getExpectedArrivalRateB(double,double)` which takes the expectation of the busyness factor into account.

  This method returns 0 if e≤s.

  If the expected arrival rate is not available, throws an `UnsupportedOperationException`. This is the default behavior of this method if not overridden by a subclass.

  Overrides:
    `getExpectedArrivalRate` in class `PiecewiseConstantPoissonArrivalProcess`
  Parameters:
    `st` - the starting time s.
    `et` - the ending time e.
  Returns:
    the expected arrival rate in the given time interval.

### init

    public void init()

  Description copied from class: `ContactArrivalProcess`
  Initializes the new arrival process. If this method is overridden by a subclass, it is important to call `super.init()` in order to ensure that everything is initialized correctly.

  Specified by:
    `init` in interface `ContactSource`
  Specified by:
    `init` in interface `Initializable`
  Overrides:
    `init` in class `PiecewiseConstantPoissonArrivalProcess`

### toString

    public String toString()

  Overrides:
    `toString` in class `PiecewiseConstantPoissonArrivalProcess`

### getMLE

    public static double[] getMLE(int[][] arrivals,
                                  int numObs,
                                  int numPeriods,
                                  int numMC,
                                  CorrelationFit fit,
                                  double[][] corr)

  Estimates the parameters of a Poisson-gamma-norta-rates arrival process from the number of arrivals in the array `arrivals`. Element `arrivals[i][p]` corresponds to the number of arrivals on day `i` during period `p`, where i = 0,…, n - 1, and p = 0,…, P - 1, with n = `numObs`, and P = `numPeriods`. This method estimates and returns the parameters of the gamma distribution αG, p and the average rate λp for each period. The returned array contains (αG, 0, λ0,…, αG, P-1, λP-1). It also estimates the correlation matrix using algorithm `fit`, and returns it in `corr`. The memory for the `numPeriods` x `numPeriods` elements of matrix `corr` must be reserved outside this method before calling it.

  Parameters:
    `arrivals` - the number of arrivals during each day and period.
    `numObs` - the number of days.
    `numPeriods` - the number of periods.
    `numMC` - the number of MonteCarlo samples used in the estimation.
    `fit` - type of fit used to compute the correlation matrix.
    `corr` - the estimated correlation matrix is returned in `corr`.
  Returns:
    the estimated gamma and lambda parameters of this process.

### getInstanceFromMLE

    public static PoissonGammaNortaRatesArrivalProcess getInstanceFromMLE(PeriodChangeEvent pce,
                                                                          ContactFactory factory,
                                                                          RandomStream stream,
                                                                          RandomStream busynessStreams,
                                                                          int[][] arrivals,
                                                                          int numObs,
                                                                          int numPeriods,
                                                                          int numMC,
                                                                          CorrelationFit fit)

  Constructs a new arrival process with gamma arrival rates estimated by the maximum likelihood method based on the `numObs` observations in array `arrivals`. Element `arrivals[i][p]` corresponds to the number of arrivals on day `i` during period `p`, where i = 0,…, n - 1, p = 0,…, P - 1, n = `numObs`, and P = `numPeriods`. The parameters of the gamma-distributed arrival rates during the main periods are estimated using `getMLE(int[][],int,int,int,CorrelationFit,double[][])`. For the preliminary period, the parameters of the first main period are used. For the wrap-up periods, both parameters are set to 0; as a result, the arrival rate is always 0 during the wrap-up period.

  Parameters:
    `pce` - the period-change event marking the end of periods.
    `factory` - the contact factory used to create contacts.
    `stream` - the random stream to generate arrival times.
    `busynessStreams` - the random stream to generate busyness factors.
    `arrivals` - the number of arrivals.
    `numObs` - the number of days.
    `numPeriods` - the number of periods.
    `numMC` - the number of MonteCarlo samples used in the estimation.
    `fit` - type of fit used to compute the correlation matrix.
  Returns:
    the constructed arrival process.

Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

To submit a bug or ask questions, send an e-mail to Richard Simard.