ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.contact
Class DirichletCompoundArrivalProcess

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.contact.ContactArrivalProcess
      extended by umontreal.iro.lecuyer.contactcenters.contact.PoissonArrivalProcess
          extended by umontreal.iro.lecuyer.contactcenters.contact.PiecewiseConstantPoissonArrivalProcess
              extended by umontreal.iro.lecuyer.contactcenters.contact.DirichletCompoundArrivalProcess
All Implemented Interfaces:
ContactSource, Initializable, Named, PeriodChangeListener, ToggleElement

public class DirichletCompoundArrivalProcess
extends PiecewiseConstantPoissonArrivalProcess

Represents a generalization of the non-homogeneous Poisson process where the arrival rates are generated from a Dirichlet compound negative multinomial distribution [19]. As proven in [3], if the arrival rate of a Poisson process is a piecewise-constant function of the simulation time given by λ(t) = p(t), B being a gamma-distributed busyness factor with shape parameter γ, the distribution of the vector (A1,…, AP) giving the number of arrivals in each main period is the negative multinomial with parameters (γ, ρ1,…, ρP+1) [12, page 292], where

ρp = $\displaystyle {\frac{{\lambda_p}}{{1 + \htsum_{j=1}^P\lambda_j}}}$, (1)
for p = 1,…, P, and ρP+1 = 1 - $ \htsum_{{j=1}}^{P}$ρj.

This arrival process generalizes the previous process by modeling A = (A1,…, AP) with a Dirichlet compound negative multinomial distribution [19] instead of a negative multinomial. In this model, the user specifies γ as well as α1,…, αP+1. At the beginning of each replication, when base arrival rates are needed, the vector (ρ1,…, ρP+1) is generated from the Dirichlet distribution with parameters (α1,…, αP+1), and the base arrival rates λ1,…, λP are determined by solving (1). This results in λp = ρp/ρP+1. During preliminary and wrap-up periods, the base arrival rate is set to 0.

The inter-arrival times are generated using the rates p, where B is a busyness given by the user. Note that this variability factor should be gamma-distributed with shape parameter γ and scale parameter 1 to remain consistent with the Dirichlet compound model.


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
DirichletCompoundArrivalProcess(PeriodChangeEvent pce, ContactFactory factory, double[] alphas, RandomStream stream, RandomStream streamRates)
          Constructs a new Dirichlet compound Poisson arrival process.
 
Method Summary
 double getAlpha(int p)
          Returns the value of the αp parameter for the Dirichlet distribution.
 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.
static DirichletCompoundArrivalProcess getInstanceFromMLE(PeriodChangeEvent pce, ContactFactory factory, RandomStream stream, RandomStream streamRates, int[][] arrivals, int numObs, int numPeriods)
          Constructs a new arrival process with parameters 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 Dirichlet compound negative multinomial arrival process with a busyness factor following the gamma (γ, 1) distribution from the number of arrivals in the array arrivals.
 RandomStream getRateStream()
          Returns the random stream used to generate the rates for the Poisson arrival process.
 void init()
          Initializes the new arrival process.
 void setAlphas(double[] alphas)
          Sets the Dirichlet parameters αp for this object.
 void setRateStream(RandomStream streamRates)
          Changes the random stream used to generate the rates for the Poisson arrival process to streamRates.
 String toString()
           
 
Methods inherited from class umontreal.iro.lecuyer.contactcenters.contact.PiecewiseConstantPoissonArrivalProcess
changePeriod, getArrivalRate, getArrivalRate, getExpectedArrivalRate, 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

DirichletCompoundArrivalProcess

public DirichletCompoundArrivalProcess(PeriodChangeEvent pce,
                                       ContactFactory factory,
                                       double[] alphas,
                                       RandomStream stream,
                                       RandomStream streamRates)
Constructs a new Dirichlet compound Poisson arrival process. The constructed process uses the period-change event pce, creates contacts using the factory factory, and uses the Dirichlet parameters alphas. The random stream stream is used for the uniforms for inter-arrival times, and streamRates is used for Dirichlet.

Parameters:
pce - the period-change event associated with this object.
factory - the factory creating contacts for this generator.
alphas - the values of the αp parameters.
stream - the random number stream for the exponential variates.
streamRates - the random number stream for the Dirichlet compound arrival rates.
Throws:
IllegalArgumentException - if the number of main periods is not alphas.length - 1, or if one αp value is negative or 0.
NullPointerException - if any argument is null.
Method Detail

getAlpha

public double getAlpha(int p)
Returns the value of the αp parameter for the Dirichlet distribution.

Parameters:
p - the index of the parameter.
Returns:
the value of the parameter.

setAlphas

public void setAlphas(double[] alphas)
Sets the Dirichlet parameters αp for this object.

Parameters:
alphas - a new vector of parameters.
Throws:
IllegalArgumentException - if the length of alphas is smaller than P + 1, where P is the number of main periods, or if one or more αp values are negative or 0.

getRateStream

public RandomStream getRateStream()
Returns the random stream used to generate the rates for the Poisson arrival process.

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

setRateStream

public void setRateStream(RandomStream streamRates)
Changes the random stream used to generate the rates for the Poisson arrival process to streamRates.

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

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

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 $ \E$[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.

getMLE

public static double[] getMLE(int[][] arrivals,
                              int numObs,
                              int numPeriods)
Estimates the parameters of a Dirichlet compound negative multinomial arrival process with a busyness factor following the gamma (γ, 1) distribution 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, n = numObs, and P = numPeriods. This returns the αp Dirichlet parameters, for P = 0,…, P, and stores the gamma busyness parameter in PiecewiseConstantPoissonArrivalProcess.s_bgammaParam.

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

getInstanceFromMLE

public static DirichletCompoundArrivalProcess getInstanceFromMLE(PeriodChangeEvent pce,
                                                                 ContactFactory factory,
                                                                 RandomStream stream,
                                                                 RandomStream streamRates,
                                                                 int[][] arrivals,
                                                                 int numObs,
                                                                 int numPeriods)
Constructs a new arrival process with parameters 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 number of arrivals is considered to follow the Dirichlet compound negative multinomial distribution, and the γ parameter for the gamma busyness factor is stored in PiecewiseConstantPoissonArrivalProcess.s_bgammaParam.

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.
streamRates - the random stream to generate Dirichlet vectors from.
arrivals - the number of arrivals.
numObs - the number of days.
numPeriods - the number of periods.
Returns:
the constructed arrival process.

ContactCenters
V. 0.9.9.

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