The Virtue of Integer Programming: How It Helps us Replenish European Warehouses

Onur Demiray
Trendyol Tech
Published in
5 min readMar 15, 2024

At Trendyol Tech, the pursuit of operational excellence is a cornerstone of our philosophy, and optimization techniques, notably integer programming, stand as invaluable assets in achieving this goal. This article serves as a testament to our commitment, offering a glimpse into a specific project where integer programming plays a pivotal role in optimizing the replenishment decisions for our European warehouses. Beginning with an overview of the challenge at hand, I outline the intricacies of the problem before delving into the tailored integer programming model crafted to address it. Subsequently, we explore implementation considerations and present tangible results that demonstrate the framework’s impactful outcomes. Finally, we conclude our article with a succinct summary.

European Warehouse Replenishment Problem

Our operational journey begins with receiving demand forecasts for each SKU in the European market. From there, our planning team steps in to make replenishment decisions that align with these forecasts. While this process may initially appear straightforward, its execution is far from simplistic.

At the core of our operational challenge lies the intricate process of SKU selection for replenishing our European warehouses. Unlike a straightforward selection of individual items, our planning team is tasked with determining which boxes — each typically containing multiple items of different SKUs — to dispatch. This structural complexity leads to the over-transfer of goods relative to market demand. In navigating this challenge, traditional rule-of-thumb approaches fall short, particularly given the scale of demand Trendyol encounters. Thus, the strategic imperative of effectively determining which boxes to dispatch becomes paramount in optimizing our supply chain operations.

In an ideal scenario, meeting all market demand would be the pinnacle of success. However, the feasibility of this objective is often hindered by two primary constraints. Firstly, certain items may face inventory shortages relative to their demand. Secondly, operational limitations introduce a capacity constraint, imposing an upper limit on the number of items that can be dispatched. Consequently, the primary focus is on maximizing the fulfillment rate within the operational boundaries, while the secondary objective involves minimizing the total cost. This cost comprises fixed expenses associated with box dispatch and variable costs related to item handling.

In summary, our objective in this problem is to carefully choose which boxes to send from our warehouses in Turkey to those in Europe. This selection process aims to optimize two distinct performance metrics while ensuring that we adhere to constraints regarding stock availability and total capacity.

Integer Programming Formulation

The integer programming formulation is given as follows:

As mentioned earlier, we have two objectives. The primary one is the maximization of the fulfillment rate. Since the total demand is constant, (1) simply maximizes the fulfillment rate by satisfying the maximum total number of demands. (2) Minimizing the total cost serves as the secondary objective. Constraints (3) ensure that we cannot satisfy nonexistent demands, while constraints (4) guarantee that demand satisfaction is limited by inventory levels, and a box that is not dispatched cannot be used to fulfill the demand. Finally, constraint (5) states that the total number of sent items cannot exceed the maximum allowed capacity.

Implementation

We’ve devised an end-to-end framework for our planning team to tackle the problem at hand. This pipeline commences by extracting problem parameters from BigQuery and culminates in recording replenishment decisions back into BigQuery, alongside performance metrics automatically dispatched to the team’s Slack Channel. Our mathematical model was implemented in Python. Since we have two distinct objective functions, we’ve adopted a lexicographic approach. Initially, we focus solely on maximizing the fulfillment rate while adhering to constraints (3)-(5). Subsequently, we maintain this optimal fulfillment rate and proceed to execute the subsequent and final formulation, which minimizes total costs per (2) while still respecting constraints (3)-(5). Additionally, we introduce a constraint allowing a 5% deviation from the optimal fulfillment rate to potentially enhance total cost outcomes. The entire pipeline has been constructed using Airflow for seamless integration and management.

Airflow Interface

It is important to highlight that our use of the commercial solver is restricted by a maximum runtime of one hour. Over the past six months, the solver has consistently produced optimal solutions within this timeframe for more than 95% of the problem instances, although it lacks a formal theoretical guarantee. To address potential setbacks stemming from either the solver’s inability to find a solution or its provision of suboptimal results, we have developed a strategic approach. Before employing the solver to tackle the mathematical model, we first implement a greedy algorithm and document its solution. Subsequently, we utilize the solver to seek the exact solution. If the solver fails to provide a solution, we promptly revert to the solution generated by the heuristic algorithm. Conversely, if the solver presents a solution without ensuring optimality, we conduct a comparative analysis of the two solutions and adopt the superior one. Further elucidation on our heuristic algorithm will be provided in an upcoming Medium article.

Results

In this section, we present the tangible impact of our approach on replenishment decisions. To assess this impact, we initially implement a rule set that generates replenishment decisions prior to integrating our algorithm into the decision-making process. Each time our pipeline is activated to solve the problem, a parallel automatic task is initiated to evaluate the outcomes using the previous rule sets. Our evaluation focuses on two key performance metrics: fulfillment rate and total cost per needed item. To offer concrete insights, we showcase the improvements achieved within these metrics for November 2023 and December 2023. Notably, the fulfillment rate experiences significant enhancements of 50.73% and 36.09%, respectively, for those months, while the total cost per needed item metric demonstrates notable improvements of 46.62% and 57.55%, respectively, for the same periods.

It’s also crucial to underscore that prior to the implementation of our framework, the planning team typically dedicated nearly a full day to arrive at these decisions. However, our new framework guarantees a solution within just one hour, all achieved in a fully automated manner.

Conclusion

In conclusion, our pursuit of operational excellence at Trendyol Tech has led to the development of a framework that optimizes replenishment decisions for European warehouses. Through the integration of advanced techniques and strategic objectives, we’ve achieved significant improvements in fulfillment rates and total costs while reducing decision-making time from a day to just one hour. This transformative approach not only enhances operational efficiency but also underscores our commitment to innovation and agility in meeting market demands. As we continue to refine our framework and embrace optimization & automation, we remain steadfast in our mission to redefine supply chain optimization and drive sustainable growth in the digital era.

Join Us

We’re building a team of the brightest minds in our industry. Interested in joining us? Visit the pages below to learn more about our open positions.

--

--

Onur Demiray
Trendyol Tech

PhD in Computational Optimization @Imperial College London, Data Scientist @Trendyol Tech