五年前,同一天的交付感觉像是奢侈品,今天,这是一个基准预期。大技术 - 以及它引发的机器学习蓬勃发展 - 悄悄地重新连接了消费者习惯:等到明天不再是一个选择市场继续以双位数的速度扩张,几乎每一次效率的跳跃现在来自ML模型,这些模型混淆了需求,路由和定价。 想象一个销售季节最繁忙的一天。快递(“在30至45分钟内”)已经依赖于经过测试的算法:额外费用随着需求,流量和天气的飙升而上升和下降。 矛盾的是,无论是亚马逊还是Uber都没有发布一个端到端的方法来定价这些推迟交付窗口 - 即使他们拥有最富有的利润率。 在整个交付市场中,动态定价是基本的市场要求,但大多数公共文章都专注于实时供需平衡(如飙升或“忙碌”的费用)。 它价格的交付窗口不同,以改变需求,而Uber吃 一个忙碌的区域费用,当订单超过快递供应。 admits 文件 admits 文件 对于推迟的同一天窗户,零售商会发出信号,即灵活性更便宜,但没有人透露数学实际上是如何工作的。 特斯科跑步 价格因邮政代码、日期和时间窗口而异,Ocado将交货费链接到 亚马逊提供的 (免费的日程整合)而历史上 Prime Now 免费 2 小时 vs. 付费 1 小时 节省斯洛特 Flexi-saver slot availability 亚马逊日 跑步 节省斯洛特 Flexi-saver slot availability 亚马逊日 跑步 它清楚地表明,更长的窗户有利于零售商,但市场仍然缺乏一个端到端的解决方案,将批量效率和快递时间的节省转化为客户实际看到的折扣。 这就是这部作品解决的差距:将同一天窗口的宽度与预测的供应时间节省联系起来,并将其转化为一个清晰、公平的价格信号。 This article distils the key ideas behind a solution I built to address the problem. The goal is to outline the framework, not describe any one company’s system. The approach links delivery-window width to the expected Supply Hour Economy (SH economy) and turns it into a price signal that’s fair for shoppers, couriers, and the platform. I’m sharing my approach to give ML engineers and last-mile delivery practitioners a concrete reference point — something practical to help move the field forward faster. Batching as a Key to Efficiency 打包作为效率的关键 在高层次上,市场有两个核心组成部分: 需求 - 由用户实时创建的交付请求。 供应 - 满足这些请求的邮递员。 在最简单的情况下,每个快递员一次只携带一个订单,但在高峰期,需求往往远远超过供应,许多订单在短时间内到达,因此必须更有效地执行任务(见图1)。 但是“效率”真正意味着什么?它取决于我们如何定义它,在这里,效率是完成的交货时间的数目,以可用的快递时间的数目分割: 如何提高效率?有很多策略,但其中最重要的是: . 批量意味着邮递员在一个运行中交付多个订单. 该系统属性显著提高了效率。 batching Understanding Batching Delivery Logic 了解交付逻辑 让我们走过一个简单的例子:假设我们有两个交付请求. 每个请求可以被表示为一对点:点A(接送)和点B(放弃)。 对于每个请求,可以估计需求时间 - 从A到B旅行所需的时间,根据交通,天气和其他条件。 我们的选择是什么? 一个方法是为每个请求分配一个单独的快递员,在这种情况下,需要快递员的时间来完成实际交付(A到B)和交付。 — 快递员到达A点所需的时间. 这是有效的,但并不高效。 approach time 现在考虑一些更聪明的东西:分配一个快递员服务 例如,快递员首先前往第二个请求的A点,接收它,然后到第一个请求的退出点,交付它,最后交付第二个请求。 both orders 在这种情况下,快递员遵循右侧显示的绿色路线。 和 组件 - 以及上一节的效率公式 - 我们可以计算批量效率。 demand supply 直觉现在应该是清晰的: batching is a powerful lever for improving efficiency. SH Economy as the Principal Metric SH经济作为主要指标 但是,最好不要使用整体效率指标来评估批量质量,效率受众多外部因素的影响,因此只取决于批量性能的测量是优先的。 快递时间的节约 - 或SH经济(供应小时经济) - 服务于这个目的,捕捉了由于批量而导致的供应时间的减少。 A batch is a set of orders delivered simultaneously. SH economy is defined as the difference between the courier time required if the orders were handled independently and the time actually spent when the courier delivers the entire batch, expressed in relative form: 通过独立交付总量的正常化产生了一个无尺寸的比率,可以在任何尺寸或地理位置的批量中轻松比较。 Returning to the earlier two-order example: 快递时间33分钟 Independent deliveries: 26分钟 Batched route: An indicates a 纯粹是通过包装来实现的。 不会受到更广泛的交付网络的外部波动的影响。 SH economy of 0.21 21% reduction in supply hours a clean, batch-specific indicator, Increasing Batching Efficiency with Flexible-Window Delivery 通过灵活的窗口交付提高批量效率 当快递服务被灵活窗口交付补充时,批量效率提高。 , which minimizes customer wait time — but gives the platform no time to find batching opportunities. immediate courier assignment 相比之下, 无论是30分钟,两小时,或任何其他同一天间隔 - 延长交货时间范围,并允许请求短时间留在队列中。 a flexible window 游泳池越大 the higher the probability of successful batching. This leads to fewer supply hours, better use of courier time, and ultimately — a lower price for the customer. pairable requests, In practice, wider delivery windows expand the pool of pairable requests, raising batching probability and, in turn, the SH economy. Pricing Flexible-Window Delivery Pricing Flexible-Window Delivery 设置灵活窗口交货的公平价格是关键的产品挑战。 Most marketplaces already operate 在这种系统中,即便是 它可以被描述为两个倍增组件: a dynamic pricing engine the cost per order (CPO) 动态基价,它已经考虑到实时信号,如需求峰值,快递服务的可用性,流量,天气和其他运营因素。 CPO_base 配送窗口的宽度相关的折扣因子.随着间隔的扩大,此组件降低了最终价格,以反映通过批量实现的快递时间节省。 CPO_economy(window_width) The core task is to learn the CPO_economy(window_width) function — while keeping the existing CPO_base(·) untouched, since the express delivery pricing is already working as intended. Quick Example 快速示例 让我们走过一个简单的计算。 假设一分钟的快递时间费用为0.20 美元,独立交付两份订单需要33分钟,因此每份订单的成本是: **==33 × $0.20 = $6.60==** 现在,如果一个更广泛的交付窗口允许两份订单,邮递时间将下降到26分钟,降低成本到: **==26 × $0.20 = $5.20==** The SH economy in this case is: **==(33 − 26) / 33 ≈ 0.21==** This results in a 21% reduction in supply hours — and the customer pays roughly 21% less. Thus, 衡量SH经济的价值。 pricing flexible-window options reduces to an analytical problem: 由于价格必须向客户显示 对于同一天交付的多个窗口, — they need to be up front, the courier-time savings can’t be calculated after the fact predicted in advance. From Baseline to ML-Based SH Economy Forecasts From Baseline to ML-Based SH Economy Forecasts A natural starting point is a constant forecast: use the historical 作为每个请求的预测节约。这个基线是弱的。 两边,一边,一边,一边,一边。 来自低密度区域的订单,这些订单永远无法批量。 average the SH economy heavy tails zero 依靠单一的平均值忽略了这些模式,并在桌子上留下了钱。 Why ML is Needed Why ML is Needed Improving prediction quality requires an ML-based forecast. But introducing machine learning into pricing isn't trivial: any predicted discount becomes 显示给客户在支票时. 这意味着模型必须平衡 with across all customer segments. a real commitment predictive power high reliability 通常在构建这样的系统时出现。 Three key challenges Defining the target 第一個和最明顯的問題是: 模型应该学到什么来预测? 考虑SH经济公式,它比较了两个量: 独立交付:如果每批次订单由单独的邮递员处理,会花费多少个邮递分钟? 包装交付:当这些订单在一批中交付时,实际上花了多少分钟? 第二个值来自真实的日志(有一些清理)。 The first is counterfactual — 所以它必须是 it never happened, forecast. Even in a simple example, solo delivery includes: 接近接收点的时间, B、旅行时间 在生产中:在接收时等待时间、手续时间、排队时间等。 这些元素中的每一个都是单独的预测 - 每个预测都可以偏见。 因此,该 符合历史数据中观察到的平均值。 bias-corrected predicted solo time Where: Sheconomy(批) — 发生在现实中 SH(order i) — forecasts SH(批) - 現實 另一个困难是价格已经完成。 但是SH经济被定义为 So we need to A naive split by demand hours isn't ideal — because not distance. In practice, we allocate SH economy 模型刚刚预测的数量。 per order, per batch. allocate the economy across orders. customers pay for courier time, proportionally to predicted supply hours per order This transformation creates the final per-order training target, which aggregates back to the true batch-level SH economy after delivery. Volatility & drift 第二个障碍是目标的自然波动性. 当平均SH经济在较长的时间内被划定时,曲线除了静止之外:在12月(假日)出现突然的下滑,更广泛的季节性波浪标志着夏季早期和年底的峰值。 To stabilise the predictions, the feature set is split into two. Content features depend only on the offer itself: the chosen delivery window, time of day, day of week, and geography. Weekend request patterns differ sharply from weekdays, and order density in a big city is unlike that in a smaller million-plus city, so these categorical signals absorb recurring seasonality. 补充它们是描述市场当前状况的统计特征:需求和供给的滚动密度,以及精心设计的目标类似特征 - 最近SH经济的短期平均值。后者特别具有信息性,但必须慎重处理;否则,模型可能会泄露未来的信息。 “内容”功能 – 仅依赖于报价本身 chosen delivery window time of day/day of week geography “Statistical” features – describe the current marketplace state rolling demand density 滚动供给密度 carefully lagged target-like features (recent averages of the SH economy) Feedback loops left uncontrolled 该模型自己的预测重新塑造了它被要求预测的目标。提高预期的SH经济,并显示的灵活窗口交货价格下降。较低的价格说服更多客户选择较慢的选择,这反过来增加了批量并提高了实际的SH经济。 复杂的手工修复模型可以试图减去这种自我影响,但任何固定的公式很快就会变得不准确。 Models are refreshed on the latest data at short, regular intervals, letting them absorb the shifting mix of slow-window orders. Continuous retraining: 如果预测分布没有移动太多,部署只决定在离线指标上;如果转移大,在部署之前运行一个完整的在线A/B测试。 这个周期使定价系统保持稳定,即使客户行为 - 因此SH经济目标 - 不断演变。 Conclusion 结论 同一天的最后一英里交付不能通过推送快递或调整波速倍增器来优化。 batching. Once delivery windows were linked to the expected — 一批释放的相对邮递时间节省 — forecast SH economy for every offer and translate that saving into a fair discount. Supply-Hour Economy (SH economy) dynamic pricing became a machine learning problem: Three technical hurdles shaped the solution: Predict the solo courier minutes for each request, then allocate the future batch’s savings back to its orders in proportion to those minutes. Turn a batch metric into an order target. Absorb seasonality and daily shocks with a two-tier feature set: stable content-based signals (window length, time, geography) and rolling marketplace statistics (demand, supply, lagged SH economy). Stabilise a volatile target. Continuous retraining keeps the model aligned with the behaviors it creates, while distribution guardrails trigger A/B testing when predictions drift. Control the feedback loop. Two more layers — and — work behind the scenes to keep the system stable and trustworthy in production. robust experimentation the dynamic strategies of large shippers Public, end-to-end cases of flexible-window pricing remain rare. Sharing real-world lessons helps the industry move faster toward tomorrow’s customers will take for granted. the friction-free, on-demand marketplaces