ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.ctmc
Interface CallCenterCTMC

All Superinterfaces:
Cloneable
All Known Subinterfaces:
CallCenterCTMCWithQueues
All Known Implementing Classes:
CallCenterCTMC11, CallCenterCTMC11WithQueues, CallCenterCTMCKI, CallCenterCTMCKIWithQueues

public interface CallCenterCTMC
extends Cloneable

Represents a continuous-time Markov chain (CTMC) modeling a call center with possibly multiple call types and agent groups. More specifically, calls are divided into K types, and are served by agents partitionned into I groups. Each agent group i = 0,…, I - 1 has a skillset Si⊆{1,…, K} giving the types of the calls the agents can serve. Callers arriving when no agent is available join a waiting queue, and can abandon if they do not receive service fast enough.

For each k = 0,…, K - 1, we suppose that calls of type k arrive following a Poisson process with rate λk. Service times for calls of type k served by agents in group i are i.i.d. exponential with rate μk, i. A call of type k not served immediately can balk (abandon immediately) with probability ρk. The patience times of callers of type k joining the queue without balking are i.i.d. exponential with rate νk. Moreover, for each i = 0,…, I - 1, agent group i contains Ni agents.

A router is used to assign agents to new calls, and queued calls to free agents using either static lists, or matrices of priorities. See AgentGroupSelector, and WaitingQueueSelector for more information. If no agent group contains free agents, the call joins a waiting queue specific to its type (and possibly balks). Abandoning calls are lost.

This interface specifies methods to obtain information about the modelled call center as well as methods to initialize the CTMC, and generate the next state randomly from the current state.


