You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

HERE Tour Planning API多日取派任务时间窗报错排查

HERE Tour Planning API跨日取派规划报错修复

问题背景

  • 业务目标:基于HERE Tour Planning API实现多日作业路径规划,要求第1天完成货物取件,第2天完成对应货物派送
  • 车队配置:共配置2个独立作业班次,各班次服务时间均为当日9:00-18:00
  • 异常表现:仅传入取件任务时API可正常返回响应;同时传入取件、派送任务,或将取派配置在同一作业下时,API返回错误:Job cannot be served within vehicle time window(作业无法在车辆时间窗内被服务)
  • 当前进度:仅完成1组取件+派送的最小场景测试,最终需实现跨多日的批量作业路径优化

根因分析

报错核心是plan.relations下的序列约束配置错误:

  • 当前配置的type: "sequence"约束,会强制列表内所有节点(班次出发、取件作业、派件作业、班次返回场站)必须在同一个车辆班次内连续完成,不支持跨班次拆分执行
  • 配置中取件作业的服务时间窗在1月5日第一班次,派件作业的服务时间窗在1月6日第二班次,两个作业分属不同班次,被强制要求放在同一连续班次执行时,无法匹配任何一个班次的时间范围,直接触发报错
  • 额外说明:序列中使用的departure、arrival节点是单班次的起止标识,本身就不支持跨班次串联

修复方案

  1. 删除原有错误的跨班次sequence配置

    HERE API默认就会满足「取件作业早于对应派件作业执行、车辆装载容量匹配」的基础逻辑,无特殊要求不需要额外加序列约束

  2. 如果需要强制指定同一台车完成该组取派、且保证取件先于派件执行,将原有sequence关系替换为precedence类型的先后约束(仅限制作业执行顺序,不要求在同一班次连续完成),配置示例如下:
    "relations":[
       {
          "type":"precedence",
          "jobs":[
             "43ef69fd-98ee-4530-acbb-ec774a9d4769",
             "ed3439b4-270f-488b-8323-5e0109e0d974"
          ],
          "vehicleId":"09c77738-1dba-42f1-b00e-eb63da7147d6_1"
       }
    ]
    
  3. 后续批量多日作业规划注意:仅对必须在同一班次内连续完成的作业(如同一个客户的同步取派)使用sequence约束,跨班次的作业先后依赖统一使用precedence约束即可。

原始请求配置

{
   "configuration":{
      "termination":{
         "maxTime":30,
         "stagnationTime":5
      }
   },
   "fleet":{
      "types":[
         {
            "id":"09c77738-1dba-42f1-b00e-eb63da7147d6",
            "profile":"normal_car",
            "costs":{
               "fixed":22.0,
               "distance":1.0E-4,
               "time":0.0048
            },
            "shifts":[
               {
                  "start":{
                     "time":"2021-01-05T09:00:00Z",
                     "location":{
                        "lat":44.492717,
                        "lng":11.346402
                     }
                  },
                  "end":{
                     "time":"2021-01-05T18:00:00Z",
                     "location":{
                        "lat":44.492717,
                        "lng":11.346402
                     }
                  },
                  "breaks":[
                     {
                        "times":[
                           [
                              "2021-01-05T11:00:00Z",
                              "2021-01-05T13:00:00Z"
                           ]
                        ],
                        "duration":1800
                     }
                  ]
               },
               {
                  "start":{
                     "time":"2021-01-06T09:00:00Z",
                     "location":{
                        "lat":44.492717,
                        "lng":11.346402
                     }
                  },
                  "end":{
                     "time":"2021-01-06T18:00:00Z",
                     "location":{
                        "lat":44.492717,
                        "lng":11.346402
                     }
                  },
                  "breaks":[
                     {
                        "times":[
                           [
                              "2021-01-06T11:00:00Z",
                              "2021-01-06T13:00:00Z"
                           ]
                        ],
                        "duration":1800
                     }
                  ]
               }
            ],
            "capacity":[
               100,
               5
            ],
            "skills":[
               "GRU"
            ],
            "limits":{
               "maxDistance":100000.0,
               "shiftTime":28800.0
            },
            "amount":1
         }
      ],
      "profiles":[
         {
            "type":"car",
            "name":"normal_car"
         }
      ],
      "traffic":"liveOrHistorical"
   },
   "plan":{
      "jobs":[
         {
            "id":"43ef69fd-98ee-4530-acbb-ec774a9d4769",
            "tasks":{
               "pickups":[
                  {
                     "places":[
                        {
                           "location":{
                              "lat":44.492717,
                              "lng":11.346402
                           },
                           "duration":180,
                           "times":[
                              [
                                 "2021-01-05T10:00:00Z",
                                 "2021-01-05T17:00:00Z"
                              ]
                           ]
                        }
                     ],
                     "demand":[
                        2
                     ]
                  }
               ]
            },
            "skills":[
               "GRU"
            ],
            "priority":2,
            "customerId":"012021010408302512_"
         },
         {
            "id":"ed3439b4-270f-488b-8323-5e0109e0d974",
            "tasks":{
               "deliveries":[
                  {
                     "places":[
                        {
                           "location":{
                              "lat":44.361081,
                              "lng":11.709962
                           },
                           "duration":180,
                           "times":[
                              [
                                 "2021-01-06T10:00:00Z",
                                 "2021-01-06T17:00:00Z"
                              ]
                           ]
                        }
                     ],
                     "demand":[
                        2
                     ]
                  }
               ]
            },
            "skills":[
               "GRU"
            ],
            "priority":2,
            "customerId":"012021010408302512_"
         }
      ],
      "relations":[
         {
            "type":"sequence",
            "jobs":[
               "departure",
               "43ef69fd-98ee-4530-acbb-ec774a9d4769",
               "ed3439b4-270f-488b-8323-5e0109e0d974",
               "arrival"
            ],
            "vehicleId":"09c77738-1dba-42f1-b00e-eb63da7147d6_1"
         }
      ],
      "clustering":{
         "serviceTimeStrategy":{
            "type":"fixedDurationStrategy",
            "duration":3600
         }
      }
   }
}

内容的提问来源于stack exchange,提问作者Luca Nitti

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.29 11:15:18