Skip to content
Tutorials Center
My learning

Topics

Lesson 45 of 49 ยท Projects and Practice

Project: Staff a Help Desk

Staff a help desk across a day: compute hourly agent needs with Erlang C, cover them with shifts using integer programming, and verify the plan by simulation.

A company's help desk gets calls all day long, but not at a constant rate: the morning rush is heavy, lunchtime is quieter, and the afternoon picks up again. The manager has one question: how many agents should work, and when? This project answers it with three tools from the course. Queueing theory (Erlang C) says how many agents each hour needs, integer programming turns those needs into shifts, and a simulation checks whether the plan really delivers the promised service.

Bars comparing required agents and scheduled agents for eight hours
Caption: Required agents per hour from Erlang C (teal) and agents scheduled with 4-hour shifts (indigo). The schedule meets the requirement every hour but wastes some agent-hours because shifts are rigid.

What you will learn

  • How to compute the minimum staffing for each hour from a service-level goal.
  • How to formulate a shift-cover problem as an integer program and solve it.
  • How to verify a plan with a simulation that has changing arrival rates and staffing.
  • How to explain trade-offs (cost versus service) to a manager.

Key terms

Service level: the share of calls answered within a time limit; here 80 percent within 20 seconds.

Average handling time (AHT): mean time an agent spends on one call.

Shift cover: choosing how many agents start each shift so that every hour has enough agents.

Integer program: an optimization problem where some decisions must be whole numbers, such as agents.

Non-stationary arrivals: arrival rates that change over time.

The problem

The help desk is open 8 hours, 9:00 to 17:00. Calls arrive as a Poisson process whose rate changes by hour (example figures, calls per hour):

Hour 9 10 11 12 13 14 15 16
Calls 20 35 50 55 45 40 50 30

Each call takes 6 minutes on average (exponential), so one agent serves ฮผ = 10 calls an hour. The goal: at least 80 percent of calls answered within 20 seconds, in every hour. Agents work 4-hour shifts that can start at 9, 10, 11, 12 or 13. Minimize the number of agents.

Step 1: How many agents does each hour need?

For each hour, treat the system as an M/M/c queue with ฮป calls per hour and find the smallest c for which

service level = 1 โˆ’ C(c, a) ยท e^{โˆ’(cฮผ โˆ’ ฮป) ยท t} โ‰ฅ 0.80, with a = ฮป/ฮผ and t = 20 seconds.

Start at the smallest stable value c > a and increase until the goal is met.

Python Required agents per hour (Erlang C)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that the agents needed do not grow in proportion to the calls: going from 20 to 55 calls per hour (2.75 times as many) needs 9 agents instead of 4 (2.25 times as many). The economies of scale from pooling that you saw in chapter 6 show up here.

Step 2: Cover the needs with shifts (integer programming)

Let x_s be the number of agents starting a 4-hour shift at hour s (for s = 0..4, meaning 9:00 to 13:00). Agents working in hour h are those whose shift covers it, so

minimize ฮฃ x_s subject to ฮฃ_{s: s โ‰ค h โ‰ค s+3} x_s โ‰ฅ need_h for every hour h, x_s integer โ‰ฅ 0

This is a small integer linear program (see linear programming). SciPy's milp solver handles it.

Python Shift cover with integer programming

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The optimum uses 16 agents. It has 64 agent-hours of capacity against 55 required, so 9 agent-hours (about 14 percent) are spare. That is the cost of the rigid 4-hour blocks. Allowing 2-hour or 6-hour shifts, or part-timers, would reduce it, and that is an easy extension: add more columns to the matrix.

Step 3: Verify by simulation

Erlang C treats each hour in isolation, as if the system were in steady state. In reality a queue that builds up in one hour spills into the next, and the number of agents changes at the hour boundaries. A simulation shows what happens on real days.

The simulator generates the day's calls (Poisson counts per hour, random times within the hour), processes events with a heap, and changes the number of agents at the top of each hour. Over 300 simulated days it records each call's wait.

