Schedule administration header

A Use Case for Allocation Optimisation: Employee Schedule Administration

Advanced Analytics is not just machine learning modelling and forecasting; there are other areas of analytics, and techniques that have been used for ages in different industries. The technique or set of techniques that we’ll be showing in this blog, through a use case, is optimisation. This use case is an employee scheduling optimisation solution developed for a customer by ClearPeaks, simplified here for better understanding.

 

Schedule or allocation tasks, either for employees or for other kinds of resources or assets, have been around for decades. A lot of literature has been written regarding scheduling and allocation optimisation processes, and the complexity of finding optimum assignations while dealing with all the implied restrictions, especially when dealing with people and the volatility that characterises this type of asset.

 

In the specific case of employee scheduling, this complexity grows exponentially when dealing with holidays, different departments, people leaving the company, new hires, and so on.

 

Once we had understood the challenge, we decided to look for the most automatable and flexible solution for our customer.

 

In this blog post we will be presenting the problem we faced, and the key features of our product:

 

  • Easy to integrate into any business.
  • Flexible to suit any business rules.
  • No need to think about the schedule, just click on Run.
  • Based on optimisation models.

 

 

What is an Optimisation Model?

 

Optimisation is a branch of Advanced Analytics, unrelated to machine learning, as we are not making a prediction but trying to find the values of defined parameters so that we can get the optimum value for a defined function.

 

Optimisation is about obtaining the best result for a problem given a set of circumstances, limitations, or restrictions. An optimisation model usually tries to find the best solution to minimise the effort required to perform a task, or to maximise the benefit obtained by performing that task. As long as we can manage to express the effort or the benefit as a function of certain variables, we can then define the optimisation process as finding the conditions that give the minimum or maximum value of the designated function.

 

An optimisation model is made up of three main components:

 

  • An objective function: the function that we want to optimise.
  • The decision variables: the values of each decision variable for which the objective function has reached the optimum; this is the solution that we are looking for.
  • A set of constraints: to narrow and limit the values that the decision variables can take. There are several types of constraint, usually with a lower and an upper bound that will specify the value of the constraint. We can specify if we always want to meet the constraints, or if the model can surpass the specified limits by a certain amount so that it can find a better solution (even if it comes with a certain penalisation).

 

There is a lot of maths involved in modelling and finding the optimal solution in optimisation processes, so we will focus on the solution we developed rather than on the optimisation process running in the background.

 

Some other examples of optimisation problems are:

 

  • Vehicle Routing: find the best routes for delivery vehicles.
  • Assignment: optimal assignment of workers on teams and tasks.
  • Energy Supply: energy assignation between power plants and consumption.

 

 

Technology Used

 

The framework used for this solution is the open-source software OR-Tools developed by Google for optimisation problems; the model was developed using a Python wrapper.

 

Within each optimisation framework, in this case OR-Tools, there are different solvers, software packages formed by one or more algorithms prepared to find solutions to one or more problems. Depending on the problem we are facing, different solvers can vary in performance to find the optimum solution. The solver selected for our solution in OR-Tools is called CP-SAT, a solver developed for constraint programming and well suited for scheduling programs.

 

 

Requirements

 

Our customer requested a solution to facilitate the scheduling process in a business, including a full-stack application that runs an optimisation model that performs that job.

 

Other customer requirements were as follows:

 

  • Fast and high performing.
  • Scalable to large companies with lots of departments and employees.
  • Persistence of simulation results.
  • Flexible business rules (model constraints).

 

 

Architecture

 

In our case we implemented the model running on the backend server as a subprocess, a frontend application as an Angular application, and a PostgreSQL database to save all the employees, departments, and simulation history info. Below you can see the application architecture:

 

figure1

Figure 1: Scheduler administration architecture solution 

 

 

Model Insights

 

For demonstration purposes we have simplified the model down to 15 employees, 2 departments, and 4 shifts. Our objective function is to minimise the cost of the schedule, fulfilling certain constraints necessary for the solution to work. Our model can be described as follows:

 

Figure 2: Model architecture solution

 

