Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Imagine you run a call center to connect companies with their customers.

Obviously, the calling customers want as little as possible waiting time, hope for competent staff and even could leave the call happy and satisfied when the person they talked to was friendly and helpful. This, of course, can only be expected when your staff is happy and not stressed out by double-shifts, all-nighters or late pickup fees from the Kindergarten their children attend because of inflexible working hours. On top of this, you want your call center to be efficient and look for having the right number of agents on duty when you need them.

Here you find yourself in a balancing act with many competing objectives. Luckily this is one of the tasks that can be done quite well with the integrated SAP HANA features for predictive analytics and optimization.

My name is Marcus Dettenbach and I am a Data Scientist at SAP. This blog is about a solution to the problem we built to tackle the problem I just lined out.


Finding a good solution for our optimization problem can be done in three steps that build upon each other:

  1. Forecast the demand of agents for the time period that needs to be planned

  2. Find the optimal number of agents per shift by using an optimization algorithm

  3. Assign shifts to specific agents, so that Mr. and Mrs. Smith know when to come to work

Figure 1: Solution Overview

The solution we build resembles this structure and consists of three modules:

  1. The Forecasting Module is used to forecast call volumes, call handling times and required head counts.

  2. The Scheduling Module is used to allocate agents to shift schedules in the best way, in order to fulfill given objectives such as  ”average speed of answer” and “fairness between call center locations” and “cost efficiency”. The outcome here is the optimal number of agents per shift schedule.

  3. Based on this result, the assignment process is carried out in the Allocation Module. Using a self-service process, agents can indicate their preferences for specific shift schedules. Based on those and other criteria the allocation is triggered.

The first two modules are what we consider analytical application -  the Allocation Module being a mostly transactional application – which is why I cover these two here.


Forecasting is commonly based on the idea that series of past events contain pattern that allow to make pretty good guesses about what will happen in the future. To do just that, the Forecasting Module looks at historic and current data, e.g. historic call volumes and current sales data. Applying data analysis and lots of interaction with the owner of the data is usually necessary to identify and truly understand patterns in call volume, such as daily and weekly patterns as well as patterns around specific events such as holidays and trends in the data set. Accounting for the found patterns and heavily utilizing the forecasting capabilities of the SAP HANA Predictive Analytics Library (PAL) such as Linear Regression with Damped Trend and Seasonal Adjust we computed the forecasts for call volume for selected time periods and average handling time per call.

These forecasts combined with target KPIs like “average speed of answer are used as inputs for a queuing model that forecasts the required number of agents. Speed and quality of computation was much appreciated by our team and by our stakeholders.

Different prediction horizons for different use cases

One important aspect of how to use the available data is the selection of aggregation level. Computing the values mentioned above for example on a monthly level, provides decision support for mid to long term hiring and training decisions. On the other hand the “required number of agents per 30 min interval” serves as input for the Scheduling Module.


The Scheduling Module schedules such that supply (obviously the number of agents available) matches demand (number of agents required to handle the expected call load).

Every agent works on a shift schedule that repeats weekly. Say, they work Mo-Fr from 8am to 4:30pm with a 30 min break at 12 pm and off-days on Sat and Sun. Usually several thousand of those shift schedules are available. The question is: How many agents should work on which shift schedule?

This leads us to the demand part. Because agents keep the same weekly shift schedule for the whole planning period, the demand for an “average week” must be calculated. This “average week” serves as a proxy for the demand during the entire planning horizon. Using the results of the Forecasting Module and some further analytics, the demand is computed as the required number of agents for each 30 minute interval of the “average week”.

Playing fair makes everyone happy

As mentioned at the beginning, another objective besides happy customers are happy agents. To achieve this, fairness criteria such as a fair allocation of shift schedules between call center locations play an important role. E.g. it is intuitive that shift schedules starting during night times are less popular and shift schedules with off-days on weekends are particularly popular. A fairness criteria could be to allocate the same share of popular and unpopular shift schedules to all call center locations.

Getting out the secret sauce: OFL and SCIP

If the description of the current problem gives you a tingling sensation in the back of your mind, then it’s probably the reminder of the operations research module you once took at Uni or the linear programming lecture you attended. Right, this is the time this becomes quite useful since the problem can be modeled as a so called mixed integer optimization problem.

In order to solve it, we used the SAP HANA Optimization Function Library (OFL). Similar to the SAP HANA Predictive Analytics Library (PAL) and Business Function Library the OFL comes with every SAP HANA installation and provides functions to solve Mixed Integer Linear Programs. Being one of the lesser known features of SAP HANA it provides access to an open-source solver shipped with every installation called solve SCIP. While other (commercial) solvers can also be used by OFL, we found that for many problem sizes in call center scheduling SCIP solved most problems in reasonable time. Only to stress this point a little bit more: In most projects it is highly appreciated that SCIP comes for free with every SAP HANA installation whereas commercial solvers usually have a pretty decent price tag attached.

The output of the Scheduling Module is a catalogue of shift schedules with the number of agents attached. Planning the schedule of agents, so that both, the demand and the fairness among agents are accounted for, makes agents as well as customers happy. And after all, this is the main target of the solution.


In order to complete the picture we briefly discuss the Allocation Module. The remaining step on our way towards a ready-to-use shift schedule is to match specific agents with shift schedules. The call-center agents see the number of available shift schedules and provide their preferences using a self-service process. Based on these preferences and other criteria such as seniority, an algorithm allocates specific shift schedules to specific agents. Usually the focus of this part of the solution is more on the transactional character, since every agent will use this part of the solution resulting in a high number of users.

If you are interested in using tools like SAP HANA PAL or OFL with SCIP in your own products or have any questions around workforce management in general, please feel free to contact me (

For the readers interested in other use cases of applied optimization at SAP these blog posts offer more on this topic:

SAP optimizes Berth Plans to increase productivity and utilization of scarce infrastructure

SAP schedules car drivers at scale

For the readers interested to get hands-on these two links will provide a great start:

SAP TechED Online DMM264 - SAP HANA Predictive Modeling and Application Deployment – PAL and R: Hand...

SAP HANA Academy PAL playlist (code examples on github