【问题标题】:VRPTW Optaplanner using Partitioned SearchVRPTW Optaplanner 使用分区搜索
【发布时间】:2020-12-17 16:17:56
【问题描述】:

我已经在 VRP 问题中实现了分区搜索,并且效果很好。然后我尝试实现 VRPTW 问题。在初始化过程之后,previousStandstill 的到达时间有时为 null,并在 ArrivalTimeUpdatingVariableListener.java 中导致错误,特别是在调用 .getDepartureTime() 时。

Long departureTime = previousStandstill == null ? null
                : (previousStandstill instanceof TimeWindowedCustomer)
                        ? ((TimeWindowedCustomer) previousStandstill).getDepartureTime()
                        : ((TimeWindowedDepot) ((Vehicle) previousStandstill).getDepot()).getReadyTime();
15:34:47.101 [PartThread-2] DEBUG             CH step (197), time spent (8548), score (-2init/0hard/-8026964soft), selected move count (247), picked move (TimeWindowedCustomer-350 {null -> TimeWindowedCustomer-222}).
15:34:47.106 [PartThread-1] INFO          Construction Heuristic phase (0) ended: time spent (8552), best score (0hard/-8128814soft), score calculation speed (9281/sec), step total (200).
15:34:47.146 [PartThread-2] DEBUG             CH step (198), time spent (8593), score (-1init/0hard/-8124288soft), selected move count (248), picked move (TimeWindowedCustomer-164 {null -> Vehicle-51}).
15:34:47.200 [PartThread-2] DEBUG             CH step (199), time spent (8647), score (0hard/-8138330soft), selected move count (249), picked move (TimeWindowedCustomer-72 {null -> TimeWindowedCustomer-270}).
15:34:47.203 [PartThread-2] INFO          Construction Heuristic phase (0) ended: time spent (8650), best score (0hard/-8138330soft), score calculation speed (9196/sec), step total (200).
previousStandstill arrivalTime is null
previousStandstill arrivalTime is null
previousStandstill arrivalTime is null
previousStandstill arrivalTime is null
previousStandstill arrivalTime is null
previousStandstill arrivalTime is null
previousStandstill arrivalTime is null
previousStandstill arrivalTime is null
previousStandstill arrivalTime is null

有人遇到过和我一样的问题吗?感谢您的帮助。

【问题讨论】:

    标签: java optaplanner


    【解决方案1】:

    影子变量应该与输入/输出模型的真实变量同步。

    例如,如果 C = A + 5 且 A 为 10,则 C 应为 15。如果 A 为 200,则 C 应为 205。如果 A 为空,则 C 应为空。

    尝试开启 enviromnentMode FULL_ASSERT,它会验证输入数据是否符合此要求。

    【讨论】:

    • 你也可能非常喜欢这个问题:issues.redhat.com/browse/PLANNER-1316
    • 感谢您的帮助。在我追踪错误后,似乎某些车辆链未能启动到达时间。所以,在那个链条中,所有的顾客都没有到达时间。然后我创建了计算算法来计算该客户的到达时间。你怎么看?可以吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多