The Secret Behind JD.com’s Super Fast Delivery

The Inventory Allocation Perspection

It happens to all of us every now and then: you wake up in the morning and realize it’s your wife’s birthday but you forgot to buy a gift; you urgently need a pair of high heels to match your dress for tonight’s party; or you’re caught short in need of toothpaste, shampoo, or toilet paper…

An indispensable part of JD.com’s value offering over years has been our drive to help users during these unavoidable occasions when they need a quick solution. JD provides same and next day delivery as a standard, allowing customers to receive same-day delivery when they place an order before 11am; or next-day delivery by 3pm for orders placed before 11pm. This promise, was introduced in 2010, with no additional delivery charge; and is now available in all major cities across China. JD is able to deliver 90% of orders same- day or next-day.

JD’s self-developed fulfillment network, which consists of over 550 warehouses, combined with the thousands of delivery stations across China, is fundamental to our ability to maintain this standard. The network enables us to store our inventory closer to our customers, guaranteeing them the highest quality delivery service.

Nevertheless, quality infrastructure and reliable delivery alone are not sufficient to fulfill our promise of super quick delivery nationwide. Our inventory algorithm plays a key role in being able to optimize inventory usage and improve our capacity to transport goods to customers. Let’s look at this from the inventory allocation perspective:

Figure 1: JD’s Two-Level Distribution Network

JD’s two-level distribution network consists of Regional Distribution Centers (RDCs) and Front Distribution Centers (FDCs). An RDC serves customers across a large region, while also serving as the location where vendors will deliver purchased inventory for that region. FDCs serve smaller localities, and contain less storage capacity, but are able to reach customers in the surrounding area at quicker speeds.

JD’s inventory allocation algorithm determines how inventory is distributed from RDCs to FDCs for millions of products each day. (Note that prior to the inventory allocation algorithm, we already had a system of determining which products should be carried at each FDC, see this previous blog for more details).

This is an interesting yet challenging problem. Obviously, allocating too little inventory to the FDCs is not good. If customer demand at an FDC cannot be satisfied by local inventory, we need to fulfill that demand directly from the RDC, which increases the likelihood of a delay in delivery. However, allocating too much inventory to the FDCs is also risky as over-committing inventory at one FDC will increase the stock-out probability at the RDC and further limits the inventory available for allocation for the other FDCs in the future. Note that we want to avoid transporting inventory from an FDC back to an RDC or between two FDCs as this would mean much higher management and transportation costs.

Figure 2: The tradeoff between allocating too much or too little inventory between RDCs and FDCs

To determine the amount of inventory to distribute for each product from the RDC to the FDCs, we developed a two-step approach. In the first step, a Network Flow model is built to determine for each product, the ideal level of inventory that each distribution center should hold. In the second step, Mixed Integer Linear Programming (MILP) is used to determine which products should be prioritized in allocation and the optimal quantity of each product to allocate.

Now let’s talk about techniques.

Step One

In the first step we need to figure out:

“For each product, what is the ideal amount of inventory to allocate for each FDC?”

This decision is actually similar to the situation when a mom cuts a pie into pieces and gives a piece to each of her child. Let’s assume that she not only needs to be mindful of the size of each piece in order to keep everyone happy, but she also wants to save some pie for tomorrow. In order to decide on a fair size for everyone, she may need to consider the appetite of each child (demand forecast at the FDCs), the level of hungriness of each child (current inventory level at the FDCs), and the estimated amount of pie that needs to be saved for tomorrow (demand forecast at the RDC).

All of these considerations can be combined into an optimization problem, in particular, a network flow problem, which is defined as follows. For each product, let be the initial inventory level at distribution center , with being the inventory at the RDC waiting to be allocated. We then use to denote the ideal proportion of RDC inventory to be allocated to distribution center , with representing the proportion of inventory reserved at the RDC. In a Network Flow model, we have one RDC inventory node, several FDC inventory nodes, and several FDC demand nodes. The directed arcs connected to the nodes represent the inflows and outflows of the nodes. The total inflows need to be equal to the total outflows for each node. Our goal is to optimize the ideal allocation factor in order to minimize the total stock-out and transportation costs. Figure 3 gives an illustration of the Network Flow model.

