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 PoissonGammaArrivalProcess

    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.PoissonGammaArrivalProcess

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

    public class PoissonGammaArrivalProcess

extends PiecewiseConstantPoissonArrivalProcess

Represents a doubly-stochastic Poisson process with piecewise-constant randomized arrival rates [13]. 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 λp times a gamma random variable with shape and scale parameters αG, p, and mean 1. However, if αG, p or λp are 0, the resulting arrival rate during period p is always set to 0. As with the Poisson process with deterministic arrival rates, the generated base arrival rates are multiplied by a global busyness factor B for the day, and also by a busyness factor Bp specific to each period of the day in order 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
`PoissonGammaArrivalProcess(PeriodChangeEvent pce, ContactFactory factory, double[] galphas, double[] glambdas, RandomStream stream, RandomStream streamBusyness)` Constructs a new Poisson-gamma arrival process using `factory` to instantiate contacts.
`PoissonGammaArrivalProcess(PeriodChangeEvent pce, ContactFactory factory, double[] galphas, double[] glambdas, RandomStream stream, RandomStream streamBusyness, RandomVariateGen bgen)`

Method Summary
`RandomStream` | `getBusynessStream()` Returns the random stream used to generate the busyness factors for this 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 of the gamma distribution for busyness.
`double[]` | `getGammaLambdas()` Returns the λp parameters for the rates.
`static PoissonGammaArrivalProcess` | `getInstanceFromMLE(PeriodChangeEvent pce, ContactFactory factory, RandomStream stream, RandomStream streamBusyness, int[][] arrivals, int numObs, int numPeriods)` 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)` Estimates the parameters of a Poisson-gamma arrival process from the number of arrivals in the array `arrivals`.
`static double[]` | `getMLEBB(int[][] arrivals, int numObs, int numPeriods, int numMC, ArrivalProcessParams arrPar)` Estimates the parameters of a Poisson-gamma arrival process for the case of a global busyness factor for the day, and specific busyness factors for each period of the day, from the number of arrivals in the array `arrivals`.
`void` | `init()` Initializes the new arrival process.
`void` | `setBusynessStream(RandomStream streamBusyness)` Changes the random stream used to generate the busyness factors for this arrival process.
`void` | `setGammaParams(double[] galphas, double[] glambdas)` Sets the αG, p and λp parameters for the busyness and the arrival rates to `galphas` and `glambdas`, respectively.
`String` | `toString()`

Methods inherited from class umontreal.iro.lecuyer.contactcenters.contact.PiecewiseConstantPoissonArrivalProcess
`changePeriod, getArrivalRate, getArrivalRate, getInstanceFromMLE, getLambdas, 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

### PoissonGammaArrivalProcess

    public PoissonGammaArrivalProcess(PeriodChangeEvent pce,
                                      ContactFactory factory,
                                      double[] galphas,
                                      double[] glambdas,
                                      RandomStream stream,
                                      RandomStream streamBusyness)

  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 `streamBusyness` is used to generate the busyness factors for each period of the day.

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

### PoissonGammaArrivalProcess

    public PoissonGammaArrivalProcess(PeriodChangeEvent pce,
                                      ContactFactory factory,
                                      double[] galphas,
                                      double[] glambdas,
                                      RandomStream stream,
                                      RandomStream streamBusyness,
                                      RandomVariateGen bgen)

Method Detail

### getGammaAlphas

    public double[] getGammaAlphas()

  Returns the parameters αG, p of the gamma distribution for busyness.

  Returns:
    the αG, p parameters.

### getGammaLambdas

    public double[] getGammaLambdas()

  Returns the λp parameters for the rates.

  Returns:
    the λp parameters.

### setGammaParams

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

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

  Parameters:
    `galphas` - the new αG, p parameters.
    `glambdas` - the new λp rates.
  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.

### getBusynessStream

    public RandomStream getBusynessStream()

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

  Returns:
    the random stream for the values of the busyness factors.

### setBusynessStream

    public void setBusynessStream(RandomStream streamBusyness)

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

  Parameters:
    `streamBusyness` - random number stream for the busyness factors.
  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)

  Estimates the parameters of a Poisson-gamma 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 αG, p and λp independently for each period, assuming that the number of arrivals in that period follows the negative binomial distribution with first parameter αG, p. The returned array contains (αG, 0, λ0,…, αG, P-1, λP-1).

  Parameters:
    `arrivals` - the number of arrivals during each day and period.
    `numObs` - the number of days.
    `numPeriods` - the number of periods.
  Returns:
    the estimated αj and λj parameters.

### getInstanceFromMLE

    public static PoissonGammaArrivalProcess getInstanceFromMLE(PeriodChangeEvent pce,
                                                                ContactFactory factory,
                                                                RandomStream stream,
                                                                RandomStream streamBusyness,
                                                                int[][] arrivals,
                                                                int numObs,
                                                                int numPeriods)

  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, with n = `numObs`, and P = `numPeriods`. The parameters of the gamma-distributed arrival rates during the main periods are estimated using `getMLE(int[][],int,int)`. 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` - random stream to generate arrival times.
    `streamBusyness` - random stream to generate busyness factors.
    `arrivals` - the number of arrivals.
    `numObs` - the number of days.
    `numPeriods` - the number of periods.
  Returns:
    the constructed arrival process.

### getMLEBB

    public static double[] getMLEBB(int[][] arrivals,
                                    int numObs,
                                    int numPeriods,
                                    int numMC,
                                    ArrivalProcessParams arrPar)

  Estimates the parameters of a Poisson-gamma arrival process for the case of a global busyness factor for the day, and specific busyness factors for each period of the day, 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). The global busyness factor is also estimated. This is the case where the arrivals are determined from B*Bj*λj.

  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.
    `arrPar` - other parameters of the arrival process.
  Returns:
    the estimated gamma and lambda parameters of this 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.