ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.msk.model
Class RandomStreams

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.msk.model.RandomStreams
All Implemented Interfaces:
Cloneable

public class RandomStreams
extends Object
implements Cloneable

Encapsulates the random streams used by the blend/multi-skill call center simulator. The model uses one random stream for each type of random variate for better synchronization when using common random numbers. This class creates, stores, and manages all these random streams.

Often, this class is not used directly since the CallCenter class provides a constructor which implicitly creates the random streams. However, it can be useful to get the RandomStreams object of a model, using the CallCenter.getRandomStreams() method, in order to retrieve the reference to a particular random stream, or to pass the random streams to a new model. Creating several models with the same random streams can improve synchronization when comparing systems with common random numbers.

However, if several instances of CallCenter are used in parallel, each instance should have its own random streams. The clone() method can be used if seeds must be shared between two instances of this class.


Field Summary
static int NUMAGENTGROUPSTREAMS
          Number of streams for agent groups.
static int NUMAPSTREAMS
          Number of random streams for arrival processes.
static int NUMDIALERSTREAMS
          Number of streams for dialers.
static int NUMFACTORYSTREAMS
          Number of random streams for a contact factory.
static int NUMFACTORYSTREAMS2
          Number of random streams for a contact factory.
 
Constructor Summary
RandomStreams(RandomStreamFactory rsf, CallCenterParams ccParams)
          Creates a new set of random streams using the random stream factory rsf, and the call center parameters ccParams.
 
Method Summary
 RandomStreams clone()
          Creates a clone of this object and all the contained random streams.
 void createStreams(CallCenterParams ccParams)
          Creates the necessary random streams for supporting K = $ \Ki$ + $ \Ko$ contact types, and I agent groups.
 RandomStream getAgentGroupStream(int i, AgentGroupStreamType s)
          Returns the random stream of type s used by the agent group i.
 RandomStream getArrivalProcessPStream(int ki)
          Returns the random stream used to select generated call type for the ki-th arrival process generating calls of multiple types.
 RandomStream getArrivalProcessStream(int ki, ArrivalProcessStreamType s)
          Returns the random stream of type s used by the arrival process with index ki.
 RandomStream getCallFactoryStream(int k, CallFactoryStreamType s)
          Returns the random stream of type s used by the contact factory with index k.
 RandomStream getCallFactoryStream2(int k, CallFactoryStreamType2 s)
          Similar to getCallFactoryStream(int,CallFactoryStreamType), for a complementary set of random streams.
 RandomStream getDialerPStream(int ko)
          Returns the random stream used to select generated call type for the ko-th dialer generating calls of multiple types.
 RandomStream getDialerStream(int ko, DialerStreamType s)
          Returns the random stream of type s used by the dialer with index ko.
 RandomStreamFactory getRandomStreamFactory()
          Returns the random stream factory used by the createStreams(CallCenterParams) method of this object to create random streams.
 Set<RandomStream> getRandomStreamsInit()
          Returns the set regrouping random streams used during the initialization of replications only.
 Set<RandomStream> getRandomStreamsSim()
          Returns the set of random streams regrouping random streams used during the whole simulation.
 RandomStream getStreamAgentSelection()
          Returns the random stream used for agent selection during routing, if agent selection is randomized.
 RandomStream getStreamB()
          Returns the random stream used for the global busyness factor.
 RandomStream getStreamContactSelection()
          Returns the random stream used for contact selection during routing, if contact selection is randomized.
 RandomStream getStreamCT()
          Returns the random stream used for generating contact type indices while the system is initialized non-empty, for a simulation on an infinite horizon using batch means.
 void moveToInit()
           
 void setRandomStreamFactory(RandomStreamFactory rsf)
          Sets the associated random stream factory to rsf.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUMFACTORYSTREAMS

public static final int NUMFACTORYSTREAMS
Number of random streams for a contact factory.


NUMFACTORYSTREAMS2

public static final int NUMFACTORYSTREAMS2
Number of random streams for a contact factory.


NUMAPSTREAMS

public static final int NUMAPSTREAMS
Number of random streams for arrival processes.


NUMDIALERSTREAMS

public static final int NUMDIALERSTREAMS
Number of streams for dialers.


NUMAGENTGROUPSTREAMS

public static final int NUMAGENTGROUPSTREAMS
Number of streams for agent groups.

Constructor Detail

RandomStreams

public RandomStreams(RandomStreamFactory rsf,
                     CallCenterParams ccParams)
Creates a new set of random streams using the random stream factory rsf, and the call center parameters ccParams. The parameters are used to determine the number of call types, agent groups, etc., in order to set the number of streams of each type to create.

This method sets the random stream factory returned by getRandomStreamFactory(), and calls createStreams(CallCenterParams).

Parameters:
rsf - the random stream factory used to create each RandomStream instance.
ccParams - the parameters of the call center for which random streams are created.
Throws:
NullPointerException - if rsf or ccParams are null.
Method Detail