Method Summary
 CallCenterCTMC clone()
          Returns an independent copy of this call center CTMC.
 boolean equalsState(Object o)
          Determines if the state of this CTMC is the same as the state of the CTMC o.
 void generateAbandonment(int k, int kpos, int np, int nf)
          Generates the abandonment of the kposth contact of type k.
 void generateArrival(int k, int np, int nf)
          Generates the arrival of a contact of type k being blocked or balking.
 void generateArrivalQueued(int k, int np, int nf)
          Generates the arrival of a contact of type k, and adds the new contact to the waiting queue.
 void generateArrivalServed(int k, int i, int np, int nf)
          Generates the arrival of a contact of type k served by an agent in group i.
 void generateEndService(int k, int i, int np, int nf)
          Generates the end of the service for a contact of type k served by an agent in group i.
 void generateEndService(int k, int i, int kp, int np, int nf)
          Generates the end of the service for a contact of type k served by an agent in group i, and assigns the kposth queued contact of type kp to the free agent.
 void generateFalseTransition(int np, int nf)
          Generates a false transition.
 double getArrivalRate()
          Returns the total arrival rate λ = $ \htsum_{{k=0}}^{{K-1}}$λk for all contact types.
 double getArrivalRate(int k)
          Returns the arrival rate λk for contacts of type k.
 double getJumpRate()
          Returns the uniformized transition rate used by this CTMC.
 int getLastSelectedAgentGroup()
          Returns the last agent group selected by the nextState(double) method.
 int getLastSelectedContact()
          Returns the index of the last selected contact having abandoned.
 int getLastSelectedContactType()
          Returns the last contact type selected by the nextState(double) method.
 int getLastSelectedQueuedContactType()
          Returns the type of the last contact removed from a waiting queue for service by the nextState(double) method.
 TransitionType getLastTransitionType()
          Returns the type of the last transition, or null if no transition occurred since the last call to initEmpty().
 double getMaxArrivalRate()
          Returns the total maximal arrival rate $ \tilde{\lambda}$ = $ \htsum_{{k=0}}^{{K-1}}$$ \tilde{\lambda}_{k}^{}$ for all contact types.
 double getMaxArrivalRate(int k)
          Returns the maximal arrival rate $ \tilde{\lambda}_{k}^{}$ for contacts of type k.
 int getMaxNumAgents()
          Returns the maximal total number of agents that can be used for the CTMC.
 int getMaxNumAgents(int i)
          Returns the maximal number of agents in group i.
 int[] getMaxNumAgentsArray()
          Returns an array of length I containing the maximal number of agents in each agent group.
 double getMaxPatienceRate(int k)
          Returns the maximal patience rate $ \tilde{\nu}_{k}^{}$ for contacts of type k.
 int getMaxQueueCapacity()
          Returns the current bound on the queue capacity used to determine the transition rate of the CTMC.
 double getMaxServiceRate(int k, int i)
          Returns the maximal service rate $ \tilde{\mu}_{{k,i}}^{}$ for contacts of type k served by agents in group i.
 TransitionType getNextTransition(double u)
          Returns the type of the next transition generated using the random number u.
 TransitionType getNextTransitionInt(int u)
          Similar to getNextTransition(double), using a random integer rather than a uniform number.
 int getNumAgentGroups()
          Returns the number of agent groups used in the modelled call center.
 int getNumAgents()
          Returns the total number of agents available for serving contacts.
 int getNumAgents(int i)
          Returns the number of agents in group i.
 int[] getNumAgentsArray()
          Returns an array of length I containing the number of agents in each agent group.
 int getNumContactsInQueue()
          Returns the total number of contacts currently waiting in queue.
 int getNumContactsInQueue(int k)
          Returns the number of contacts of type k currently waiting in queue.
 int getNumContactsInService()
          Returns the total number of contacts currently served by agents.
 int getNumContactsInService(int k, int i)
          Returns the number of contacts of type k in service by agents in group i.
 int getNumContactsInServiceI(int i)
          Returns the number of contacts currently in service by agents in group i.
 int getNumContactsInServiceK(int k)
          Returns the number of contacts of type k currently in service.
 int getNumContactTypes()
          Returns the number of contact types used in the modelled call center.
 int getNumFollowingFalseTransitions()
          Similar to getNumPrecedingFalseTransitions(), but for the number of false transitions generated after the main transition.
 int getNumPrecedingFalseTransitions()
          Returns the number of additionnal false transitions generated by the last call to nextState(double) before the main transition.
 int getNumStateThresh()
          Returns the number of thresholds on the state space.
 int getNumTransitionsDone()
          Returns the number of generated transitions.
 double getPatienceRate(int k)
          Returns the patience rate νk for contacts of type k.
 double getProbBalking(int k)
          Returns the probability of balking ρk for contacts of type k.
 int getQueueCapacity()
          Returns the maximal queue capacity.
 double[][] getRanksGT()
          Returns the group-to-type matrix of ranks associating a priority to each agent group and contact type when selecting a waiting queue for a free agent.
 double[][] getRanksTG()
          Returns the type-to-group matrix of ranks associating a priority to each contact type and agent group when selecting an agent group for a new arrival.
 double getServiceRate(int k, int i)
          Returns the service rate μk, i for contacts of type k served by agents in group i.
 StateThresh getStateThresh()
          Returns the thresholds on the state of the CTMC.
 int[][] getStateThresholds()
          Returns the R×I + 1 matrix of thresholds whose used for state space partitioning.
 int getTargetNumTransitions()
          Returns the current target number of transitions.
 int hashCodeState()
          Computes and returns a hash code using the current state of the CTMC.
 void init(CallCenterCTMC ctmc)
          Initializes the state of this CTMC with the state of the other CTMC ctmc.
 void initEmpty()
          Initializes the system to an empty call center, and resets the counter giving the number of transitions done to 0.
 TransitionType nextState(double u)
          Generates the next state of the CTMC randomly from the current state, using the given uniform u, and changes the current state to this new state.
 TransitionType nextStateInt(int v)
          Similar to nextState(double), except that the given random variate v is uniformly distributed over [0, 231 - 1].
 boolean selectContact(int i)
          Selects a new queued contact for a free agent in group i, and returns a boolean indicator determining if a contact could be selected.
 void setArrivalRate(int k, double rate)
          Sets the arrival rate for contacts of type k to rate.
 void setArrivalRates(double[] rates)
          Sets the arrival rate for each contact type k to rates[k].
 void setMaxArrivalRate(int k, double rate)
          Sets the maximal arrival rate for contacts of type k to rate.
 void setMaxArrivalRates(double[] rates)
          Sets the maximal arrival rate for each contact type k to rates[k].
 void setMaxNumAgents(int[] numAgents)
          For each agent group i = 0,…, I - 1, sets the maximal number of agents in group i to numAgents[i].
 void setMaxNumAgents(int i, int n)
          Sets the maximal number of agents in group i to n.
 void setMaxPatienceRate(int k, double nuk)
          Sets the maximal patience rate $ \tilde{\nu}_{k}^{}$ for contacts of type k to nuk.
 void setMaxQueueCapacity(int q)
          Sets the bound on the queue capacity to q.
 void setMaxServiceRate(int k, int i, double muki)
          Sets the maximal service rate for contacts of type k served by agents in group i to muki.
 void setNumAgents(int[] numAgents)
          For each agent group i = 0,…, I - 1, sets the number of agents in group i to numAgents[i].
 void setNumAgents(int i, int n)
          Sets the number of agents in group i to n.
 void setPatienceRate(int k, double nuk)
          Sets the patience rate νk for contacts of type k to nuk.
 void setProbBalking(int k, double rhok)
          Sets the balking probability to ρk for contacts of type k to rhok.
 void setQueueCapacity(int q)
          Sets the capacity of the waiting queue to q.
 void setServiceRate(int k, int i, double muki)
          Sets the service rate μk, i to for contacts of type k served by agents in group i to muki.
 void setStateThresholds(int[][] thresholds)
          Sets the matrix of thresholds for this CTMC to thresholds.
 void setTargetNumTransitions(int tntr)
          Sets the target number of transitions to tntr.
 