In our simplified solution there are the employees and their characteristics (salary), the number of employees needed for each department on a daily basis, and the historical data and holidays for each employee and department. With this information we can create all the decision variables, effectively all the possible combinations of day, employee, shift, and department.

 

As constraints for the optimisation problem, and also for simplification purposes, we have developed the following types:

 

  • Regulation constraints: related to labour regulations.
  • Employee constraints: related to contractual agreements and internal regulations.
  • Custom constraints: related to the business and customer needs.

 

As mentioned above, the solution is fully customisable. The regulations and restrictions required for each customer and company are different, since scheduling employees is not the same as scheduling tasks or machines.

 

 

Use Case

 

  1. Employees Tab
    figure3

    Figure 3: Employees Tab

     

    In this tab you can perform all the necessary changes to the employees. You can:

     

    • View (and filter by any field) all the employees in the business.
    • Create new employees.
    • Edit existing employees. This includes adding or removing an employee to or from a department.
    • Delete an existing employee from the database. This will soft delete the employee, who can easily be restored if necessary.

     

  2. Departments Tab
    figure4

    Figure 4: Departments Tab

     

    In this tab you can manage all the departments in the business. You can: 

     

    • View (and filter by any field) all the departments in the database. 
    • Create new departments. 
    • Edit existing departments. This includes managing the required employees for each shift on weekdays or weekends. 
    • Delete an existing department from the database. This will soft delete the department and it can easily be restored if necessary. 

     

  3. Vacations Tabfigure5

    Figure 5: Vacations Tab

     

    In this tab you can:

     

    • View all the holiday distribution for each day in a calendar format.
    • Filter to see only one employee’s holidays. 
    • Add holidays to an employee in a date range. This method checks that the employee doesn’t go over the maximum holiday entitlement.figure6

      Figure 6: Vacations, extended view

    • As you can see in the image above, if you click on any day, an extended view appears as a modal window.
  4. Simulation Tabfigure7

    Figure 7: Simulation Tab

     

    In this tab you can: 

     

    • Navigate through the months.
    • See historical data (saved previous simulations).
    • Pick a simulation configuration, as seen in the image below:figure8

      Figure 8: Simulation configuration

       

    • As you can see below, the date range picker will automatically select the correct range based on the desired weeks you selected before. figure9

      Figure 9: Date range picker

       

    • When you have set up the configuration, you will be able to click on the blue button to simulate. After the server has processed your request, you will see something like this: figure10

      Figure 10: Completed simulation 

       

    • You will be able to see all the details of the simulation by clicking on each day, as shown below: 
      figure11

      Figure 11: Day details (pick department)

       

    • You can select any department and see all the employees working on each shift: 
      figure12

      Figure 12: Day details (department shifts)

       

    • If we close the pop-up and click on the More Info green button, a pop-up with simulation info will appear. As we can observe in the image below, first we see the total cost (this is what the model is trying to minimise), and the broken soft constraints list: 
      figure13

      Figure 13: Simulation info panel

       

    • If you click on the green button to save the current simulation (see Figure 14), the simulation info will be re-sent to the server. It will then save the simulation info in the database. It will be shown in blue on the webpage, meaning that it is now historical data. 
      figure14

      Figure 14: Saved simulation 

       

 

Conclusions

 

We have taken you through a solution that will help our customer to maintain stable and secure employee scheduling at the lowest cost for the business. We made sure that the application is flexible enough to adjust to other types of businesses and requirements in the domain of optimising asset allocation or scheduling.

 

Our solution is intuitive so that the customer can manage it by themselves. If a new member joins the company, they can easily be added in the employees tab. If a simulation has already run without these changes, the system will notify you that the historical data is inconsistent with the current status of the application. The same thing happens when adding holidays to an employee, adding or removing an employee to or from a department, you name it!

 

Here at ClearPeaks we always work to create the most productive and reliable solutions with the latest technologies. Don’t hesitate to contact us if you are embarking on asset allocation optimisation and need some pointers – we will be delighted to help you!

 

Advanced Analytics Service

Aleix F, Alex R
aleix.ferre@clearpeaks.com