ContactCenters
V. 0.9.9.

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

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.contact.SingleTypeContactFactory
      extended by umontreal.iro.lecuyer.contactcenters.msk.model.CallFactory
All Implemented Interfaces:
ContactFactory
Direct Known Subclasses:
OutboundCallFactory

public class CallFactory
extends SingleTypeContactFactory

Contact factory used to create the calls for the simulator, and to generate call-specific random variates such as patience times and service times. The call factory also contains any information related to call types, such as name, properties, and the probability distribution for patience and service times.


Constructor Summary
CallFactory(CallCenter cc, CallCenterParams ccParams, CallTypeParams par, int k)
          Constructs a new call factory using the call center cc, the call center parameters ccParams, the call-type parameters par, and call type index k.
 
Method Summary
static void checkInbound(int numInCallTypes, List<ProducedCallTypeParams> types)
          For each element in the list types, tests that the type identifier returned by the ProducedCallTypeParams.getType() method is smaller than the given constant numInCallTypes.
static void checkOutbound(int numInCallTypes, int numCallTypes, List<ProducedCallTypeParams> types)
          For each element in the list types, tests that the type identifier returned by the ProducedCallTypeParams.getType() method is greater than or equal to numInCallTypes but smaller than numCallTypes.
static CallFactory create(CallCenter cc, CallCenterParams ccParams, int k)
          Constructs a new call factory using call center cc, call center parameters ccParams, and call type index k.
static RandomTypeCallFactory createRandomTypeContactFactory(CallCenter cc, List<ProducedCallTypeParams> types, RandomStream stream, boolean checkAgents)
          Constructs and returns a contact factory that can produce calls of randomly selected types.
 CallCenter getCallCenter()
          Returns the call center object containing this call factory.
 ServiceTimesManager getConferenceTimesManager()
          Returns an object managing the random variate generators for conference times between primary and secondary agents.
 double getExpectedWaitingTimeMult(int mp)
          Returns the multiplier for the expected waiting time used to determine the time spent by a caller arriving during main period mp in the virtual queue.
 double getExpectedWaitingTimeThresh(int mp)
          Returns the threshold on the expected waiting time for determining if a caller arrived during main period mp has the possibility to be called back.
 String getName()
          Returns the name of the call type associated with this call factory.
 MultiPeriodGen getPatienceTimeGen()
          Returns the patience time, converted to MultiPeriodGen.
 double getPatienceTimesMult()
          Returns the current multiplier for patience times for calls generated by this factory.
 double getPatienceTimesMultCallBack(int mp)
          Returns the multiplier of patience times for calls arriving during main period mp, joining the virtual queue, successuflly called back, and having to wait in regular queue.
 double getPatienceTimesMultNoVirtualQueue(int mp)
          Returns the multiplier for patience times for callers arrived during main period mp, and deciding not to join the virtual queue.
 ServiceTimesManager getPreServiceTimesNoConfManager()
          Returns an object managing the random variate generators for pre-service times with secondary agents if no conference with primary agents.
 double getProbAbandon(int mp)
          Returns the probability of balking for main period mp.
 double getProbTransfer(int i, int mp)
          Returns the probability of transfer for a call of the associated type arrived during main period mp, and whose service finishes with a primary agent in group i.
 double getProbTransferWait(int i, int mp)
          Returns the probability of a primary agent waiting for transfer to finish, for a call of the associated type arrived during main period mp, and whose service finishes with a primary agent in group i.
 double getProbVirtualQueue(int mp)
          Returns the probability that a caller arriving during main period mp accepts to enter virtual queue, and be called back later.
 double getProbVirtualQueueCallBack(int mp)
          Returns the probability that a caller arriving during main period mp is successfully called back after joining the virtual queue.
 Map<String,Object> getProperties()
          Returns the user-defined properties of the call type associated with this call factory.
 MultiPeriodGen getServiceTimeGen()
          Returns the random variate generator for the default service times used when no agent group specific service times are available.
 MultiPeriodGen[] getServiceTimeGenGroups()
          Similar to SingleTypeContactFactory.getContactTimeGenGroups(), but returns an array of MultiPeriodGen instead.
 ServiceTimesManager getServiceTimesManager()
          Returns an object managing the random variate generators for regular service times.
 double getServiceTimesMultCallBack(int i, int mp)
          Returns the multiplier of service times for callers arrived during main period mp, and served by an agent in group i after being called back.
 double getServiceTimesMultNoVirtualQueue(int i, int mp)
          Returns the multiplier of service times for callers arrived during main period mp, deciding not to join the virtual queue, and served by an agent in group i.
 double getServiceTimesMultTransfer(int i, int mp)
          Returns the multiplier for service times of callers arrived during main period mp, and served by an agent in group i before a transfer to another agent occurs.
 int getTargetVQType()
          Returns the index of the call type calls entering virtual queue are changed to.
 ContactFactory getTransferTargetFactory()
          Returns the contact factory used to generate transferred calls from calls of the associated type.
 ServiceTimesManager getTransferTimesManager()
          Returns an object managing the random variate generators for transfer times.
 double getWeight()
          Returns the default weight used when no per-period weight is available for the call type associated with this call factory.
 double getWeight(int mp)
          Returns the weight of the associated call type during main period mp, or the result of getWeight() if no per-period weight was given.
 void init()
          Initializes this call factory by setting the multipliers for patience and service times.
 void initTransferTargets(CallCenterParams ccParams, int k)
          Constructs a contact factory used to generate calls resulting from transfers after service termination.
 boolean isCallTransferSupported()
          Determines if call transfer is supported by this call factory.
 boolean isDisableCallSource()
          Determines if calls of the associated type can be produced using a call source, e.g., an arrival process or a dialer.
 boolean isExcludedFromStatTotal()
          Determines if calls of the associated type are excluded from the totals in statistical reports.
 boolean isVirtualHoldSupported()
          Determines if virtual holding (or virtual queueing) is supported for the associated call type.
 void multiplyServiceTimesCallBack(Call call)
          Similar to multiplyServiceTimesNoVirtualQueue(Call), but using multipliers returned by getServiceTimesMultCallBack(int,int).
 void multiplyServiceTimesNoVirtualQueue(Call call)
          Applies the multipliers returned by getServiceTimesMultNoVirtualQueue(int,int) to the given call call.
 Contact newInstance()
          Creates a new instance of class Contact, and initializes it by calling the SingleTypeContactFactory.setRandomVariables(Contact) method.
 void setConferenceTimes(Call call)
          Generates conference times for the given call call, and adds these conference times to the regular service times.
 void setDisableCallSource(boolean disableCallSource)
          Sets the indicator for disabled call source to disableCallSource.
 void setExcludedFromStatTotal(boolean excludedFromStatTotal)
          Sets the indicator for exclusion in totals to excludedFromStatTotal.
 void setPatienceTimeGen(RandomVariateGen gen)
          Sets the random variate generator for patience times to pgen.
 void setPatienceTimesMult(double pgenMult)
          Sets the multiplier for patience times to pgenMult.
 void setPreServiceTimesNoConf(Call call)
          Similar to setConferenceTimes(Call), for pre-service times in the case when no conference occurs.
 void setProbTransfer(int i, double[] prob)
           
 void setProbTransferWait(int i, double[] prob)
           
 void setRandomVariables(Contact contact)
          Generates the random variates related to a contact, and assigns the generated value to the given contact object.
 void setTargetVQType(int targetVQType)
          Sets the target call type for virtual queueing to targetVQType.
 