At the RDC inventory node, the inflows of the node are the ideal inventory reserved for the RDC, , and the demand loss at the RDC (in the case when inventory is insufficient), ; the outflows are the customer demand for the product at the RDC, , and the remaining inventory at the RDC (in the case when inventory is sufficient), . The flow balance equation at the RDC inventory node is thus The flow balance dynamics will be similar to the other nodes in the network. (For those interested, please feel free to email jd_tech_blog@jd.comto request the formal paper).

Figure 3: An Illustration of the Network Flow Model with 1 RDC and 2 FDCs

To obtain a result from this Network Flow model requires solving multiple linear programming problems, which can be efficiently done using any optimization solver. We show one instance of the result below (Figure 4). The x-axis represents the initial inventory level at the RDC, I_0, the y-axis represents the resulted ideal inventory factor at the RDC, δ_0. As expected, the curve suggests that a higher initial inventory level I_0 leads to a smaller δ_0. But we also realize that the decreasing of δ_0 in I_0 is not linear, indicating the requirement of changing the reserve ratio δ_0 dynamically according to the specific scenario.

Figure 4: How inventory level affects the solution

The solutions in first step are updated every day based on updated demand forecasting data and the real-time inventory level at each distribution center.

Step Two

When inventory at the RDC is sufficient and transportation capacity is sufficient, inventory allocation decisions are relatively simple as all the FDCs have good chances to be replenished up to their ideal inventory levels. So, results from the first step can be directly applied.

However, the problem becomes more complicated when 1) the total amount of inventory requested by the FDCs exceeds RDC’s capability to processing it, or 2) the amount of inventory requested by an FDC exceeds the transportation capacity that can be used for inventory allocation from the RDC to that particular FDC.

Facing these challenges, we need to answer the question:

“Which products should be put on the truck first and what is the shipping quantity?”

For one product, a larger gap between the forecasted demand and the current on-hand inventory indicates a higher urgency for allocation. We formulate this problem using stochastic Mixed Integer Linear programming (MILP):

In this formulation, we use variable x_ij to indicate the amount of inventory of product i to be allocated to FDC, and binary variable y_ij to indicate whether product i is selected for allocation to FDC j. We specify in constraints (1) and (2) that for each FDC, the total allocation amount from the RDC needs to be within the units limit (M_j) and the number of products limit (N_j) in order to be conformed with the RDC processing capacity and transportation capacity. We use constraint (3) to define the relationship between x_ij and and y_ij constraint (4) to ensure that the total allocated amount for each product is less than the available amount that can be allocated from the RDC (Q_i). Note that Q_i here is an output from the first step described above. The objective of this problem is to minimize the expected sales loss given the estimated demand distribution D_ij and the current inventory level I_ij.

However, solving the above formulation is computationally expensive, due to the large number of products — tens of thousands — and the stochasticity of the future demand. In practice, we decompose the problem into two subproblems — one focusing on solving the allocation amount for a single FDC given capacity constraints, and the other focusing on solving the allocation across multiple FDCs for a single product given available inventory at the RDC. The decomposition allows us to solve the optimization problem efficiently in practice.

Conclusion

Following the implementation of our two-step algorithm inventory allocation algorithm, JD has achieved visible improvement in key performance metrics such as stock-out rate at the distribution centers and the proportion of orders meeting our same- and next-day delivery standards. In addition, with the optimization algorithm, we are able to free up more staff from daily operational decision-making, giving them the opportunity to focus on other tasks.

The inventory allocation problem has also been used as one of the topics in the JD’s Global Optimization Challenge which saw many students from around the world compete online. See this blog for more details about the challenge.


We are open to all kinds of academic research collaborations. Please contact jd_tech_blog@jd.com if you are interested.