createStreams

public void createStreams(CallCenterParams ccParams)
Creates the necessary random streams for supporting K = $ \Ki$ + $ \Ko$ contact types, and I agent groups. This method reuses every stream associated with this object; it only creates new streams when needed. Consequently, it cannot be used to set new random seeds for every stream. Setting new seeds can be done by constructing a new RandomStreams instance.

Parameters:
ccParams - the parameters of the call center.
Throws:
NullPointerException - if ccParams is null.

moveToInit

public void moveToInit()

getRandomStreamFactory

public RandomStreamFactory getRandomStreamFactory()
Returns the random stream factory used by the createStreams(CallCenterParams) method of this object to create random streams.

Returns:
the associated random stream factory.

setRandomStreamFactory

public void setRandomStreamFactory(RandomStreamFactory rsf)
Sets the associated random stream factory to rsf. The new factory will only affect streams created by subsequent calls to createStreams(CallCenterParams), not already created streams.

Parameters:
rsf - the new random stream factory.
Throws:
NullPointerException - if rsf is null.

getRandomStreamsInit

public Set<RandomStream> getRandomStreamsInit()
Returns the set regrouping random streams used during the initialization of replications only. Streams in this set can, for example, set the busyness factor for the day, the total (random) number of arrivals, etc.

Returns:
the set of random streams used for initialization.

getRandomStreamsSim

public Set<RandomStream> getRandomStreamsSim()
Returns the set of random streams regrouping random streams used during the whole simulation. These streams may, for example, generate inter-arrival, patience, and service times.

Returns:
the set of random streams.

getStreamCT

public RandomStream getStreamCT()
Returns the random stream used for generating contact type indices while the system is initialized non-empty, for a simulation on an infinite horizon using batch means.

Returns:
the random stream for contact type indices.

getStreamB

public RandomStream getStreamB()
Returns the random stream used for the global busyness factor. This stream is used only at the beginning of a replication, for a finite-horizon simulation, if a distribution was given for the busyness factor B of the day.

Returns:
the random stream used for the global busyness factor.

getCallFactoryStream

public RandomStream getCallFactoryStream(int k,
                                         CallFactoryStreamType s)
Returns the random stream of type s used by the contact factory with index k.

Parameters:
k - the index of the call factory.
s - the type of the stream.
Returns:
the random stream.

getCallFactoryStream2

public RandomStream getCallFactoryStream2(int k,
                                          CallFactoryStreamType2 s)
Similar to getCallFactoryStream(int,CallFactoryStreamType), for a complementary set of random streams. These streams, used for call transfer and virtual queueing, were added at a later time, so a second set was used to avoid changing the seeds of other streams.

Parameters:
k - the index of the call factory.
s - the type of the complementary stream.
Returns:
the random stream.

getArrivalProcessStream

public RandomStream getArrivalProcessStream(int ki,
                                            ArrivalProcessStreamType s)
Returns the random stream of type s used by the arrival process with index ki.

Parameters:
ki - the index of the arrival process.
s - the type of the stream.
Returns:
the random stream.

getArrivalProcessPStream

public RandomStream getArrivalProcessPStream(int ki)
Returns the random stream used to select generated call type for the ki-th arrival process generating calls of multiple types.

Parameters:
ki - the index of the arrival process.
Returns:
the random stream.

getDialerStream

public RandomStream getDialerStream(int ko,
                                    DialerStreamType s)
Returns the random stream of type s used by the dialer with index ko.

Parameters:
ko - the index of the dialer.
s - the type of the stream.
Returns:
the random stream.

getDialerPStream

public RandomStream getDialerPStream(int ko)
Returns the random stream used to select generated call type for the ko-th dialer generating calls of multiple types.

Parameters:
ko - the index of the dialer.
Returns:
the random stream.

getAgentGroupStream

public RandomStream getAgentGroupStream(int i,
                                        AgentGroupStreamType s)
Returns the random stream of type s used by the agent group i.

Parameters:
i - the index of the agent group.
s - the type of the stream.
Returns:
the random stream.

getStreamAgentSelection

public RandomStream getStreamAgentSelection()
Returns the random stream used for agent selection during routing, if agent selection is randomized.

Returns:
the random stream used for agent selection.

getStreamContactSelection

public RandomStream getStreamContactSelection()
Returns the random stream used for contact selection during routing, if contact selection is randomized.

Returns:
the random stream used for contact selection.

clone

public RandomStreams clone()
Creates a clone of this object and all the contained random streams. This method creates a copy of this object, and clones every random stream by casting them to CloneableRandomStream and calling clone(). Each generator in the cloned object has the same properties and seeds as the corresponding generator in the original object.

Overrides:
clone in class Object
Throws:
ClassCastException - if at least one encapsulated random stream does not implement the CloneableRandomStream interface.

ContactCenters
V. 0.9.9.

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