CVRPTW,即使有未使用的车辆,硬约束也会被打破

CVRPTW, hard constraints is broken even when there is unused vehicles

我正在尝试在我的项目中使用 optaplanner VRP,但我仍然坚持使用以下方法。

01:39:30.070 [main        ] DEBUG     CH step (3), time spent (807), score (-29init/-351hard/-25749soft), selected move count (36), picked move ( latitude=42.892975, longitude=-78.877032}, demand=100.3} {TimedWindowedVehicle{Weight=350/ null, Volume=16 /null , Orders =0}}).
01:39:30.172 [main        ] DEBUG     CH step (4), time spent (909), score (-28init/-652hard/-31285soft), selected move count (37), picked move ( latitude=42.885502, longitude=-78.785842}, demand=300.8} {TimedWindowedVehicle{Weight=350/ null, Volume=16 /null , Orders =0}}).
01:39:30.259 [main        ] DEBUG     CH step (5), time spent (996), score (-27init/-654hard/-35321soft), selected move count (38), picked move (latitude=42.917089, longitude=-78.857812}, demand=2.09} {   latitude=42.892975, longitude=-78.877032}, demand=100.3}}).
01:39:30.352 [main        ] DEBUG     CH step (6), time spent (1089), score (-26init/-656hard/-38788soft), selected move count (39), picked move ( latitude=42.85082, longitude=-78.802339}, demand=1.65} { latitude=42.885502, longitude=-78.785842}, demand=300.8}}).
01:39:30.431 [main        ] DEBUG     CH step (7), time spent (1168), score (-25init/-658hard/-40532soft), selected move count (40), picked move (latitude=42.907763, longitude=-78.792994}, demand=2.05} {null -> TimedWindowedVehicle{Weight=350/ null, Volume=16 /null , Orders =0}}).

在我的解决方案中,车辆列表中有 50 辆车。但是,当我 运行 时,示例 Optaplaaner 打破了车辆容量的硬性限制,只使用了 4 辆车,而解决方案中还有其他未使用的车辆。只是想知道我是否遗漏了什么。

得分为 -25init/-658hard/-40532soft,其中包含 -25init,这意味着构造启发式尚未完成(仅 1168 毫秒后,不足为奇)并且有 25 次访问未分配。 这并不能解释为什么它打破了 658 个硬约束,但你说有未分配的车辆。

首先 运行 System.out.println(scoreManager.create(solverFactory).getSummary(yourSolution)); 找出哪些硬约束被打破以及被哪些实体打破。

其次,假设访问 A 距离最近的站点有 3 小时的车程,站点在 8:00 开放并且 A 的 dueTime 是 10:00(并且 readyTime 9:00,所以时间 window 从 9 点到 10 点)。不管可用的车辆有多少,是否可以不打破硬约束?