Methods inherited from class umontreal.iro.lecuyer.contactcenters.contact.SingleTypeContactFactory
getAfterContactTimeGen, getAfterContactTimeGen, getAfterContactTimeGenGroups, getContactTimeGen, getContactTimeGen, getContactTimeGenGroups, getMeanAfterContactTime, getMeanContactTime, getProbBalkGenerator, getStreamBalk, getTypeId, setAfterContactTimeGen, setAfterContactTimeGenGroups, setContactTimeGen, setContactTimeGenGroups, setProbBalkGenerator, setSimulator, setStreamBalk, setTypeId, simulator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallFactory

public CallFactory(CallCenter cc,
                   CallCenterParams ccParams,
                   CallTypeParams par,
                   int k)
            throws CallFactoryCreationException
Constructs a new call factory using the call center cc, the call center parameters ccParams, the call-type parameters par, and call type index k.

Parameters:
cc - the call center.
ccParams - the call center parameters.
par - the call-type parameters.
k - the call type index.
Throws:
CallFactoryCreationException - if an exception occurs during the creation of the factory.
Method Detail

initTransferTargets

public void initTransferTargets(CallCenterParams ccParams,
                                int k)
                         throws CallFactoryCreationException
Constructs a contact factory used to generate calls resulting from transfers after service termination. This initialization is not included in the constructor, because all call factories must be created before the contact factory for transfered calls is constructed.

Parameters:
ccParams - the parameters of the call center.
k - the identifier of the call type.
Throws:
CallFactoryCreationException - if an error occurs during the creation of the call factory.

