This is a guest post co-authored by Nafi Ahmet Turgut, Mehmet İkbal Özmen, Hasan Burak Yel, Fatma Nur Dumlupınar Keşir, Mutlu Polatcan and Emre Uzel from Getir.
Getir is the pioneer of ultrafast grocery delivery. The technology company has revolutionized last-mile delivery with its grocery in-minutes delivery proposition. Getir was founded in 2015 and operates in Turkey, the UK, the Netherlands, Germany, and the United States. Today, Getir is a conglomerate incorporating nine verticals under the same brand.
In this post, we describe the end-to-end workforce management system that begins with location-specific demand forecast, followed by courier workforce planning and shift assignment using Amazon Forecast and AWS Step Functions.
In the past, operational teams engaged in manual workforce management practices, which resulted in a significant waste of time and effort. However, with the implementation of our comprehensive end-to-end workforce management project, they are now able to efficiently generate the necessary courier plans for warehouses through a simplified, one-click process accessible via a web interface. Before the initiation of this project, business teams relied on more intuitive methods for demand forecasting, which required improvement in terms of precision.
Amazon Forecast is a fully managed service that uses machine learning (ML) algorithms to deliver highly accurate time series forecasts. In this post, we describe how we reduced the modelling time by 70% by doing the feature engineering and modelling using Amazon Forecast. We achieved a 90% reduction in elapsed time when running scheduling algorithms for all warehouses using AWS Step Functions, which is a fully managed service that makes it easier to coordinate the components of distributed applications and microservices using visual workflows. This solution also led to an 90% improvement in prediction accuracy across Turkey and several European countries.
Solution overview
The End-to-end Workforce Management Project (E2E Project) is a large-scale project and it can be described in three topics:
1. Calculating courier requirements
The first step is to estimate hourly demand for each warehouse, as explained in the Algorithm selection section. These predictions, produced with Amazon Forecast, help determine when and how many couriers each warehouse needs.
Based on the throughput ratio of the couriers in warehouses, the number of couriers required for each warehouse is calculated in hourly intervals. These calculations assist in determining the feasible courier counts considering legal working hours, which involves mathematical modeling.
2. Solving the shift Assignment problem
Once we have the courier needs and know the other constraints of the couriers and warehouses, we can solve the shift assignment problem. The problem is modelled with decision variables determining the couriers to be assigned and creating shift schedules, minimizing surplus and shortage that may cause missed orders. This is typically a mixed-integer programming (MIP) problem.
3. Utilizing AWS Step Functions
We use AWS Step Functions to coordinate and manage workflows with its capability to execute jobs in parallel. Each warehouse’s shift assignment process is defined as a separate workflow. AWS Step Functions automatically initiate and monitor these workflows by simplifying error handling.
Since this process requires extensive data and complex computations, services like AWS Step Functions offer a significant advantage in organizing and optimizing tasks. It allows for better control and efficient resource management.
In the solution architecture, we also take advantage of other AWS services by integrating them into AWS Step Functions:
The following diagrams show AWS Step Functions workflows and architecture of the shifting tool:
Figure 1 AWS Step Functions workflows
Figure 2 Shifting tool architecture
Algorithm selection
Forecasting locational demand constitutes the initial phase in the E2E project. The overarching goal of E2E is to determine the number of couriers to allocate to a specific warehouse, commencing with a forecast of the demand for that warehouse.
This forecasting component is pivotal within the E2E framework, as subsequent phases rely on these forecasting outcomes. Thus, any prediction inaccuracies can detrimentally impact the entire project’s efficacy.
The objective of the locational demand forecast phase is to generate predictions on a country-specific basis for every warehouse segmented hourly over the forthcoming two weeks. Initially, daily forecasts for each country are formulated through ML models. These daily predictions are subsequently broken down into hourly segments, as depicted in the following graph. Historic transactional demand data, location-based weather information, holiday dates, promotions and marketing campaign data are the features used in the model as shown in the graph below.
Figure 3 The architecture of location-specific forecasting
The team initially explored traditional forecasting techniques such as open-source SARIMA (Seasonal Auto-Regressive Integrated Moving Average), ARIMAX (Auto-Regressive Integrated Moving Average using exogenous variables), and Exponential Smoothing.
ARIMA (Auto-Regressive Integrated Moving Average) is a time series forecasting method that combines autoregressive (AR) and moving average (MA) components along with differencing to make the time series stationary.
SARIMA extends ARIMA by incorporating additional parameters to account for seasonality in the time series. It includes seasonal auto-regressive and seasonal moving average terms to capture repeating patterns over specific intervals, making it suitable for time series with a seasonal component.
ARIMAX builds upon ARIMA by introducing exogenous variables, which are external factors that can influence the time series. These additional variables are considered in the model to improve forecasting accuracy by accounting for external influences beyond the historical values of the time series.
Exponential Smoothing is another time series forecasting method that, unlike ARIMA, is based on weighted averages of past observations. It is particularly effective for capturing trends and seasonality in data. The method assigns exponentially decreasing weights to past observations, with more recent observations receiving higher weights.
The Amazon Forecast models were eventually selected for the algorithmic modeling segment. The vast array of models and the sophisticated feature engineering capabilities offered by AWS Forecast proved more advantageous and optimized our resource utilization.
Six algorithms available in Forecast were tested: Convolutional Neural Network – Quantile Regression (CNN-QR), DeepAR+, Prophet, Non-Parametric Time Series (NPTS), Autoregressive Integrated Moving Average (ARIMA), and Exponential Smoothing (ETS). Upon analysis of the forecast results, we determined that CNN-QR surpassed the others in efficacy. CNN-QR is a proprietary ML algorithm developed by Amazon for forecasting scalar (one-dimensional) time series using causal Convolutional Neural Networks (CNNs). Given the availability of diverse data sources at this juncture, employing the CNN-QR algorithm facilitated the integration of various features, operating within a supervised learning framework. This distinction separated it from univariate time-series forecasting models and markedly enhanced performance.
Utilizing Forecast proved effective due to the simplicity of providing the requisite data and specifying the forecast duration. Subsequently, Forecast employs the CNN-QR algorithm to generate predictions. This tool significantly expedited the process for our team, particularly in algorithmic modeling. Furthermore, utilizing Amazon Simple Storage Service (Amazon S3) buckets for input data repositories and Amazon Redshift for storing outcomes has facilitated centralized management of the entire procedure.
Conclusion
In this post, we showed you how Getir’s E2E project demonstrated how combining Amazon Forecast and AWS Step Functions services streamlines complex processes effectively. We achieved an impressive prediction accuracy of around 90% across countries in Europe and Turkey, and using Forecast reduced modeling time by 70% due to its efficient handling of feature engineering and modeling.
Using AWS Step Functions service has led to practical advantages, notably reducing scheduling time by 90% for all warehouses. Also, by considering field requirements, we improved compliance rates by 3%, helping allocate the workforce more efficiently. This, in turn, highlights the project’s success in optimizing operations and service delivery.
To access further details on commencing your journey with Forecast, please refer to the available Amazon Forecast resources. Additionally, for insights on constructing automated workflows and crafting machine learning pipelines, you can explore AWS Step Functions for comprehensive guidance.
About the Authors
Nafi Ahmet Turgut finished his master’s degree in electrical & Electronics Engineering and worked as graduate research scientist. His focus was building machine learning algorithms to simulate nervous network anomalies. He joined Getir in 2019 and currently works as a Senior Data Science & Analytics Manager. His team is responsible for designing, implementing, and maintaining end-to-end machine learning algorithms and data-driven solutions for Getir.
Mehmet İkbal Özmen received his Master’s Degree in Economics and worked as Graduate Research Assistant. His research area was mainly economic time series models, Markov simulations, and recession forecasting. He then joined Getir in 2019 and currently works as Data Science & Analytics Manager. His team is responsible for optimization and forecast algorithms to solve the complex problems experienced by the operation and supply chain businesses.
Hasan Burak Yel received his Bachelor’s Degree in Electrical & Electronics Engineering at Boğaziçi University. He worked at Turkcell, mainly focused on time series forecasting, data visualization, and network automation. He joined Getir in 2021 and currently works as a Data Science & Analytics Manager with the responsibility of Search, Recommendation, and Growth domains.
Fatma Nur Dumlupınar Keşir received her Bachelor’s Degree from Industrial Engineering Department at Boğaziçi University. She worked as a researcher at TUBITAK, focusing on time series forecasting & visualization. She then joined Getir in 2022 as a data scientist and has worked on Recommendation Engine projects, Mathematical Programming for Workforce Planning.
Emre Uzel received his Master’s Degree in Data Science from Koç University. He worked as a data science consultant at Eczacıbaşı Bilişim where he mainly focused on recommendation engine algorithms. He joined Getir in 2022 as a Data Scientist and started working on time-series forecasting and mathematical optimization projects.
Mutlu Polatcan is a Staff Data Engineer at Getir, specializing in designing and building cloud-native data platforms. He loves combining open-source projects with cloud services.
Esra Kayabalı is a Senior Solutions Architect at AWS, specializing in the analytics domain including data warehousing, data lakes, big data analytics, batch and real-time data streaming and data integration. She has 12 years of software development and architecture experience. She is passionate about learning and teaching cloud technologies.
Read More