Chaldal: Delivery and Routing Systems

Back to portfolio

Chaldal

June 2023 - August 2025

I worked as a Software Engineer (Level 2, then Level 3) in the Logistics and Dispatcher team at Chaldal (YC W15), Bangladesh's largest online grocery platform, based in Bangladesh and California. My main goal was to fully automate warehouse and routing operations. The system is distributed, with .NET (C#/F#) for the backend, React for the frontend and Python for algorithm and ML services, all running on our in-house infrastructure. I designed and built backend systems, researched and developed algorithms to optimize deliveries, and did some frontend work on the web and mobile apps.

Every Chaldal order goes through two systems: the Dispatcher, which assigns warehouse tasks to pickers who prepare the order, and Logistics, which plans routes for riders on cycles, bikes and vans, and keeps deliveries on time.

ASAP and 10-Minute Delivery

  • Goal: Regular orders are delivered in fixed time windows and typically take 2-3 hours. ASAP delivery offers customers a delivery window 20 or 40 minutes after they place the order, and 10-minute delivery goes further for customers near the warehouse.
  • My Contribution: I led the logistics (algorithms and backend) side of the project, and architected and launched Bangladesh's first 10-minute grocery delivery system.
  • Impact: ASAP delivery serves 1,000+ daily users with 20-45 minute fulfillment.
How ASAP delivery works

For regular orders, customers choose a fixed delivery window, e.g., 8-10 am or 4-6 pm, which usually starts at least 1 hour after the order is placed. ASAP orders can be served in two cases:

  1. An existing route has enough spare time that a new order fits into it without making the rest of the deliveries late.
  2. An idle rider can go and deliver the order.

To support both cases, our model has a concept called ASAPSocket. An ASAPSocket is calculated for every route leg (a segment of a route with fixed start and end locations, each either the hub or a shipment address). An ASAPSocket contains:

  • Slack time: The maximum time that can be spared for delivering an ASAP order within this route leg without making the next shipments late.
  • Slack capacity: The maximum weight and volume the ASAP shipment can have without overloading the route vehicle.
  • Areas: Polygons on the map covering the customer addresses this route leg can serve.
  • Delivery time: The estimated delivery time for an ASAP order whose address is inside these areas.

We also calculate ASAPSockets for idle riders. These are the areas around the hub where a rider can deliver an ASAP order after finishing one route and before starting another.

10-minute delivery is built on the same ASAP algorithm. Based on the warehouse's current order load, the system dynamically keeps some riders free and reserved for 10-minute orders. Customers within a set radius of the warehouse are offered 10-minute delivery when one of these riders is available and their order's weight is within the vehicle's limit.

Below are the ASAPSockets for the route legs of the sample routes shown in the Logistics Routing Algorithm section, and for an idle rider.

ASAP sockets for a cycle route
Fig 1: Cycle ASAPSockets
ASAP sockets for a bike route
Fig 2: Bike ASAPSockets
ASAP sockets for a van route
Fig 3: Van ASAPSockets
ASAPSocket for an idle rider
Fig 4: Idle Rider ASAPSocket

Each color is a different route leg. Fig 2 has no ASAPSocket because the bike route already has a late shipment. Fig 4 shows the ASAPSocket of an idle bike rider.

Logistics Routing Algorithm

  • Goal: Automatically group shipments into routes and assign them to riders. Routes used to be assigned manually by the dispatcher in charge, which did not scale as order volume grew.
  • My Contribution: I led the project, designed and implemented the algorithm, and integrated it with the existing backend system.
  • Impact: The routing system serves over 10,000 daily users and increased the on-time delivery rate from 67% to 82%.
How the routing algorithm works
  • Challenge: The problem is NP-Hard, and the number of possible routes grows exponentially with the number of shipments. Off-the-shelf solvers like Google OR-Tools and Gurobi Optimizer could not handle it, and some constraints specific to our business could not be modeled in them.
  • Algorithm: The algorithm takes all the shipments to be delivered (with their locations, time windows, weights and volumes), the time each rider will be available at the hub, and the available vehicles and their capacities. It outputs a list of routes, each an ordered list of shipments and the rider who will deliver them. The objective is to deliver shipments on time and minimize the total travel time of all riders. We used Clustering, TSP, Simulated Annealing, Tabu Search, and various neighbor-generating heuristics.
  • Backend: The backend calls the algorithm and tracks the state of shipments, riders, routes and vehicles as the deliveries happen.

Here is a simplified demonstration with dummy data. The images are from a simulation program we built to test and visualize the algorithm's results, and to simulate a full warehouse environment.

All shipments around the hub
Fig 5: All Shipments
Cycle route
Fig 6: Cycle Route
Bike route
Fig 7: Bike Route
Van route
Fig 8: Van Route

In Fig 5, there are 10 shipments shown in black and the warehouse/hub shown in blue. There are 3 vehicles available: a cycle, a bike, and a van. The next 3 images show the route for each vehicle. Shipment colors show whether a shipment is on time: yellow is early, green is on time, and red is late.

Dispatcher Automatic Task Assignment

  • Goal: Automatically assign picking tasks to pickers, who used to choose tasks themselves.
  • My Contribution: I designed and implemented the algorithm, integrated it with the existing backend system, and built the frontend changes in the Picking App that show the tasks to the pickers.
  • Impact: Dispatch reliability increased from 83% to 90%.
How the assignment algorithm works

The algorithm takes all the tasks that need to be picked and all the online pickers, including their location and when they will be free from their current task. It assigns tasks so that high-priority orders are dispatched first and picker movement is minimized, using a combination of greedy heuristics and a Min Cost Max Flow Matching algorithm.

Others

  • Traffic Estimation: We used the open-source routing engine Valhalla, built on OpenStreetMap data, to estimate travel distance and time between locations. Accurate estimates need the speed of every road segment at 5-minute intervals for each day of the week. A team collected these speeds manually from Google Maps, we polled the Google Maps API for traffic on important roads, and we interpolated the rest. I integrated and deployed the C++ Valhalla engine, along with our routing and warehouse task assignment algorithms, on bare-metal Linux servers, with load balancing for compute-intensive routing requests.
  • Dispatcher Task Duration Estimation: Trained a Machine Learning model on historical warehouse data that predicts how long a task will take from features such as the task type and the number and weight of products. The task assignment algorithm and the picker incentive system use these predictions.
  • Dispatcher Picker Incentive System: Developed an algorithm that scores each picker's daily performance by comparing the predicted duration of the tasks they completed with the predicted duration of all tasks that day. The score determines each picker's incentive.

Back to portfolio