[Paper Review] Amazon Last-Mile Delivery Trajectory Prediction Using Hierarchical TSP with Customized Cost Matrix
This paper proposes a hierarchical TSP approach with a customized cost matrix to predict Amazon's last-mile delivery trajectories, first optimizing zone sequences and then intra-zonal stop sequences. The method improves routing accuracy by incorporating behavioral patterns—such as prioritizing high-volume packages and adjusting for service time distribution—achieving a test score of 0.0381 on 1,223 routes and 0.0375 on a held-out set.
In response to the Amazon Last-Mile Routing Challenge, Team Permission Denied proposes a hierarchical Travelling Salesman Problem (TSP) optimization with a customized cost matrix. The higher level TSP solves for the zone sequence while the lower level TSP solves the intra-zonal stop sequence. The cost matrix is modified to account for routing patterns beyond the shortest travel time. Lastly, some post-processing is done to edit the sequence to match commonly observed routing patterns, such as when travel times are similar, drivers usually start with stops with more packages than those with fewer packages. The model is tested on 1223 routes that are randomly selected out of the training set and the score is 0.0381. On the 13 routes in the given model apply set, the score was 0.0375.
Motivation & Objective
- To address the Amazon Last-Mile Routing Challenge by predicting driver delivery sequences with high similarity to observed routes.
- To reduce the complexity of large-scale TSP by decomposing the problem into zone-level and intra-zonal stop-level optimization.
- To improve TSP performance beyond shortest-path routing by incorporating non-distance factors such as package volume and service time distribution.
- To correct common reversal errors in TSP outputs using post-processing rules based on service time and package volume patterns.
- To develop a stable, non-trainable solution with generalizable hyperparameters that outperforms machine learning baselines under limited training data.
Proposed method
- Uses a hierarchical TSP framework: a high-level TSP optimizes zone sequences, followed by a low-level TSP for stop sequences within each zone.
- Customizes the TSP cost matrix to include non-distance factors such as travel time, package volume, and service time, improving performance by ~0.01 over baseline TSP.
- Applies post-processing rules to reverse sequences when the last 15% of stops have significantly higher average service time or package volume than the first 15%.
- Employs a threshold-based reversal check: reverse route if (p⁻/p⁺ ≥ 1.22) for service time or (v⁻/v⁺ ≥ 3) for package volume, with p=15% and θ=1.22, η=3.
- Performs sequence validity checks: ensures first stop is the delivery station and stop IDs match the ground truth; otherwise, defaults to zone-ID-sorted sequence.
- Uses Cython-optimized scoring for fast evaluation, reducing computation time to one-third of the original Python implementation.

Experimental results
Research questions
- RQ1Can a hierarchical TSP approach with a customized cost matrix outperform end-to-end machine learning models in predicting Amazon’s last-mile delivery sequences under limited training data?
- RQ2To what extent do behavioral routing patterns—such as prioritizing high-volume packages or serving business areas first—improve prediction accuracy when encoded in post-processing?
- RQ3How effective is post-processing in correcting reversal errors in TSP-generated sequences, especially when the first-zone prediction accuracy is low?
- RQ4Does the zone sequence have a dominant impact on the final score, and can it be reliably predicted to achieve high similarity to observed routes?
- RQ5Can non-distance factors like service time and package dimensions be effectively encoded in a TSP cost matrix to improve route similarity beyond shortest-path routing?
Key findings
- The hierarchical TSP with customized cost matrix achieved a test score of 0.0381 on 1,223 randomly selected routes from the training set.
- On the 13 routes in the model apply set, the score was 0.0375, indicating strong generalization and stability.
- Post-processing reduced the score from 0.0391 to 0.0381 on the test set, demonstrating its effectiveness in correcting reversal errors.
- Even with perfect zone sequence prediction, shuffling intra-zonal stops results in an average score of 0.0206, confirming that zone sequence is the dominant factor.
- The reversal correction rule based on service time (p⁻/p⁺ ≥ 1.22) and package volume (v⁻/v⁺ ≥ 3) significantly improved sequence quality.
- Despite extensive experimentation, machine learning models—including neural networks and seq2seq approaches—failed to outperform the TSP baseline due to limited training data (6k routes).

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.