# Solving Queue Problems with ErlangC

As an example, we will find the number of agents needed in a call center to handle incoming traffic of calls. Make sure to read the previous article to understand the concepts behind this formulation.

Under the given convention, the resources would be the agent’s stations, and the transactions would be the calls under this scenario.

Let’s assume that in a time interval of 30 minutes, there is an average of 100 incoming calls, the AHT is 3 minutes, and the expected shrinkage is 30%.

As the call center administrators, we want the average time that a transaction waits in the queue to be 20 seconds and achieve a service level of 80%. We also want to ensure that the maximum occupancy of the agents is not greater than 85%.

The use of this package is very straightforward; we import ErlangC and initialize the class with the given parameters, then we use the method required_positions to find the minimum number of resources to handle the transactions. Take into account that the class expects all the time variables to be in minutes:

```from pyworkforce.queuing import ErlangC

erlang = ErlangC(transactions=100, asa=20/60, aht=3, interval=30, shrinkage=0.3)

requirements = erlang.required_positions(service_level=0.8, max_occupancy=0.85)
print(requirements)
```

The output of this code should look like this:

```{'raw_positions': 14,
'positions': 20,
'service_level': 0.888,
'occupancy': 0.714,
'waiting_probability': 0.174}
```

What this dictionary return is:

• raw_positions: Number of positions found assuming shrinkage = 0

• positions: Number of places found taking the shrinkage provided by the user

• service_level: The expected percentage of transactions that don’t wait in the queue longer than the target ASA

• occupancy: The expected occupancy that the system is going to have

• waiting_probability: The probability that a transaction waits in the queue