Method Detail

initEmpty

void initEmpty()
Initializes the system to an empty call center, and resets the counter giving the number of transitions done to 0.


init

void init(CallCenterCTMC ctmc)
Initializes the state of this CTMC with the state of the other CTMC ctmc. The parameters of this CTMC, e.g., arrival rates, service rates, etc., are unchanged while the state is set to the state of the given CTMC. This method throws an IllegalArgumentException if the given CTMC is incompatible with this CTMC, e.g., the number of contact types or agent groups differ.

Parameters:
ctmc - the CTMC to initialize the state from.
Throws:
IllegalArgumentException - if the given CTMC is not compatible with this CTMC.

getNumContactTypes

int getNumContactTypes()
Returns the number of contact types used in the modelled call center.

Returns:
the number of contact types.

getNumAgentGroups

int getNumAgentGroups()
Returns the number of agent groups used in the modelled call center.

Returns:
the number of agent groups.

getNumContactsInQueue

int getNumContactsInQueue()
Returns the total number of contacts currently waiting in queue.

Returns:
the total number of queued contacts.

getNumContactsInService

int getNumContactsInService()
Returns the total number of contacts currently served by agents.

Returns:
the total number of contacts in service.

getNumContactsInQueue

int getNumContactsInQueue(int k)
Returns the number of contacts of type k currently waiting in queue.

Parameters:
k - the tested contact type.
Returns:
the number of contacts waiting in queue.
Throws:
IllegalArgumentException - if k is negative or greater than or equal to the result of getNumContactTypes().

getNumContactsInServiceK

int getNumContactsInServiceK(int k)
Returns the number of contacts of type k currently in service.

Parameters:
k - the tested contact type.
Returns:
the number of contacts in service.
Throws:
IllegalArgumentException - if k is negative or greater than or equal to the result of getNumContactTypes().

getNumContactsInServiceI

int getNumContactsInServiceI(int i)
Returns the number of contacts currently in service by agents in group i.

Parameters:
i - the tested agent group.
Returns:
the number of contacts in service.
Throws:
IllegalArgumentException - if i is negative or greater than or equal to the result of getNumAgentGroups().

