Trendyol Go Matching Processes

Esra Göksel
Trendyol Tech
Published in
6 min readJan 6, 2023

In 2020, the Covid-19 pandemic that affected the world had a significant impact on consumer habits. With the restrictions brought about by the pandemic, consumers who were forced to stay at home began to do most of their shopping online. Online meal and grocery shopping are increasingly being adopted by consumers. In the face of this increasing demand, it has become important to quickly deliver orders and ensure customer satisfaction.

As Trendyol GO Matching team, assigning the order to the optimum courier and delivering it to the customer as soon as possible is one of the main goals we want to achieve. When determining the optimal courier for the order, there are many important parameters such as fairness, courier’s request, and order density.

In this article, we will briefly explain the courier matching flows for Trendyol GO orders.

Determining the matching start time for an order is especially important for meal and grocery orders. For these delivery types, having the order waiting in the store ready for delivery (especially for meal orders) or having the courier waiting in the store for the order to be prepared negatively affects delivery time and customer and courier satisfaction. Therefore, it is very important to determine the matching time with the courier for the order. To calculate this time accurately, a mathematical model developed by the Trendyol Optimization team is used. In this model, the courier matching time for the order is determined by considering the preparation and delivery times of the store’s past orders, and when that matching time arrives, the search flows for couriers using motorized vehicles start to operate.

Apart from couriers using motorized vehicles, there are two types of couriers using non-motorized vehicles, namely ‘Walker’ and ‘Bicycle’. These couriers are assigned short distance and low volumetric weight deliveries. Since the speed of the couriers using non-motorized vehicles is slower than the couriers using motor vehicles, the order assignment process to these couriers starts before the specified match time.

If a courier has been designated by the admin for an order, the order is directly assigned to that courier. If no courier has been specified, a suitable courier is found by finding courier algorithms for that order. Below are the flows for finding a courier for an order by the matching algorithm;

Matching According To Fairness

In the fair matching flow, the courier who does not carry any orders in the vicinity of the order’s store and waits for an order assignment for the longest time is selected. With the fair courier matching flow, couriers that are not been assigned orders for a long time, regardless of the distance, are prioritized in order assignment.

The figure shows the couriers waiting for order assignment near the store of the order. Although Courier 1 has the least distance to the order, the order will be assigned to Courier 2, which has been waiting for the order assignment for the longest time.

Matching According to ‘Go Home’ Demand

Since orders are assigned to couriers based on their current locations, they sometimes move away from their home location. This increases the distance that couriers travel to return home after their shift. To reduce this distance, couriers can define the location where they want to receive orders during their last working hours. In this way, the couriers are assigned an order that will bring them closer to the location they have specified during their last working hours.

In this flow, the couriers closest to the store with an active ‘Go Home’ request are identified.

The courier that is near the store and whose distance to the location of the order’s customer is shorter than the distance of the courier’s current location to the courier’s requested location is identified and the order is assigned to this courier.

The figure shows a courier with an active ‘Go Home’ request 2 kilometers from the store. The current location of this courier is 8 km from the courier’s home. The customer location of the order is 3 km away from the courier’s home. With this order assignment, the courier will move 5 km closer to his home.

Matching According to ‘Go Sub-Zone’ Demand

The flow of bringing the courier closer to the sub-zone area where they are registered is similar to the ‘Go Home’ flow. As orders are assigned to couriers based on the courier’s current location, couriers may occasionally move away from their sub-zone. Couriers who move away from their sub-zone can request to return to their sub-zone during the working day. In this flow, the courier nearest to the store, which is not in its sub-zone and has an active ‘Go Sub-Zone’ request, and will be closer to its own sub-zone with this order assignment, is determined. The order is assigned to this courier.

The figure shows a courier working in Sub Zone 2 with a store distance of 1 km and an active ‘Go Sub-Zone’ request. The order is assigned because the customer’s location of this order will bring the courier closer to the sub-zone where it is registered.

Matching According to Nearness

In case no courier can be found for matching from ‘Fairest’, ‘Go Home’, and ‘Go Sub-Zone’ flows, to reduce the delivery time of the order, the courier nearest to the store and not carrying an active order is found and the order is assigned to that courier.

Couriers within a 3 km radius of the store of the order are indicated. The order is assigned to Courier 1, which is closest to the store.

Especially during peak hours, it is a problem to find a courier who is not carrying an order as the number of orders is very high. In this case, couriers who are carrying an active order and are about to deliver this order are determined. When assigning orders to these couriers, the distance between the customer location of the order they are carrying and the store location of the assigned order is taken into account. The order is added to the courier’s queue if the distance conditions are appropriate. After the courier delivers the order it is carrying, the order in the queue is assigned to the courier.

In the figure, Courier 1 is about to deliver Store 1’s order to Customer 1. Courier 2 is about to deliver Store 2’s order to Customer 2. Since Customer 2’s location is closer to Store 3, Store 3’s order is added to Courier 2’s order queue. The new order is assigned when the courier delivers the current one.

Matching Exclusion

We briefly talked about the flows for finding a courier for an order by algorithms. As important as it is to find a suitable courier for an order, it is also important not to assign that order to couriers excluded by matching algorithms or admin. Therefore, before the algorithms search a courier for an order, the couriers that should not be assigned to that order should be identified and they should not be included in the courier search flow.

In the following order-specific cases, couriers are excluded from matching;

  • If an order was previously assigned to a courier and that order has entered the matching flow again, the couriers to which the order was previously assigned,
  • Couriers that the store or the customer does not want to carry their order,
  • Couriers located in the blackout areas where are defined to prevent the orders of stores in a certain area from matching with couriers in a certain area.

Apart from that, couriers are excluded from the matching flows for all orders in the following cases:

  • Couriers who do not check-in,
  • Couriers who have not sent location data for a certain period,
  • Couriers who are using a break.

Conclusion

As Trendyol GO Matching team, we briefly talked about the flow of finding a courier for an order. In matching flows, we make improvements to ensure that the order is delivered to the customer as soon as possible, taking into account the requests of the couriers. However, with the increasing number of orders, delivering orders to customers within the promised time becomes increasingly important for customer satisfaction, and realizing this requires new developments in both business and technical terms. We are developing new algorithms both deliver orders to customers quickly and to determine the most cost-effective courier for each order. While developing these algorithms, we work closely with Trendyol Optimization Team.

Since there are many orders on the system instantly, tracking every new matching algorithm is very important for both the technical and business sides. To ease this tracking, we export business metrics using Prometheus, and we make effective use of Grafana for monitoring and alarm identification.

We will give more detail about technical challenges in the next articles.

Thanks for reading!

--

--