getCallCenter

public CallCenter getCallCenter()
Returns the call center object containing this call factory.

Returns:
the call center object for this factory.

init

public void init()
Initializes this call factory by setting the multipliers for patience and service times.


getPatienceTimesMult

public double getPatienceTimesMult()
Returns the current multiplier for patience times for calls generated by this factory. Patience times are multiplied by this constant and the multiplier returned by CallCenter.getPatienceTimesMult(). The default value of this multiplier is 1.

Returns:
the multiplier for patience times.

setPatienceTimesMult

public void setPatienceTimesMult(double pgenMult)
Sets the multiplier for patience times to pgenMult.

Parameters:
pgenMult - the new multiplier for patience times.
Throws:
IllegalArgumentException - if pgenMult is negative.

getServiceTimesManager

public ServiceTimesManager getServiceTimesManager()
Returns an object managing the random variate generators for regular service times.

Returns:
the service times manager.

getConferenceTimesManager

public ServiceTimesManager getConferenceTimesManager()
Returns an object managing the random variate generators for conference times between primary and secondary agents.

Returns:
the conference times manager.

getPreServiceTimesNoConfManager

public ServiceTimesManager getPreServiceTimesNoConfManager()
Returns an object managing the random variate generators for pre-service times with secondary agents if no conference with primary agents.

Returns:
the pre-service times manager.

getTransferTimesManager

public ServiceTimesManager getTransferTimesManager()
Returns an object managing the random variate generators for transfer times.

Returns:
the transfer times manager.

create

public static CallFactory create(CallCenter cc,
                                 CallCenterParams ccParams,
                                 int k)
                          throws CallFactoryCreationException
Constructs a new call factory using call center cc, call center parameters ccParams, and call type index k. This returns an instance of this class for inbound call types, or an instance of OutboundCallFactory for outbound types. This method calls init() on the constructed factory before returning it.

Parameters:
cc - the call center model.
ccParams - the call center parameters.
k - the index of the call type.
Returns:
the constructed call factory.
Throws:
CallFactoryCreationException - if an exception occurs during the creation of the factory.

getName

public String getName()
Returns the name of the call type associated with this call factory.

Returns:
the name of the call type.

getProperties

public Map<String,Object> getProperties()
Returns the user-defined properties of the call type associated with this call factory.

Returns:
the user-defined properties of the call type.

getWeight

public double getWeight()
Returns the default weight used when no per-period weight is available for the call type associated with this call factory.

Returns:
the weight of the call type.

getWeight

public double getWeight(int mp)
Returns the weight of the associated call type during main period mp, or the result of getWeight() if no per-period weight was given.

Parameters:
mp - the index of the main period.
Returns:
the weight of the call type during the given main period.

getProbAbandon

public double getProbAbandon(int mp)
Returns the probability of balking for main period mp.

Parameters:
mp - the index of the main period.
Returns:
the probability of balking.

getProbTransfer

public double getProbTransfer(int i,
                              int mp)
Returns the probability of transfer for a call of the associated type arrived during main period mp, and whose service finishes with a primary agent in group i.

Parameters:
i - the index of the agent group.
mp - the index of the main period.
Returns:
the probability of transfer.

setProbTransfer

public void setProbTransfer(int i,
                            double[] prob)

getProbTransferWait

public double getProbTransferWait(int i,
                                  int mp)
Returns the probability of a primary agent waiting for transfer to finish, for a call of the associated type arrived during main period mp, and whose service finishes with a primary agent in group i.

Parameters:
i - the index of the agent group.
mp - the index of the main period.
Returns:
the probability of waiting for transfer.

setProbTransferWait

public void setProbTransferWait(int i,
                                double[] prob)

getServiceTimesMultTransfer

public double getServiceTimesMultTransfer(int i,
                                          int mp)
Returns the multiplier for service times of callers arrived during main period mp, and served by an agent in group i before a transfer to another agent occurs.

Parameters:
i - the index of the agent group.
mp - the index of the main period.
Returns:
the service times multiplier.

isCallTransferSupported

public boolean isCallTransferSupported()
Determines if call transfer is supported by this call factory. This returns true if and only if getProbTransfer(int,int) returns a non-zero value for at least one pair (i, p), and getTransferTargetFactory() returns a non-null value.


isVirtualHoldSupported

public boolean isVirtualHoldSupported()
Determines if virtual holding (or virtual queueing) is supported for the associated call type. This returns true if and only if getExpectedWaitingTimeThresh(int) returns a finite value for at least one p, getProbVirtualQueue(int) returns a non-zero value for at least one p, and getTargetVQType() returns a non-negative value.