Python Simulate 300 days with the shift plan

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The overall service level is about 92 percent, and every hour is above the 80 percent goal. The hours with the most spare agents (13:00 and 14:00, with 12 and 10 agents scheduled against a need of 7) are close to 100 percent. The tightest hours, between roughly 85 and 89 percent, are the ones where the schedule has exactly the required number of agents (9:00, 10:00, 11:00, 15:00 and 16:00), and they match the Erlang C predictions from Step 1 closely. That is a reassuring result: the formulas and the simulation tell the same story.

What would you recommend?

A good report would say:

  1. Staffing needs: 4, 6, 8, 9, 7, 7, 8, 6 agents in the eight hours to meet the 80/20 goal.
  2. Schedule: 16 agents on 4-hour shifts (4, 2, 2, 2 and 6 starting at 9, 10, 11, 12 and 13), meeting the goal in every simulated hour.
  3. Cost of rigidity: 9 spare agent-hours. Offering 2-hour shifts or flexible start times should cut it, and this is the first thing to test.
  4. Sensitivity: run the model with AHT of 7 minutes or arrivals 10 percent higher to see how many agents are added; the answer tells the manager how much safety margin the plan has.
  5. Caveats: calls are assumed to be exponential and never to be abandoned, breaks and lunches are ignored, and the arrival rates are forecasts.

Extensions to try

  • Add 2-hour and 6-hour shifts to the integer program and compare costs.
  • Add a rule that nobody works fewer than 4 hours, and that at least one lead agent is always present.
  • Add abandonment (callers hang up after a random patience time) to the simulation.
  • Replace the fixed AHT by a mixture of short and long calls and see the service level change.

Reading the results as a manager would

The key numbers are 16 agents, 91.8 percent service level and 9 spare agent-hours. A manager will ask three questions. First, can we do with fewer agents? The integer program says no for this set of shifts, since 16 is its minimum, but with different shift lengths the answer may change. Second, how sure are we? The simulation averaged 300 days, and the day-to-day spread is worth looking at too: a manager is more concerned about the bad days than about the average. Third, what if the forecast is wrong? Re-run the model with 10 percent more calls and see how the service level falls; this tells you how much slack the plan has.

You can also express the plan as a cost. If an agent-hour costs $30, the 64 scheduled agent-hours cost $1,920 a day, of which 9 hours, $270, are spare. Cutting the spare capacity in half with more flexible shifts would save about $135 a day, or roughly $35,000 over a year of 260 working days. Numbers like these turn a technical result into a business case.

Limits of this model

The model treats the 8 hours as independent in the staffing step, ignores breaks and lunches (which remove agents for 30 to 60 minutes each), assumes calls are never abandoned, and assumes all agents are equally skilled. Real planners extend the model in each of these directions, usually by simulation, because the formulas get complicated quickly.

Common misconceptions

"If Erlang C says c agents are enough, then c agents on duty is enough." Queues carry over from hour to hour, and agents are not always available. Check by simulation.

"A higher service level is free." Each extra point costs more agents, with sharply increasing cost near the top.

"Integer programming gives the best schedule in practice." It gives the best schedule for the stated model. Fairness, breaks and preferences may need extra constraints.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Calls arrive at 30 per hour and each agent handles 12 per hour. What is the smallest number of agents for a stable system?

    The offered load is 30/12 = 2.5 Erlangs, so at least 3 agents are needed.
  2. 2. Why is the shift-cover model an integer program?

    The decision variables are numbers of people, which must be whole numbers.
  3. 3. Why simulate a plan after calculating it with Erlang C?

    Erlang C assumes each hour is in steady state, but real queues carry over and staffing changes.
  4. 4. The schedule has 64 agent-hours and the requirement is 55. How many agent-hours are spare?

    64 โˆ’ 55 = 9 spare agent-hours.
  5. 5. Which change would most likely reduce the spare agent-hours?

    More flexible shifts match the requirement pattern more closely.

Summary

  • Erlang C turns a service-level goal and an arrival forecast into a required number of agents per hour.
  • An integer program covers those requirements with the fewest agents; rigid shifts leave spare capacity.
  • A simulation with changing arrival rates and staffing checks the plan against reality.
  • The final answer is a recommendation, with its cost, its sensitivity and its caveats.

Next: Practice problems