getNumContactsInService

int getNumContactsInService(int k,
                            int i)
Returns the number of contacts of type k in service by agents in group i.

Parameters:
k - the tested contact type.
i - the tested agent group.
Returns:
the number of contacts in service.

getQueueCapacity

int getQueueCapacity()
Returns the maximal queue capacity.

Returns:
the maximal queue capacity.

setQueueCapacity

void setQueueCapacity(int q)
Sets the capacity of the waiting queue to q.

Parameters:
q - the new queue capacity.
Throws:
IllegalArgumentException - if the new capacity is smaller than the current number of contacts in queue, returned by getNumContactsInQueue(), or larger than the maximum returned by getMaxQueueCapacity().

getMaxQueueCapacity

int getMaxQueueCapacity()
Returns the current bound on the queue capacity used to determine the transition rate of the CTMC.

Returns:
the bound on the queue capacity.

setMaxQueueCapacity

void setMaxQueueCapacity(int q)
Sets the bound on the queue capacity to q. Note that this method can change the transition rate, which usually involves recreating search indexes. Calling this method too often can thus decrease performance; one should use setQueueCapacity(int) instead.

Parameters:
q - the new maximal queue capacity.
Throws:
IllegalArgumentException - if q is smaller than the queue capacity returned by getQueueCapacity().

getNumStateThresh

int getNumStateThresh()
Returns the number of thresholds on the state space. When the queue size or the number of busy agents are small enough, the CTMC simulator can use a smaller transition rate, and generate a random number of successive false transitions before every transition. Since multiple transitions are generated using a single random number, this can save CPU time. This method returns the total number of transition rates the simulator can use depending on the queue size, and number of busy agents. Note that using too many vectors of thresholds can increase memory usage, because a separate search index is required for each vector of threshold.

Returns:
the number of state thresholds.

getStateThresholds

int[][] getStateThresholds()
Returns the R×I + 1 matrix of thresholds whose used for state space partitioning. Each row of the matrix corresponds to a vector of thresholds, column i = 0,…, I - 1 corresponds to thresholds on the number of agents in group i, and the last column corresponds to the queue size.

Returns:
the matrix of thresholds.

setStateThresholds

void setStateThresholds(int[][] thresholds)
Sets the matrix of thresholds for this CTMC to thresholds.

Parameters:
thresholds - the matrix of thresholds.
Throws:
NullPointerException - if thresholds is null.
IllegalArgumentException - if thresholds has invalid dimensions.

getStateThresh

StateThresh getStateThresh()
Returns the thresholds on the state of the CTMC.

Returns:
the state thresholds.

getArrivalRate

double getArrivalRate(int k)
Returns the arrival rate λk for contacts of type k.

Parameters:
k - the tested contact type.
Returns:
the arrival rate.
Throws:
IllegalArgumentException - if k is negative or greater than or equal to the result of getNumContactTypes().

setArrivalRate

void setArrivalRate(int k,
                    double rate)
Sets the arrival rate for contacts of type k to rate.

Parameters:
k - the contact type.
rate - the arrival rate.
Throws:
IllegalArgumentException - if rate is negative, or greater than the bound returned by getMaxArrivalRate(int).

setArrivalRates

void setArrivalRates(double[] rates)
Sets the arrival rate for each contact type k to rates[k].

Parameters:
rates - the arrival rates.
Throws:
IllegalArgumentException - if rates does not have length K, contains at least one negative element, or if rates[k] is greater than the result of getMaxArrivalRate (k) for at least one k.

getArrivalRate

double getArrivalRate()
Returns the total arrival rate λ = $ \htsum_{{k=0}}^{{K-1}}$λk for all contact types.

Returns:
the total arrival rate.

getMaxArrivalRate

double getMaxArrivalRate(int k)
Returns the maximal arrival rate $ \tilde{\lambda}_{k}^{}$ for contacts of type k.

Parameters:
k - the tested contact type.
Returns:
the maximal arrival rate.
Throws:
IllegalArgumentException - if k is negative or greater than or equal to the result of getNumContactTypes().

setMaxArrivalRate

void setMaxArrivalRate(int k,
                       double rate)
Sets the maximal arrival rate for contacts of type k to rate. This can change the transition rate, and force the simulator to recompute some search indexes. Using this method often can therefore degrade performance, so it is recommended to call double) instead.

Parameters:
k - the contact type.
rate - the arrival rate.
Throws:
IllegalArgumentException - if rate is smaller than the rate returned by getArrivalRate(int).

setMaxArrivalRates

void setMaxArrivalRates(double[] rates)
Sets the maximal arrival rate for each contact type k to rates[k].

Parameters:
rates - the arrival rates.
Throws:
IllegalArgumentException - if rates does not have length K, orif rates[k] is smaller than the result of getArrivalRate (k) for at least one k.

getMaxArrivalRate

double getMaxArrivalRate()
Returns the total maximal arrival rate $ \tilde{\lambda}$ = $ \htsum_{{k=0}}^{{K-1}}$$ \tilde{\lambda}_{k}^{}$ for all contact types.

Returns:
the total maximal arrival rate.

getProbBalking

double getProbBalking(int k)
Returns the probability of balking ρk for contacts of type k.

Parameters:
k - the tested contact type.
Returns:
the probability of balking.
Throws:
IllegalArgumentException - if k is negative or greater than or equal to the result of getNumContactTypes().

setProbBalking

void setProbBalking(int k,
                    double rhok)
Sets the balking probability to ρk for contacts of type k to rhok.

Parameters:
k - the affected contact type.
rhok - the new value of ρk.
Throws:
IllegalArgumentException - if rhok is negative or greater than 1.

getPatienceRate

double getPatienceRate(int k)
Returns the patience rate νk for contacts of type k.

Parameters:
k - the tested contact type.
Returns:
the patience rate.
Throws:
IllegalArgumentException - if k is negative or greater than or equal to the result of getNumContactTypes().

setPatienceRate

void setPatienceRate(int k,
                     double nuk)
Sets the patience rate νk for contacts of type k to nuk.

Parameters:
k - the affected contact type.
nuk - the new value of νk.
Throws:
IllegalArgumentException - if k is out of range, nuk is negative, or nuk is greater than the maximum returned by getMaxPatienceRate(int).

getMaxPatienceRate

double getMaxPatienceRate(int k)
Returns the maximal patience rate $ \tilde{\nu}_{k}^{}$ for contacts of type k.

Parameters:
k - the tested contact type.
Returns:
the maximal patience rate.
Throws:
IllegalArgumentException - if k is negative or greater than or equal to the result of getNumContactTypes().

setMaxPatienceRate

void setMaxPatienceRate(int k,
                        double nuk)
Sets the maximal patience rate $ \tilde{\nu}_{k}^{}$ for contacts of type k to nuk. This method can change the transition rate and recompute search indexes so using it repeatedly might degrade performance. It is recommended to use setPatienceRate(int,double) instead.

Parameters:
k - the affected contact type.
nuk - the new patience rate.
Throws:
IllegalArgumentException - if nuk is smaller than the result of getPatienceRate(int), or if k is out of range.

getServiceRate

double getServiceRate(int k,
                      int i)
Returns the service rate μk, i for contacts of type k served by agents in group i.

Parameters:
k - the tested contact type.
i - the tested agent group.
Returns:
the service rate.
Throws:
IllegalArgumentException - if k or i are out of range.

setServiceRate

void setServiceRate(int k,
                    int i,
                    double muki)
Sets the service rate μk, i to for contacts of type k served by agents in group i to muki.

Parameters:
k - the affected contact type.
i - the affected agent group.
muki - the new service rate.
Throws:
IllegalArgumentException - if k or i are out of range, if muki is negative, or if muki is greater than the maximum returned by getMaxServiceRate(int,int).

getMaxServiceRate

double getMaxServiceRate(int k,
                         int i)
Returns the maximal service rate $ \tilde{\mu}_{{k,i}}^{}$ for contacts of type k served by agents in group i.

Parameters:
k - the tested contact type.
i - the tested agent group.
Returns:
the service rate.
Throws:
IllegalArgumentException - if k or i are out of range.

setMaxServiceRate

void setMaxServiceRate(int k,
                       int i,
                       double muki)
Sets the maximal service rate for contacts of type k served by agents in group i to muki. This method can change the transition and recompute search indexes, so using it repeatedly might degrade performance. It is recommended to use setServiceRate(int,int,double) instead.

Parameters:
k - the affected contact type.
i - the affected agent group.
muki - the new maximal service rate.
Throws:
IllegalArgumentException - if k or i are out of range, or if muki is smaller than the service rate returned by getServiceRate(int,int).

getJumpRate

double getJumpRate()
Returns the uniformized transition rate used by this CTMC.

Returns:
the uniformized transition rate.

getNumAgents

int getNumAgents()
Returns the total number of agents available for serving contacts.

Returns:
the total number of agents.

getMaxNumAgents

int getMaxNumAgents()
Returns the maximal total number of agents that can be used for the CTMC.

Returns:
the maximal number of agents.

getNumAgents

int getNumAgents(int i)
Returns the number of agents in group i.

Parameters:
i - the tested agent group.
Returns:
the number of agents.
Throws:
IllegalArgumentException - if i is negative or greater than or equal to the result of getNumAgentGroups().

getNumAgentsArray

int[] getNumAgentsArray()
Returns an array of length I containing the number of agents in each agent group.

Returns:
the number of agents in each group.

getMaxNumAgents

int getMaxNumAgents(int i)
Returns the maximal number of agents in group i.

Parameters:
i - the tested agent group.
Returns:
the maximal number of agents.

getMaxNumAgentsArray

int[] getMaxNumAgentsArray()
Returns an array of length I containing the maximal number of agents in each agent group.

Returns:
the maximal number of agents in each group.

setNumAgents

void setNumAgents(int i,
                  int n)
Sets the number of agents in group i to n. This method might cause the transition rate to increase so it should never be called during the simulation of the CTMC.

Parameters:
i - the tested agent group.
n - the new number of agents in the group.
Throws:
IllegalArgumentException - if i is negative or greater than or equal to the result of getNumAgentGroups(), or if n is negative.

setNumAgents

void setNumAgents(int[] numAgents)
For each agent group i = 0,…, I - 1, sets the number of agents in group i to numAgents[i].

Parameters:
numAgents - the array containing the number of agents.
Throws:
IllegalArgumentException - if numAgents has a length different from I, or if it contains at least one negative value.

setMaxNumAgents

void setMaxNumAgents(int i,
                     int n)
Sets the maximal number of agents in group i to n. This method might cause the maximal transition rate returned by getJumpRate() to increase so it should never be called during the simulation of the CTMC.

Parameters:
i - the tested agent group.
n - the new maximal number of agents in the group.
Throws:
IllegalArgumentException - if i is negative or greater than or equal to the result of getNumAgentGroups(), or if n is negative.

setMaxNumAgents

void setMaxNumAgents(int[] numAgents)
For each agent group i = 0,…, I - 1, sets the maximal number of agents in group i to numAgents[i].

Parameters:
numAgents - the array containing the number of agents.
Throws:
IllegalArgumentException - if numAgents has a length different from I, or if it contains at least one negative value.

getRanksTG

double[][] getRanksTG()
Returns the type-to-group matrix of ranks associating a priority to each contact type and agent group when selecting an agent group for a new arrival.

Returns:
the matrix of ranks being used.

getRanksGT

double[][] getRanksGT()
Returns the group-to-type matrix of ranks associating a priority to each agent group and contact type when selecting a waiting queue for a free agent.

Returns:
the matrix of ranks being used.

getLastTransitionType

TransitionType getLastTransitionType()
Returns the type of the last transition, or null if no transition occurred since the last call to initEmpty().

Returns:
the type of the last transition.

