CCmath was kind enough to send me the Python version of Erlang calculators. So I'll aim to share my experience with it in this article. But first, some background on queueing models is provided:
Erlang C is one of the two [Erlang B, Erlang C] calls-traffic modeling formulae developed by Danish mathematician A.K. Erlang in 1917. Unlike Erlang B, Erlang C Erlang C formula provides the possibility of an unlimited queue and the probability that a new call will need to wait in the line due to all servers being in use. Erlang is, therefore, the SI unit of telephone traffic. It defines the relationship between the call volume, average handling time, service level, average wait time, and the number of agents.
Erlang X is an extension of Erlang C, which adds the number of available lines, the average customers’ patience, the probability of retrial after abandoning the call, and the variance in arrival volume.
Erlang Chat simulates chat traffic. The matter of Concurrency is a significant difference between Chat and Phone channels; agents can handle multiple chats at the same time. Many major chat service software solutions allow for more than one conversation concurrently, which is impossible with phone calls. An alternative method for simulating chat traffic is to use Erlang C or X and assume a lesser volume (i.e., lower by a factor of the average concurrency)
Erlang Blend models the scenarios where agents work on inbound and outbound calls. If an agent becomes available, they will prioritize inbound calls and will only take on outbound calls when other agents are left idle. It, therefore, assumes one additional parameter: Threshold. The threshold is the minimum number of agents left idle before the first person is allowed to take outbound work.
Parameters Here is the summary of parameters across the models.
Data and calculations
I produced a random 1-day long hourly arrival volume of phone contacts for testing purposes. The demo file includes examples for single data points, but I realize that most people will have much longer per-interval data points to evaluate the functions. As a result, these examples should be more helpful.
There is a common bad practice among the WFM community of calculating the Weekly customer's monthly FTEs from a single data point. It is significantly less work but only as accurate as a simple average can get. In other words, you will be understaffed for half of the time and overstaffed for the other half. A better practice would be to define the arrival pattern from the historical data and convert weekly/monthly volume to smaller intervals.
Let's import the necessary libraries.
It is important to note that the forecast volume represents the average volume in a unit of time. If your AHT, AWT, and ASA values are in seconds, your forecast volume should be the expected average within 1 second. If those numbers are in minute, likewise.
1. Erlang C
Erlang X functions with the default value of Null for Lines, Patience, Variance, and Retrial variables are defined the same way as their C equivalents.
The following three functions manifest different input and output combinations.
Calling The Functions
Since our test data df has SL, Forecast, AHT, and AWT, we will need calc_option1_C to calculate Agents, ASA, and Occupancy.
Now that we have ‘Agents’ in ‘df1’ dataframe, we can use calc_option0_C to find ASA, SL, and Occupancy values and compare them to what was initially assumed.
The calculated values are almost the same to those initially assumed as we would wish. So let's use calc_option2_C and compare the outputs to the output/input of the others.
Very similar once again!
2. Erlang X
Erlang X calculator adds assumptions such as Lines, Patience, Retrials, and Definition to the basic Erlang C calculator.
The line Parameter defines the limit on the total number of customers that can be in the system at the same time. This, of course, depends on the capacity of the telephony provider. A good practice is putting a significantly higher number of lines than top interval arrival.
Patience is the average time a customer waits in the queue before abandoning. It can be calculated by dividing the total waiting time (including the waiting times of the abandoned customers) by the number of abandoned contacts.
Like in the case of Erlang C, we have three use cases depending on the input parameters and the desired output.
To see some example function calls. We will first fill in the missing parameters.
Let's s.ee how it compares against the output for Erlang C.
Similarly, we can call the other functions.
3. Erlang Chat
Modeling chat contacts with a maximum concurrency of 1 is the same problem as Modeling phone contacts. In such cases, we can use either Erlang C or Erlang C X model. However, when agents are expected to handle multiple chats simultaneously, Erlang Chat is the only correct model.
Erlang Chat from CCmath specifies the maximum concurrency by the length of the AHT parameter, which needs to be an array. The nth element in the AHT array represents the expected AHT if n number of chats are handled simultaneously. The magnitude, therefore, increases as the index increases.
Here is an example code from the 'Erlang_Pythn_demo.py' file.
Like we did above, we can also group functions with similar inputs into a nesting function so that we can calculate multiple parameters at once. Here is my effort:
It is important to note that the point values of the AHT parameter are arrays of the size equal to the maximum concurrency.
4. Erlang Blended (BL)
Erlang BL models scenarios in which agents handle inbound and outgoing phone calls. Before the first agent is allocated to the outbound task, the minimum number of idle agents must be defined. This new variable is known as 'Threshold.' I believe the same idea can easily be applied to chat contacts.
The only problem is that there are no functions relating Agents as an output to the other parameter. This is somewhat unexpected since most people need Erlang Calculators to determine FTE's requirements. It could also be helpful to create more functions that take the inbound volume and outbound volume as input parameters.
It is possible to group the functions into groups of three or four with similar inputs as we did above.
A. Threshold as a target
A. SLA as a target
It's great to have an Erlang calculator for Python, finally. I believe CCmath also offers an R version. So far, my experience has been positive. I hope they read this blog and add/fix the components stated. I've found it somewhat slow on larger datasets (for example, one month's hourly volume), but I presume this is because the calculators are currently housed remotely.'
Thank you to CCmath and Dr. Ger Koole for letting me test it and provide feedback. I hope everyone who reads this also finds it insightful. I was able to arrange access to this Python version of Erlang calculators by being part of the weWFM Telegram community, which is free to join for all Workforce Management professionals. You can find out more about this group here, including how to join.
I am crazy about applying data science skills to workforce management. Reach me at LinkedIn if you wish to connect :)