getTransferTargetFactory

public ContactFactory getTransferTargetFactory()
Returns the contact factory used to generate transferred calls from calls of the associated type.

Returns:
the contact factory for transferred calls.

getPatienceTimesMultNoVirtualQueue

public double getPatienceTimesMultNoVirtualQueue(int mp)
Returns the multiplier for patience times for callers arrived during main period mp, and deciding not to join the virtual queue. The default multiplier is 1.

Parameters:
mp - the main period of arrival.
Returns:
the multiplier of the patience times.

getPatienceTimesMultCallBack

public double getPatienceTimesMultCallBack(int mp)
Returns the multiplier of patience times for calls arriving during main period mp, joining the virtual queue, successuflly called back, and having to wait in regular queue. The default multiplier is 1.

Parameters:
mp - the main period of arrival.
Returns:
the multiplier of the patience times.

getServiceTimesMultNoVirtualQueue

public double getServiceTimesMultNoVirtualQueue(int i,
                                                int mp)
Returns the multiplier of service times for callers arrived during main period mp, deciding not to join the virtual queue, and served by an agent in group i.

Parameters:
i - the index of the agent group.
mp - the index of the main period.
Returns:
the service times multiplier.

getServiceTimesMultCallBack

public double getServiceTimesMultCallBack(int i,
                                          int mp)
Returns the multiplier of service times for callers arrived during main period mp, and served by an agent in group i after being called back.

Parameters:
i - the index of the agent group.
mp - the index of the main period.
Returns:
the service times multiplier.

multiplyServiceTimesNoVirtualQueue

public void multiplyServiceTimesNoVirtualQueue(Call call)
Applies the multipliers returned by getServiceTimesMultNoVirtualQueue(int,int) to the given call call. This changes the service times returned by Contact.getContactTimes() for the given call.

Parameters:
call - the call whose service times are modified.

multiplyServiceTimesCallBack

public void multiplyServiceTimesCallBack(Call call)
Similar to multiplyServiceTimesNoVirtualQueue(Call), but using multipliers returned by getServiceTimesMultCallBack(int,int).

Parameters:
call - the call whose service times are modified.

getTargetVQType

public int getTargetVQType()
Returns the index of the call type calls entering virtual queue are changed to.

Returns:
the target call type for virtual queueing.

setTargetVQType

public void setTargetVQType(int targetVQType)
Sets the target call type for virtual queueing to targetVQType.

Parameters:
targetVQType - the new target type.

getProbVirtualQueue

public double getProbVirtualQueue(int mp)
Returns the probability that a caller arriving during main period mp accepts to enter virtual queue, and be called back later.

Parameters:
mp - the main period of arrival.
Returns:
the probability of entering virtual queue.

getProbVirtualQueueCallBack

public double getProbVirtualQueueCallBack(int mp)
Returns the probability that a caller arriving during main period mp is successfully called back after joining the virtual queue.

Parameters:
mp - the main period of arrival.
Returns:
the probability of successful call back.

getExpectedWaitingTimeThresh

public double getExpectedWaitingTimeThresh(int mp)
Returns the threshold on the expected waiting time for determining if a caller arrived during main period mp has the possibility to be called back.

Parameters:
mp - the main period of arrival.
Returns:
the threshold on the expected waiting time.

getExpectedWaitingTimeMult

public double getExpectedWaitingTimeMult(int mp)
Returns the multiplier for the expected waiting time used to determine the time spent by a caller arriving during main period mp in the virtual queue.

Parameters:
mp - the main period of arrival.
Returns:
the waiting time multiplier.

newInstance

public Contact newInstance()
Description copied from class: SingleTypeContactFactory
Creates a new instance of class Contact, and initializes it by calling the SingleTypeContactFactory.setRandomVariables(Contact) method.

Specified by:
newInstance in interface ContactFactory
Overrides:
newInstance in class SingleTypeContactFactory
Returns:
the new contact object.

setRandomVariables

public void setRandomVariables(Contact contact)
Description copied from class: SingleTypeContactFactory
Generates the random variates related to a contact, and assigns the generated value to the given contact object.

Overrides:
setRandomVariables in class SingleTypeContactFactory
Parameters:
contact - the contact object to set up.

setConferenceTimes

public void setConferenceTimes(Call call)
Generates conference times for the given call call, and adds these conference times to the regular service times.

Parameters:
call - the call being processed.

setPreServiceTimesNoConf