getLastSelectedContactType

int getLastSelectedContactType()
Returns the last contact type selected by the nextState(double) method.

Returns:
the last selected contact type.

getLastSelectedContact

int getLastSelectedContact()
Returns the index of the last selected contact having abandoned. This returns the position of the contact having abandoned within a queue containing contacts of type k only. The returned value is thus in 0,…, Qk - 1 where k is the result of getLastSelectedContactType(), and Qk is the number of contacts of type k in queue.

Returns:
the last selected contact.

getLastSelectedAgentGroup

int getLastSelectedAgentGroup()
Returns the last agent group selected by the nextState(double) method.

Returns:
the last selected agent group.

getLastSelectedQueuedContactType

int getLastSelectedQueuedContactType()
Returns the type of the last contact removed from a waiting queue for service by the nextState(double) method.

Returns:
the last selected queued contact type.

nextState

TransitionType nextState(double u)
Generates the next state of the CTMC randomly from the current state, using the given uniform u, and changes the current state to this new state. The method then returns the type of transition being generated. Depending on the transition type, additional information about the selected contact type or agent group can be obtained using getLastSelectedContactType(), getLastSelectedQueuedContactType(), or getLastSelectedAgentGroup().

Parameters:
u - the uniform used to generate the new state.
Returns:
the type of the generated transition.

nextStateInt

TransitionType nextStateInt(int v)
Similar to nextState(double), except that the given random variate v is uniformly distributed over [0, 231 - 1].

Parameters:
v - the uniform random integer.
Returns:
the type of the generated transition.

getNextTransition

TransitionType getNextTransition(double u)
Returns the type of the next transition generated using the random number u. This method is similar to nextState(double), except that it does not alter the state of the CTMC.

Parameters:
u - the random number for the state generation.
Returns:
the type of the next transition.

getNextTransitionInt

TransitionType getNextTransitionInt(int u)
Similar to getNextTransition(double), using a random integer rather than a uniform number.

Parameters:
u - the random number used for generating the transition.
Returns:
the type of the next transition.

generateArrivalServed

void generateArrivalServed(int k,
                           int i,
                           int np,
                           int nf)
Generates the arrival of a contact of type k served by an agent in group i. If all agents are busy in group i, this method throws an IllegalStateException.

Parameters:
k - the contact type.
i - the agent group.
np - the number of false transitions preceding the main transition.
nf - the number of false transitions following the main transition.
Throws:
IllegalStateException - if all agents in group i are busy.

generateArrivalQueued

void generateArrivalQueued(int k,
                           int np,
                           int nf)
Generates the arrival of a contact of type k, and adds the new contact to the waiting queue. This method throws an IllegalStateException if the queue is full before the arrival.

Parameters:
k - the type of the new contact.
np - the number of false transitions preceding the main transition.
nf - the number of false transitions following the main transition.
Throws:
IllegalStateException - if the queue capacity is exceeded.

generateArrival

void generateArrival(int k,
                     int np,
                     int nf)
Generates the arrival of a contact of type k being blocked or balking.

Parameters:
k - the type of the arrival.
np - the number of false transitions preceding the main transition.
nf - the number of false transitions following the main transition.

generateEndService

void generateEndService(int k,
                        int i,
                        int np,
                        int nf)
Generates the end of the service for a contact of type k served by an agent in group i. If no contact of type k are in service by agents in group i, this method throws an IllegalStateException.

Parameters:
k - the type of the contact.
i - the group of the agent.
np - the number of false transitions preceding the main transition.
nf - the number of false transitions following the main transition.
Throws:
IllegalStateException - if no contact of type k is in service by agents in group i.

generateEndService

void generateEndService(int k,
                        int i,
                        int kp,
                        int np,
                        int nf)
Generates the end of the service for a contact of type k served by an agent in group i, and assigns the kposth queued contact of type kp to the free agent. If no contact of type k are in service by agents in group i, this method throws an IllegalStateException.

