ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.queuemodel
Class ErlangC

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.queuemodel.ErlangC

public class ErlangC
extends Object

The Erlang C formula is used to compute the delay probability Pr{W > 0} and also the service level, defined as Pr{Wawt}, where W is the waiting time and awt the acceptable waiting time. This formula assumes a M/M/c queueing model such that the arrival and service rates are exponential. The M/M/c assumes one call type and one agent group. This queueing model can be analyzed as a stochastic process X(t)∈{0,..., c + q} representing the number of calls in the system at time t and where c + q is maximum number of calls in the system. The number of servers is c and the capacity of the queue is q. Calls are blocked when the system is at full, X(t) = c + q. It assumes no abandonment due to the impatience of the client.

The rates at each state are :

λk = λ, k = 1, 2,..., c + q - 1
μk = {$\displaystyle \begin{array}{ll}
k \mu, \\
c \mu,
\end{array}$. $\displaystyle \begin{array}{l}
k = 1, 2, \dots, c-1 \\
k = c, c+1, \dots, c+q .
\end{array}$


Constructor Summary
ErlangC(double arrivalRate, double serviceRate)
          Creates a new instance of ErlangC assuming an infinite queue capacity.
ErlangC(double arrivalRate, double serviceRate, int capacity)
          Creates a new instance of ErlangC.
 
Method Summary
static double getAverageExcessTime(double arrivalRate, double serviceRate, int server, double awt)
          Returns the average excess time : $ \mathbb {E}$[(W - awt)+].
static double getAverageExcessTime(double arrivalRate, double serviceRate, int capacity, int server, double awt)
          Returns the average excess time : $ \mathbb {E}$[(W - awt)+].
 double getAverageExcessTime(int server, double awt)
          Returns the average excess time : $ \mathbb {E}$[(W - awt)+].
static double getAverageWaitTime(double arrivalRate, double serviceRate, int server)
          Returns the average wait time : $ \mathbb {E}$[W].
static double getAverageWaitTime(double arrivalRate, double serviceRate, int capacity, int server)
          Returns the average wait time : $ \mathbb {E}$[W].
 double getAverageWaitTime(int server)
          Returns the average wait time : $ \mathbb {E}$[W].
static double getProbDelay(double arrivalRate, double serviceRate, int server)
          Returns the delay probability : Pr{W > 0}, such that the call will wait.
static double getProbDelay(double arrivalRate, double serviceRate, int capacity, int server)
          Returns the delay probability : Pr{W > 0}, such that the call will wait.
 double getProbDelay(int server)
          Returns the delay probability : Pr{W > 0}, such that the call will wait.
static double getServiceLevel(double arrivalRate, double serviceRate, int server, double awt)
          Returns the service level which is the proportion of calls that have waited less or equal to awt, Pr{Wawt}.
static double getServiceLevel(double arrivalRate, double serviceRate, int capacity, int server, double awt)
          Returns the service level which is the proportion of calls that have waited less or equal to awt, Pr{Wawt}.
 double getServiceLevel(int server, double awt)
          Returns the service level which is the proportion of calls that have waited less or equal to awt, Pr{Wawt}.
static double[][] getStateProbDist(double arrivalRate, double serviceRate, int capacity, int server)
          Returns the mass probability distribution of the states (number of calls) in the queueing system.
static void main(String[] args)
          Returns the service level and the delay probability of given parameters.
 int minServer(double awt, double sl)
          Returns the minimum number c of servers needed to have a service level of at least sl, that is : $ \htmin_{{c \ge 0}}^{}${c : Pr{Wawt}≥sl}.
static int minServer(double arrivalRate, double serviceRate, double awt, double sl)
          Returns the minimum number c of servers needed to have a service level of at least sl, that is : $ \htmin_{{c \ge 0}}^{}${c : Pr{Wawt}≥sl}.
static int minServer(double arrivalRate, double serviceRate, int capacity, double awt, double sl)
          Returns the minimum number c of servers needed to have a service level of at least sl, that is : $ \htmin_{{c \ge 0}}^{}${c : Pr{Wawt}≥sl}.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErlangC

public ErlangC(double arrivalRate,
               double serviceRate,
               int capacity)
Creates a new instance of ErlangC. Set the capacity to Integer.MAX_VALUE for infinite queue capacity.

Parameters:
arrivalRate - the arrival rate.
serviceRate - the service rate.
capacity - the capacity of the queue.

ErlangC

public ErlangC(double arrivalRate,
               double serviceRate)
Creates a new instance of ErlangC assuming an infinite queue capacity.

Parameters:
arrivalRate - the arrival rate.
serviceRate - the service rate.
Method Detail

getProbDelay

public double getProbDelay(int server)
Returns the delay probability : Pr{W > 0}, such that the call will wait.

Parameters:
server - the number of servers.
Returns:
the delay probability.

getProbDelay

public static double getProbDelay(double arrivalRate,
                                  double serviceRate,
                                  int server)
Returns the delay probability : Pr{W > 0}, such that the call will wait. Assumes an infinite queue.

Parameters:
arrivalRate - the arrival rate.
serviceRate - the service rate.
server - the number of servers.
Returns:
the delay probability.

getProbDelay

public static double getProbDelay(double arrivalRate,
                                  double serviceRate,
                                  int capacity,
                                  int server)
Returns the delay probability : Pr{W > 0}, such that the call will wait.

Parameters:
arrivalRate - the arrival rate.
serviceRate - the service rate.
capacity - the capacity of the queue, sets to Integer.MAX_VALUE for infinite queue capacity.
server - the number of servers.
Returns:
the delay probability.

getStateProbDist

public static double[][] getStateProbDist(double arrivalRate,
                                          double serviceRate,
                                          int capacity,
                                          int server)
Returns the mass probability distribution of the states (number of calls) in the queueing system. First element is the state, the second element is the mass probability.

Parameters:
arrivalRate - the arrival rate.
serviceRate - the service rate.
capacity - the capacity of the queue, it must be finite and greater or equal to 0.
server - the number of servers.
Returns:
the mass probability distribution or null if it cannot be computed. The first element is the state, the second element is the mass probability. The size of the vector is : number of server + capacity + 1 (for the empty state).

getServiceLevel

public double getServiceLevel(int server,
                              double awt)
Returns the service level which is the proportion of calls that have waited less or equal to awt, Pr{Wawt}. awt must be given in the same unit as the arrival and service rates.

Parameters:
server - the number of servers.
awt - the acceptable waiting time.
Returns:
the service level.

getServiceLevel

public static double getServiceLevel(double arrivalRate,
                                     double serviceRate,
                                     int server,
                                     double awt)
Returns the service level which is the proportion of calls that have waited less or equal to awt, Pr{Wawt}. awt must be given in the same unit as the arrival and service rates. This method assumes a queue with an infinite capacity.

Parameters:
arrivalRate - the arrival rate.
serviceRate - the service rate.
server - the number of servers.
awt - the acceptable waiting time.
Returns:
the service level.

getServiceLevel

public static double getServiceLevel(double arrivalRate,
                                     double serviceRate,
                                     int capacity,
                                     int server,
                                     double awt)
Returns the service level which is the proportion of calls that have waited less or equal to awt, Pr{Wawt}. awt must be given in the same unit as the arrival and service rates. Give a capacity of Integer.MAX_VALUE for a queue with an infinite capacity.

Parameters:
arrivalRate - the arrival rate.
serviceRate - the service rate.
capacity - the capacity of the waiting queue.
server - the number of servers.
awt - the acceptable waiting time.
Returns:
the service level.

minServer

public int minServer(double awt,
                     double sl)
Returns the minimum number c of servers needed to have a service level of at least sl, that is : $ \htmin_{{c \ge 0}}^{}${c : Pr{Wawt}≥sl}. This function uses a binary search.

Parameters:
awt - the acceptable waiting time.
sl - the target service level, it must be in the interval [0, 1].
Returns:
the minimum number of servers needed to satisfy a service level of sl.

minServer

public static int minServer(double arrivalRate,
                            double serviceRate,
                            double awt,
                            double sl)
Returns the minimum number c of servers needed to have a service level of at least sl, that is : $ \htmin_{{c \ge 0}}^{}${c : Pr{Wawt}≥sl}. The capacity of the queue is assumed infinite. This function uses a binary search.

Parameters:
arrivalRate - the exponential arrival rate.
serviceRate - the exponential service rate.
awt - the acceptable waiting time.
sl - the target service level, it must be in the interval [0, 1].
Returns:
the minimum number of servers needed to satisfy a service level of sl.

minServer

public static int minServer(double arrivalRate,
                            double serviceRate,
                            int capacity,
                            double awt,
                            double sl)
Returns the minimum number c of servers needed to have a service level of at least sl, that is : $ \htmin_{{c \ge 0}}^{}${c : Pr{Wawt}≥sl}. If the capacity is Integer.MAX_VALUE, the capacity of the queue is assumed infinite. This function uses a binary search.

Parameters:
arrivalRate - the exponential arrival rate.
serviceRate - the exponential service rate.
capacity - the capacity of the queue.
awt - the acceptable waiting time.
sl - the target service level, it must be in the interval [0, 1].
Returns:
the minimum number of servers needed to satisfy a service level of sl.

getAverageWaitTime

public double getAverageWaitTime(int server)
Returns the average wait time : $ \mathbb {E}$[W].

Parameters:
server - the number of servers.
Returns:
the average wait time.

getAverageWaitTime

public static double getAverageWaitTime(double arrivalRate,
                                        double serviceRate,
                                        int server)
Returns the average wait time : $ \mathbb {E}$[W]. It assumes an infinite queue capacity.

Parameters:
arrivalRate - the arrival rate.
serviceRate - the service rate.
server - the number of servers.
Returns:
the average wait time.

getAverageWaitTime

public static double getAverageWaitTime(double arrivalRate,
                                        double serviceRate,
                                        int capacity,
                                        int server)
Returns the average wait time : $ \mathbb {E}$[W].

Parameters:
arrivalRate - the arrival rate.
serviceRate - the service rate.
capacity - the capacity of the queue.
server - the number of servers.
Returns:
the average wait time.

getAverageExcessTime

public double getAverageExcessTime(int server,
                                   double awt)
Returns the average excess time : $ \mathbb {E}$[(W - awt)+]. It corresponds to the average of waiting time exceeding awt.

Parameters:
server - the number of servers.
awt - the acceptable waiting time.
Returns:
the average excess time.

getAverageExcessTime

public static double getAverageExcessTime(double arrivalRate,
                                          double serviceRate,
                                          int server,
                                          double awt)
Returns the average excess time : $ \mathbb {E}$[(W - awt)+]. It corresponds to the average of waiting time exceeding awt. It assumes an infinite queue capacity.

Parameters:
arrivalRate - the arrival rate.
serviceRate - the service rate.
server - the number of servers.
awt - the acceptable waiting time.
Returns:
the average excess time.

getAverageExcessTime

public static double getAverageExcessTime(double arrivalRate,
                                          double serviceRate,
                                          int capacity,
                                          int server,
                                          double awt)
Returns the average excess time : $ \mathbb {E}$[(W - awt)+]. It corresponds to the average of waiting time exceeding awt.

Parameters:
arrivalRate - the arrival rate.
serviceRate - the service rate.
capacity - the capacity of the queue.
server - the number of servers.
awt - the acceptable waiting time.
Returns:
the average excess time.

main

public static void main(String[] args)
                 throws Exception
Returns the service level and the delay probability of given parameters. Arguments to give : <arrival rate> <service rate> <number of servers> <awt> [<capacity>]. If the capacity is omitted, the queue is assumed to have an infinite capacity.

Throws:
Exception

ContactCenters
V. 0.9.9.

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