|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.contactcenters.contact.ContactArrivalProcess
umontreal.iro.lecuyer.contactcenters.contact.PoissonArrivalProcess
umontreal.iro.lecuyer.contactcenters.contact.PiecewiseConstantPoissonArrivalProcess
public class PiecewiseConstantPoissonArrivalProcess
Represents a non-homogeneous Poisson arrival process with
piecewise-constant arrival rates.
Each inter-arrival time is an exponential variate with rate
λ(t), where
λ(t) = Bλp(t) is a piecewise-constant function
over simulation time.
The function p(t) gives the period corresponding to simulation time t
whereas
λp is the base arrival rate for the Poisson process,
during period p.
This class uses the PoissonArrivalProcess
base class
to generate inter-arrival times and to adjust the arrival time
when the rate changes.
If a single period p is simulated as if it was infinite in the model,
the arrival rate is fixed to λp.
Field Summary | |
---|---|
protected RandomVariateGen |
busyGen
|
static double |
s_bgammaParam
Contains the parameter for the gamma-distributed busyness factor given by methods for parameter estimation. |
protected static int |
s_numMC
|
protected static double |
varianceEpsilon
|
Fields inherited from class umontreal.iro.lecuyer.contactcenters.contact.ContactArrivalProcess |
---|
contactEvent |
Constructor Summary | |
---|---|
PiecewiseConstantPoissonArrivalProcess(PeriodChangeEvent pce,
ContactFactory factory,
double[] lambdas,
RandomStream stream)
Constructs a new Poisson arrival process with piecewise-constant arrival rates instantiating new contacts using factory. |
|
PiecewiseConstantPoissonArrivalProcess(PeriodChangeEvent pce,
ContactFactory factory,
double[] lambdas,
RandomStream stream,
RandomVariateGen bgen)
Similar to (PeriodChangeEvent,
ContactFactory, double[], RandomStream) , but with busyness generator
bgen. |
Method Summary | |
---|---|
void |
changePeriod(PeriodChangeEvent pce)
Switches to the next period defined by pce. |
double |
getArrivalRate(double st,
double et)
Determines the mean arrival rate in time interval [s, e]. |
double |
getArrivalRate(int p)
Determines the arrival rate in period p 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. |
static PiecewiseConstantPoissonArrivalProcess |
getInstanceFromMLE(PeriodChangeEvent pce,
ContactFactory factory,
RandomStream stream,
int[][] arrivals,
int numObs,
int numPeriods,
boolean withGammaBusyness)
Constructs a new arrival process with arrival rates estimated by the maximum likelihood method based on the numObs observations in array arrivals. |
double[] |
getLambdas()
Returns the current value of lambdas. |
static double[] |
getMLE(int[][] arrivals,
int numObs,
int numPeriods)
Estimates the parameters of a Poisson arrival process with piecewise-constant arrival rate from the number of arrivals in the array arrivals, and returns an array giving the estimated arrival rate for each main period. |
static double[] |
getMLENegMulti(int[][] arrivals,
int numObs,
int numPeriods)
Estimates the parameters of a Poisson arrival process with piecewise-constant arrival rate multiplied by a day-specific busyness factor following the gamma (α0, α0) distribution from the number of arrivals in the array arrivals. |
static int |
getNumMC()
Sets the number of Monte Carlo samples to n. |
PeriodChangeEvent |
getPeriodChangeEvent()
Returns the period-change event associated with this object. |
static double |
getVarianceEpsilon()
Returns the value of varianceEpsilon. |
void |
init()
Initializes the new arrival process. |
boolean |
isNormalizing()
Determines if the base arrival rates are normalized with period duration. |
void |
setLambdas(double[] lambdas)
Sets the base arrival rates to lambdas. |
void |
setNormalizing(boolean b)
Sets the arrival rates normalization indicator to b. |
static void |
setNumMC(int n)
Sets the number of Monte Carlo samples to n. |
static void |
setVarianceEpsilon(double eps)
Sets the lower limit for the variance of the busyness distribution. |
void |
startStationary()
This method checks that the associated period-change event is locked to a fixed period, and calls ContactArrivalProcess.start() if this is the case. |
void |
stop(PeriodChangeEvent pce)
This method is called after the period-change event is stopped by PeriodChangeEvent.stop() . |
String |
toString()
|
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 |
Field Detail |
---|
protected RandomVariateGen busyGen
protected static double varianceEpsilon
public static double s_bgammaParam
protected static int s_numMC
Constructor Detail |
---|
public PiecewiseConstantPoissonArrivalProcess(PeriodChangeEvent pce, ContactFactory factory, double[] lambdas, RandomStream stream)
pce
- the period-change event associated with this object.factory
- the factory instantiating contacts.lambdas
- the base arrival rates.stream
- the random number generator for inter-arrival times.
IllegalArgumentException
- if there is not one rate
per period.
NullPointerException
- if any argument is null.public PiecewiseConstantPoissonArrivalProcess(PeriodChangeEvent pce, ContactFactory factory, double[] lambdas, RandomStream stream, RandomVariateGen bgen)
(PeriodChangeEvent,
ContactFactory, double[], RandomStream)
, but with busyness generator
bgen. It generates a busyness factor multiplying the base rate.
pce
- the period-change event associated with this object.factory
- the factory instantiating contacts.lambdas
- the base arrival rates.stream
- the random number generator for inter-arrival times.bgen
- random number generator for busyness
IllegalArgumentException
- if there is not one rate
per period.
NullPointerException
- if any argument is null.Method Detail |
---|
public static void setNumMC(int n)
n
- public static int getNumMC()
public boolean isNormalizing()
getLambda
(p)/getPeriodChangeEvent()
.getPeriodDuration (p).
No normalization is applied for the wrap-up period, because
its duration is unknown when it starts.
If normalization is disabled (the default), the base arrival
rates are used as specified.
public void setNormalizing(boolean b)
b
- the new arrival rate normalization indicator.isNormalizing()
public PeriodChangeEvent getPeriodChangeEvent()
public void startStationary()
ContactArrivalProcess.start()
if this is the case.
Otherwise, it throws an unsupported-operation
exception since the arrival rate can
change with the current period.
startStationary
in class PoissonArrivalProcess
public double getArrivalRate(int p)
ContactArrivalProcess
If arrival rate is random, this returns the arrival rate
for the current replication.
One should use ContactArrivalProcess.getExpectedArrivalRate(int)
or ContactArrivalProcess.getExpectedArrivalRateB(int)
to get the
expected arrival rate.
If the arrival rate is not available,
throws an UnsupportedOperationException
.
getArrivalRate
in class PoissonArrivalProcess
p
- the queried period index.
public double getArrivalRate(double st, double et)
ContactArrivalProcess
If arrival rate is random, this returns the arrival rate
for the current replication.
One should use ContactArrivalProcess.getExpectedArrivalRate(double,double)
or ContactArrivalProcess.getExpectedArrivalRateB(double,double)
to get the
expected arrival rate.
This method returns 0 if e≤s.
If the arrival rate is not available,
throws an UnsupportedOperationException
.
This is the default behavior of this
method if not overridden by a subclass.
getArrivalRate
in class PoissonArrivalProcess
st
- the starting time s.et
- the ending time e.
public double getExpectedArrivalRate(int p)
ContactArrivalProcess
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.
getExpectedArrivalRate
in class PoissonArrivalProcess
p
- the queried period index.
public double getExpectedArrivalRate(double st, double et)
ContactArrivalProcess
ContactArrivalProcess.getArrivalRate(double,double)
.
If
λ(t) is the arrival rate at time t, this
method returns
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.
getExpectedArrivalRate
in class PoissonArrivalProcess
st
- the starting time s.et
- the ending time e.
public double[] getLambdas()
public void setLambdas(double[] lambdas)
lambdas
- the new base arrival rates.
NullPointerException
- if the given array is null.
IllegalArgumentException
- if the length of the array
is smaller than the number of periods.public void init()
ContactArrivalProcess
init
in interface ContactSource
init
in interface Initializable
init
in class PoissonArrivalProcess
public void changePeriod(PeriodChangeEvent pce)
PeriodChangeListener
PeriodChangeEvent.getCurrentPeriod()
returns the index
of the new period.
changePeriod
in interface PeriodChangeListener
pce
- the source period-change event.public void stop(PeriodChangeEvent pce)
PeriodChangeListener
PeriodChangeEvent.stop()
.
stop
in interface PeriodChangeListener
pce
- the period-change event being stopped.public String toString()
toString
in class PoissonArrivalProcess
public static double[] getMLE(int[][] arrivals, int numObs, int numPeriods)
arrivals
- the number of arrivals during each day and period.numObs
- the number of days.numPeriods
- the number of periods.
public static void setVarianceEpsilon(double eps)
public static double getVarianceEpsilon()
public static double[] getMLENegMulti(int[][] arrivals, int numObs, int numPeriods)
s_bgammaParam
.
This method assumes that the number of arrivals
during main periods, represented by the vector
A1,…, AP,
follows the negative multinomial distribution with
parameters
(α0, ρ1,…, ρP)
where
ρp = λp/(α0 +
arrivals
- the number of arrivals during each day and period.numObs
- the number of days.numPeriods
- the number of periods.
public static PiecewiseConstantPoissonArrivalProcess getInstanceFromMLE(PeriodChangeEvent pce, ContactFactory factory, RandomStream stream, int[][] arrivals, int numObs, int numPeriods, boolean withGammaBusyness)
s_bgammaParam
.
Otherwise, the periods are considered independent,
and the number of arrivals during a period is
considered to follow the Poisson distribution.
The expected number of arrivals used during
the preliminary period
is equal to the expectation estimated for the first main
period while the arrival rate during the
wrap-up period is always 0.
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.arrivals
- the number of arrivals.numObs
- the number of days.numPeriods
- the number of periods.withGammaBusyness
- determines if the α0
parameter is estimated in addition to the arrival rates.
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |