|
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
public class PoissonArrivalProcess
Represents a Poisson-based contact arrival process. This base class implements a Poisson arrival process with (piecewise-)constant arrival rates: when an inter-arrival time is required, it is generated from the exponential distribution with rate Bλ. By default, the arrival rate is constant, but it may be changed at any time during the simulation. When the arrival rate changes, the currently scheduled arrival is adjusted automatically to reflect the change. This class can be used as a basis each time the rate function λ(t) of a Poisson process is piecewise-constant over the simulation time t.
Field Summary |
---|
Fields inherited from class umontreal.iro.lecuyer.contactcenters.contact.ContactArrivalProcess |
---|
contactEvent |
Constructor Summary | |
---|---|
PoissonArrivalProcess(ContactFactory factory,
double lambda,
RandomStream stream)
Constructs a new Poisson arrival process instantiating new contacts using factory. |
|
PoissonArrivalProcess(Simulator sim,
ContactFactory factory,
double lambda,
RandomStream stream)
Equivalent to PoissonArrivalProcess(ContactFactory,double,RandomStream) ,
with the given simulator sim. |
Method Summary | |
---|---|
void |
clearCache()
Clears the cached inter-arrival times for this Poisson arrival process. |
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. |
RandomVariateGenWithCache |
getGenWithCache()
Returns the random variate generator for the exponential arrival times used when caching is enabled. |
static PoissonArrivalProcess |
getInstanceFromMLE(ContactFactory factory,
RandomStream stream,
double dayLength,
int[][] arrivals,
int numObs,
int numPeriods)
Constructs a new arrival process with arrival rate estimated by the maximum likelihood method based on the numObs observations in array arrivals. |
double |
getLambda()
Returns the current value of the arrival rate λ. |
static double[] |
getMLE(int[][] arrivals,
int numObs,
int numPeriods)
Estimates the parameters of a Poisson arrival process with arrival rate λ from the number of arrivals in the array arrivals. |
RandomStream |
getStream()
Returns the random number stream used to generate the uniforms for inter-arrival times. |
void |
init()
Initializes the new arrival process. |
void |
initCache()
Resets the random variate generator cache to get the generated inter-arrival times. |
boolean |
isCaching()
Determines if the generated inter-arrival times are cached for more efficiency. |
double |
nextTime()
Computes and returns the time before the next contact arrival is simulated by this object. |
void |
setCaching(boolean caching)
Sets the caching indicator to caching for this Poisson process. |
void |
setLambda(double newLambda)
Changes the value of λ to newLambda. |
void |
setStream(RandomStream stream)
Sets the random number stream used to generate the uniforms for the inter-arrival times to stream. |
void |
startStationary()
This method calls ContactArrivalProcess.start() assuming
that the λ arrival rate will not
change during simulation. |
String |
toString()
|
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 |
---|
public PoissonArrivalProcess(ContactFactory factory, double lambda, RandomStream stream)
factory
- the factory instantiating contacts.lambda
- the initial value of
λ(t).stream
- random number stream.
IllegalArgumentException
- if lambda < 0.
NullPointerException
- if factory or
stream are null.public PoissonArrivalProcess(Simulator sim, ContactFactory factory, double lambda, RandomStream stream)
PoissonArrivalProcess(ContactFactory,double,RandomStream)
,
with the given simulator sim.
Method Detail |
---|
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 ContactArrivalProcess
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 ContactArrivalProcess
st
- the starting time s.et
- the ending time e.
public double getLambda()
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 ContactArrivalProcess
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 ContactArrivalProcess
st
- the starting time s.et
- the ending time e.
public void setLambda(double newLambda)
newLambda
- the new value of λ.
IllegalArgumentException
- if newLambda < 0.public RandomStream getStream()
public void setStream(RandomStream stream)
stream
- the new random number stream.
NullPointerException
- if stream is null.public boolean isCaching()
initCache()
method must be called
to start reusing cached values. This avoids some
computations and increases the performance, at the
expense of memory. This is useful when comparing
several contact centers with common random numbers.
By default, this caching is disabled
for more efficient memory usage.
public void setCaching(boolean caching)
caching
- the new value of the caching indicator.isCaching()
public void initCache()
isCaching()
public void clearCache()
isCaching()
public RandomVariateGenWithCache getGenWithCache()
IllegalStateException
.
IllegalStateException
- if caching is disabled.public void init()
ContactArrivalProcess
init
in interface ContactSource
init
in interface Initializable
init
in class ContactArrivalProcess
public double nextTime()
ContactArrivalProcess
nextTime
in class ContactArrivalProcess
public void startStationary()
ContactArrivalProcess.start()
assuming
that the λ arrival rate will not
change during simulation.
Subclasses violating this assumption
should override this method.
startStationary
in class ContactArrivalProcess
public String toString()
toString
in class ContactArrivalProcess
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 PoissonArrivalProcess getInstanceFromMLE(ContactFactory factory, RandomStream stream, double dayLength, int[][] arrivals, int numObs, int numPeriods)
factory
- the contact factory used to create contacts.stream
- the random stream to generate arrival times.dayLength
- the duration of the day, in simulation time units.arrivals
- the number of arrivals.numObs
- the number of days.numPeriods
- the number of periods.
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |