ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.contact
Class PoissonArrivalProcessWithInversion

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.PoissonArrivalProcessWithInversion
All Implemented Interfaces:
ContactSource, Initializable, Named, ToggleElement

public class PoissonArrivalProcessWithInversion
extends PoissonArrivalProcess

Defines a Poisson arrival process with arrival rate (t) at time t and generated by inversion. If

(t) = $\displaystyle \htint_{0}^{t}$(s)ds

is the cumulative arrival rate of the Poisson process, and M(t) = N(Λ-1(t)/B), {M(t), t≥0} is a standard Poisson process, i.e., homogeneous with arrival rate 1. If Λ-1(t) can be computed easily, this class generates arrival times by inversion as follows: generate the arrival times X0, X1,… for a standard Poisson process and let Tj = Λ-1(Xj)/B be the arrival times of the non-homogeneous Poisson process.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.contactcenters.contact.ContactArrivalProcess
contactEvent
 
Constructor Summary
PoissonArrivalProcessWithInversion(ContactFactory factory, RandomStream stream, MathFunction cLambda)
          Similar to RandomStream,MathFunction,MathFunction) PoissonArrivalProcessWithInversion (factory, stream, cLambda, f), where f is a function performing the inversion of cLambda using the Brent-Decker root finding algorithm.
PoissonArrivalProcessWithInversion(ContactFactory factory, RandomStream stream, MathFunction cLambda, MathFunction invLambda)
          Constructs a new transformed Poisson arrival process using contact factory factory for creating contacts, random stream stream for generating uniforms, cLambda for the Λ(t) function, and invLambda for the Λ-1(t) function.
PoissonArrivalProcessWithInversion(Simulator sim, ContactFactory factory, RandomStream stream, MathFunction cLambda)
          Equivalent to PoissonArrivalProcessWithInversion(ContactFactory,RandomStream,MathFunction), using the given simulator sim.
PoissonArrivalProcessWithInversion(Simulator sim, ContactFactory factory, RandomStream stream, MathFunction cLambda, MathFunction invLambda)
          Equivalent to PoissonArrivalProcessWithInversion(ContactFactory,RandomStream,MathFunction,MathFunction), using the given simulator sim.
 
Method Summary
 double getArrivalRate(double st, double et)
          Determines the mean arrival rate in time interval [s, e].
 MathFunction getCumulativeLambdaFunction()
          Returns the function Λ(t) in use.
 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.
 MathFunction getInvertedLambdaFunction()
          Returns the function Λ-1(t) in use.
 double nextTime()
          Computes and returns the time before the next contact arrival is simulated by this object.
 void setCumulativeLambdaFunction(MathFunction cLambda)
          Sets the Λ(t) function to cLambda.
 void setInvertedLambdaFunction(MathFunction invLambda)
          Sets the Λ-1(t) function to invLambda.
 void setLambda(double lambda)
          Changes the value of λ to newLambda.
 void startStationary()
          This method calls ContactArrivalProcess.start() assuming that the λ arrival rate will not change during simulation.
 
Methods inherited from class umontreal.iro.lecuyer.contactcenters.contact.PoissonArrivalProcess
clearCache, getArrivalRate, getExpectedArrivalRate, getGenWithCache, getInstanceFromMLE, getLambda, getMLE, getStream, init, initCache, isCaching, setCaching, setStream, 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

PoissonArrivalProcessWithInversion

public PoissonArrivalProcessWithInversion(ContactFactory factory,
                                          RandomStream stream,
                                          MathFunction cLambda,
                                          MathFunction invLambda)
Constructs a new transformed Poisson arrival process using contact factory factory for creating contacts, random stream stream for generating uniforms, cLambda for the Λ(t) function, and invLambda for the Λ-1(t) function.

Parameters:
factory - the contact factory used to create contacts.
stream - the random stream used to generate uniforms.
cLambda - the function defining Λ(t).
invLambda - the function defining Λ-1(t).
Throws:
NullPointerException - if any argument is null.

PoissonArrivalProcessWithInversion

public PoissonArrivalProcessWithInversion(Simulator sim,
                                          ContactFactory factory,
                                          RandomStream stream,
                                          MathFunction cLambda,
                                          MathFunction invLambda)
Equivalent to PoissonArrivalProcessWithInversion(ContactFactory,RandomStream,MathFunction,MathFunction), using the given simulator sim.


PoissonArrivalProcessWithInversion

public PoissonArrivalProcessWithInversion(ContactFactory factory,
                                          RandomStream stream,
                                          MathFunction cLambda)
Similar to RandomStream,MathFunction,MathFunction) PoissonArrivalProcessWithInversion (factory, stream, cLambda, f), where f is a function performing the inversion of cLambda using the Brent-Decker root finding algorithm. This can be used when the Λ-1(t) function is unavailable, and Λ(t) can be computed efficiently. However, the generated inversion function can be slow to compute.

Parameters:
factory - the contact factory used to create contacts.
stream - the random stream used to generate uniforms.
cLambda - the function defining Λ(t).
Throws:
NullPointerException - if any argument is null.

PoissonArrivalProcessWithInversion

public PoissonArrivalProcessWithInversion(Simulator sim,
                                          ContactFactory factory,
                                          RandomStream stream,
                                          MathFunction cLambda)
Equivalent to PoissonArrivalProcessWithInversion(ContactFactory,RandomStream,MathFunction), using the given simulator sim.

Method Detail

startStationary

public void startStationary()
Description copied from class: PoissonArrivalProcess
This method calls ContactArrivalProcess.start() assuming that the λ arrival rate will not change during simulation. Subclasses violating this assumption should override this method.

Overrides:
startStationary in class PoissonArrivalProcess

getCumulativeLambdaFunction

public MathFunction getCumulativeLambdaFunction()
Returns the function Λ(t) in use.

Returns:
the Λ(t) function.

setCumulativeLambdaFunction

public void setCumulativeLambdaFunction(MathFunction cLambda)
Sets the Λ(t) function to cLambda.

Parameters:
cLambda - the new Λ(t) function.
Throws:
NullPointerException - if cLambda is null.

getInvertedLambdaFunction

public MathFunction getInvertedLambdaFunction()
Returns the function Λ-1(t) in use.

Returns:
the Λ-1(t) function.

setInvertedLambdaFunction

public void setInvertedLambdaFunction(MathFunction invLambda)
Sets the Λ-1(t) function to invLambda. If invLambda is null, the method sets the current Λ-1(t) to the default inversion function, which uses the Brent-Decker root finder.

Parameters:
invLambda - the new Λ-1(t) function.

setLambda

public void setLambda(double lambda)
Description copied from class: PoissonArrivalProcess
Changes the value of λ to newLambda. This adjusts the time of the next arrival if necessary. If newLambda is set to 0, the currently scheduled arrival, if any, is cancelled and the Poisson process is stopped. The Poisson process can be restarted by setting a new non-zero λ value.

Overrides:
setLambda in class PoissonArrivalProcess
Parameters:
lambda - the new value of λ.

nextTime

public double nextTime()
Description copied from class: ContactArrivalProcess
Computes and returns the time before the next contact arrival is simulated by this object. If this method returns Double.POSITIVE_INFINITY, no more arrival events will be scheduled until the arrival process is reinitialized.

Overrides:
nextTime in class PoissonArrivalProcess
Returns:
the time before the next arrival.

getArrivalRate

public double getArrivalRate(double st,
                             double et)
Description copied from class: ContactArrivalProcess
Determines the mean arrival rate in time interval [s, e]. 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 λ(t) is the arrival rate at time t, this method returns the result of

$\displaystyle \htint_{s}^{e}$λ(t)dt/(e - s).

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

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

Overrides:
getArrivalRate in class PoissonArrivalProcess
Parameters:
st - the starting time s.
et - the ending time e.
Returns:
the arrival rate in the given time interval.

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

$\displaystyle \htint_{s}^{e}$$\displaystyle \E$[λ(t)]dt/(e - s).

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

This method returns 0 if es.

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 PoissonArrivalProcess
Parameters:
st - the starting time s.
et - the ending time e.
Returns:
the expected arrival rate in the given time interval.

ContactCenters
V. 0.9.9.

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