# Simulation of Routing Strategies in Call Centers: Code and Metrics
A discrete-time model lets you compare strategies for distributing incoming calls to agents: Sequential (sequential polling), Round Robin (round-robin), and Longest Idle (selecting by maximum idle time). Analysis focuses on KPIs (SLA, wait time, queue length) and fairness metrics (Gini index, coefficient of variation).
The model generates a Poisson call stream, simulates agent states (idle, busy, offline), and collects data to visualize load distribution. All parameters are centralized in config.py with typing via dataclass and JSON serialization for reproducibility.
Application of the Model in Development and Testing
For developers, the model serves as a sandbox: prototyping strategies uncovers issues early without real-world load.
Testers use it for:
- Validating simulations against production data as a digital twin.
- Stress tests: call spikes, agent outages, bottleneck detection.
Clients (call center managers) run what-if analyses:
- SLA evaluation under strategy changes.
- Load forecasting with agent hiring.
- Fairness comparison at varying traffic intensities.
Project Architecture
Modular structure using src-layout, compatible with Colab and local environments. Editable install via pyproject.toml with auto-package discovery and pytest.
Key modules:
src/ccsim/config.py:SimulationConfigwith seed, lambda_rate, num_agents, etc.src/ccsim/agents.py:Agentclass with states and Poisson events.src/ccsim/strategies.py:RoutingStrategysubclasses for extensibility.src/ccsim/simulation.py: Discrete event loop and processing.src/ccsim/metrics.py: Gini and CV for calls and busy time.src/ccsim/visualization.py: KDE distributions and queue dynamics.main.py: Orchestration and saving toruns/<timestamp>.tests/test_strategies.py: Edge case checks.
Colab run: Generate from notebook, editable install, run main.py. Tests via pytest with HTML/JUnit reports.
Simulation Parameters
SimulationConfig defines:
| Parameter | Description |
|------------------------|------------------------------|
| seed | RNG initialization |
| lambda_rate | Call intensity (calls/sec) |
| num_agents | Number of agents |
| num_calls | Total number of calls |
| min_call_duration, max_call_duration | Duration range |
| agent_logout_prob, agent_login_prob | Agent availability stochasticity |
| max_queue_size | Queue limit |
| service_level_threshold| SLA threshold (sec) |
| max_simulation_steps | Step limit |
Example: lambda_rate [0.65, 0.75, 0.85] models low/threshold/high load. Coefficient of variation best highlights fairness differences.
Strategy Comparison Results
At lambda_rate=0.70, Sequential shows uneven utilization (KDE plots). Round Robin and Longest Idle are closer to uniform. At low load (0.65), call distribution differences are maximal; under overload, they converge.
Plots: combined_busy_times_kde.png for busy time, call distributions per agent.
Key Points
- Model compares Sequential, Round Robin, Longest Idle on KPIs and fairness (Gini, CV).
- Flexible
config.pywith JSON for what-if scenarios. - Modular: new strategies via
RoutingStrategyinheritance. - Visualization of queue dynamics and KDE load distributions.
- Tests cover edge cases: empty queue, no agents.
Model Extensions
Add:
- Heterogeneous agents (skill levels, shift schedules).
- Skill-based and predictive routing.
- Traffic cyclicity, repeat calls.
- Robot agents, fatigue factors.
— Editorial Team
No comments yet.