Parameters:
k - the type of the contact ending service.
i - the group of the agent ending service.
kp - the type of the dequeued contact.
np - the number of false transitions preceding the main transition.
nf - the number of false transitions following the main transition.

generateAbandonment

void generateAbandonment(int k,
                         int kpos,
                         int np,
                         int nf)
Generates the abandonment of the kposth contact of type k. This method throws an IllegalStateException if kpos is negative or greater than or equal to the number of queued contacts of type k.

Parameters:
k - the contact type.
kpos - the position of the contact in queue.
np - the number of false transitions preceding the main transition.
nf - the number of false transitions following the main transition.

selectContact

boolean selectContact(int i)
Selects a new queued contact for a free agent in group i, and returns a boolean indicator determining if a contact could be selected. After this method returns true, the method getLastSelectedAgentGroup() returns the value of i while getLastSelectedQueuedContactType() returns the type of the contact assigned to the free agent. This method can be used, e.g., when agents are added in some groups during a simulation.

Parameters:
i - the agent group index.
Returns:
determines whether a contact is removed from a queue.

generateFalseTransition

void generateFalseTransition(int np,
                             int nf)
Generates a false transition. This method only updates the transition counter of the CTMC.

Parameters:
np - the number of false transitions preceding the main transition.
nf - the number of false transitions following the main transition.

getNumPrecedingFalseTransitions

int getNumPrecedingFalseTransitions()
Returns the number of additionnal false transitions generated by the last call to nextState(double) before the main transition. Some implementation of this interface might generate several false transitions using a single random number. In this case, the call to nextState(double) will return a transition type while this method should be used to obtain the number of additional false transitions that were generated before the main transition.

Returns:
the number of additional false transitions generated by the last call to nextState(double) before the main transition.

getNumFollowingFalseTransitions

int getNumFollowingFalseTransitions()
Similar to getNumPrecedingFalseTransitions(), but for the number of false transitions generated after the main transition.

Returns:
the number of additional false transitions generated by the last call to nextState(double) after the main transition.

getNumTransitionsDone

int getNumTransitionsDone()
Returns the number of generated transitions. This corresponds to the number of times the nextState(double) method was called since the last call to initEmpty().

Returns:
the number of transitions done.

clone

CallCenterCTMC clone()
Returns an independent copy of this call center CTMC. In particular, calling nextState(double) on the returned CTMC should not affect the state of any other CTMC.

Returns:
the clone of the chain.

hashCodeState

int hashCodeState()
Computes and returns a hash code using the current state of the CTMC. The returned hash code should be $ \htsum_{{i=1}}^{I}$Ki$ \htsum_{{k=1}}^{K}$Sk, i + KI+1$ \htsum_{{k=1}}^{K}$Qk + KI+2n where Ki = $ \htprod_{{j=1}}^{{i-1}}$$ \tilde{N}_{j}^{}$ for i = 1,…, I + 1, and KI+1 = KI+1H.

Returns:
the computed hash code.

equalsState

boolean equalsState(Object o)
Determines if the state of this CTMC is the same as the state of the CTMC o. If o does not correspond to an instance of CallCenterCTMC, this method should return false.

Parameters:
o - the object to test.
Returns:
the result of the equality test.

getTargetNumTransitions

int getTargetNumTransitions()
Returns the current target number of transitions. Sometimes, nextState(double) or nextStateInt(int) generate several false transitions with a single random number. When the number of transitions done is near the target number of transitions, the final number of transitions may then exceed the target.

When a target number of transition is specified, no more state change occur after the target is reach. Moreover, when the return value of getNumTransitionsDone() is greater than or equal to the value returned by this method, nextState(double), and nextStateInt(int) throw an IllegalStateException.

The default target number of transitions is Integer.MAX_VALUE.

Returns:
the current target number of transitions.

setTargetNumTransitions

void setTargetNumTransitions(int tntr)
Sets the target number of transitions to tntr.

Parameters:
tntr - the new target number of transitions.
Throws:
IllegalArgumentException - if tntr is negative.

ContactCenters
V. 0.9.9.

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