public void setPreServiceTimesNoConf(Call call)
Similar to setConferenceTimes(Call), for pre-service times in the case when no conference occurs.

Parameters:
call - the call being processed.

getPatienceTimeGen

public MultiPeriodGen getPatienceTimeGen()
Returns the patience time, converted to MultiPeriodGen. Note that calling MultiPeriodGen.setMult(double) on the returned instance is not recommended as the multipliers are reset by init(). One should use setPatienceTimesMult(double) or CallCenter.setPatienceTimesMult(double) to alter the multipliers of the patience times.

Overrides:
getPatienceTimeGen in class SingleTypeContactFactory
Returns:
the random variate generator for patience times.

setPatienceTimeGen

public void setPatienceTimeGen(RandomVariateGen gen)
Description copied from class: SingleTypeContactFactory
Sets the random variate generator for patience times to pgen.

Overrides:
setPatienceTimeGen in class SingleTypeContactFactory
Parameters:
gen - the new random variate generator for patience times.

getServiceTimeGen

public MultiPeriodGen getServiceTimeGen()
Returns the random variate generator for the default service times used when no agent group specific service times are available.

Note that it is not recommended to use MultiPeriodGen.setMult(double) on the returned object. One should alter the multipliers provided by getServiceTimesManager() instead.

Returns:
the service time generator.

getServiceTimeGenGroups

public MultiPeriodGen[] getServiceTimeGenGroups()
Similar to SingleTypeContactFactory.getContactTimeGenGroups(), but returns an array of MultiPeriodGen instead. The same note for multipliers as in method getServiceTimeGen() applies here.

Returns:
the array of service times.

isDisableCallSource

public boolean isDisableCallSource()
Determines if calls of the associated type can be produced using a call source, e.g., an arrival process or a dialer. By default, this returns false for regular call types, and true for call types corresponding to transfer or virtual queueing targets.


setDisableCallSource

public void setDisableCallSource(boolean disableCallSource)
Sets the indicator for disabled call source to disableCallSource.

See Also:
isDisableCallSource()

isExcludedFromStatTotal

public boolean isExcludedFromStatTotal()
Determines if calls of the associated type are excluded from the totals in statistical reports. By default, this returns false for regular call types, and true for call types corresponding to transfer or virtual queueing targets.


setExcludedFromStatTotal

public void setExcludedFromStatTotal(boolean excludedFromStatTotal)
Sets the indicator for exclusion in totals to excludedFromStatTotal.

See Also:
isExcludedFromStatTotal()

createRandomTypeContactFactory

public static RandomTypeCallFactory createRandomTypeContactFactory(CallCenter cc,
                                                                   List<ProducedCallTypeParams> types,
                                                                   RandomStream stream,
                                                                   boolean checkAgents)
                                                            throws CallFactoryCreationException
Constructs and returns a contact factory that can produce calls of randomly selected types. This constructs and returns an instance of RandomTypeCallFactory by using the probabilities obtained by parsing the list types. Each element of this list gives a type identifier with associated probability of selection. See RandomTypeCallFactory for more information about how the selection is performed.

Parameters:
cc - the call center model.
types - the list of produced contact types.
stream - the random stream used to select contact type.
checkAgents - determines if the call factory checks that there are agents capable of serving the call before producing a call of a given type.
Returns:
the contact type factory.
Throws:
CallFactoryCreationException - if an error occurs during the creation of the factory.

checkInbound

public static void checkInbound(int numInCallTypes,
                                List<ProducedCallTypeParams> types)
For each element in the list types, tests that the type identifier returned by the ProducedCallTypeParams.getType() method is smaller than the given constant numInCallTypes. This condition is necessary for the indices to represent inbound call types.

Parameters:
numInCallTypes - the number of inbound call types.
types - the list of call type records to test.
Throws:
IllegalArgumentException - if at least one type identifier is invalid.

checkOutbound

public static void checkOutbound(int numInCallTypes,
                                 int numCallTypes,
                                 List<ProducedCallTypeParams> types)
For each element in the list types, tests that the type identifier returned by the ProducedCallTypeParams.getType() method is greater than or equal to numInCallTypes but smaller than numCallTypes. This condition is necessary for the indices to represent inbound call types.

Parameters:
numInCallTypes - the number of inbound call types.
numCallTypes - the number of call types, inbound or outbound.
types - the list of call type records to test.
Throws:
IllegalArgumentException - if numInCallTypes is greater than numCallTypes, or if at least one type identifier is invalid.

ContactCenters
V. 0.9.9.

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