Optaplanner 结果不可重现
Optaplanner result is not reproducible
我已经从 Optaplanner 版本 7.5 迁移到 7.10。在迁移时我看到 bulk(Output) 不一样。再次 运行ning 时,我没有得到相同的输出。您能否分享我在迁移时需要考虑哪些必要步骤?你能帮帮我吗?
工作计划也不一样。下面附上屏幕截图:
主要区别在于 运行 1 执行 LS 11040 但 运行 2 同时达到 LS 11600 加上环境和其他 运行 参数保持不变.
Job Schedule diffference
log1_run
11:35:06.421 [main ] INFO Solving started: time spent (225), best score (-1722init/0hard/0medium/0soft), environment mode (REPRODUCIBLE), random (JDK with seed 0).
11:35:06.682 [main ] DEBUG CH step (0), time spent (487), score (-1721init/0hard/0medium/-900000soft), selected move count (543), picked move (TimeWindowedCustomer-1 {null -> Vehicle-393}).
11:35:06.756 [main ] DEBUG CH step (1), time spent (561), score (-1720init/0hard/0medium/-1560000soft), selected move count (544), picked move (TimeWindowedCustomer-2 {null -> TimeWindowedCustomer-7}).
11:35:07.229 [main ] DEBUG CH step (2), time spent (1034), score (-1719init/0hard/0medium/-2520000soft), selected move count (545), picked move (TimeWindowedCustomer-3 {null -> Vehicle-396}).
11:35:07.266 [main ] DEBUG CH step (3), time spent (1071), score (-1718init/0hard/0medium/-3360000soft), selected move count (546), picked move (TimeWindowedCustomer-4 {null -> Vehicle-328}).
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
11:37:06.194 [main ] DEBUG LS step (11039), time spent (119999), score (0hard/-45187medium/-1556640000soft), best score (0hard/-45154medium/-1549560000soft), accepted/selected move count (1/3), picked move (TimeWindowedCustomer-1 {Vehicle-220} <-tailChainSwap-> TimeWindowedCustomer-8 {Vehicle-78}).
11:37:06.200 [main ] DEBUG LS step (11040), time spent (120005), score (-54512774442hard/-30651medium/-1659540000soft), best score (0hard/-45154medium/-1549560000soft), accepted/selected move count (0/1), picked move (TimeWindowedCustomer-12 {TimeWindowedCustomer-4} <-tailChainSwap-> null {TimeWindowedCustomer-16}).
11:37:06.203 [main ] INFO Local Search phase (1) ended: time spent (120008), best score (0hard/-45154medium/-1549560000soft), score calculation speed (5349/sec), step total (11041).
11:37:06.203 [main ] INFO Solving ended: time spent (120008), best score (0hard/-45154medium/-1549560000soft), score calculation speed (22645/sec), phase total (2), environment mode (REPRODUCIBLE).
log2_运行
11:38:29.684 [main ] INFO Solving started: time spent (213), best score (-1722init/0hard/0medium/0soft), environment mode (REPRODUCIBLE), random (JDK with seed 0).
11:38:29.955 [main ] DEBUG CH step (0), time spent (485), score (-1721init/0hard/0medium/-900000soft), selected move count (543), picked move (TimeWindowedCustomer-97041025 {null -> Vehicle-393}).
11:38:30.027 [main ] DEBUG CH step (1), time spent (557), score (-1720init/0hard/0medium/-1560000soft), selected move count (544), picked move (TimeWindowedCustomer-1 {null -> TimeWindowedCustomer-6}).
11:38:30.075 [main ] DEBUG CH step (2), time spent (605), score (-1719init/0hard/0medium/-2520000soft), selected move count (545), picked move (TimeWindowedCustomer-2 {null -> Vehicle-396}).
11:38:30.114 [main ] DEBUG CH step (3), time spent (644), score (-1718init/0hard/0medium/-3360000soft), selected move count (546), picked move (TimeWindowedCustomer-3 {null -> Vehicle-328}).
-------------------------------------------
--------------------------------------------
11:40:25.467 [main ] DEBUG LS step (11039), time spent (116004), score (0hard/-45187medium/-1556640000soft), best score (0hard/-45154medium/-1549560000soft), accepted/selected move count (1/3), picked move (TimeWindowedCustomer-1 {Vehicle-220} <-tailChainSwap-> TimeWindowedCustomer-8 {Vehicle-78}).
11:40:25.470 [main ] DEBUG LS step (11040), time spent (116011), score (0hard/-45187medium/-1556640000soft), best score (0hard/-45154medium/-1549560000soft), accepted/selected move count (0/1), picked move (TimeWindowedCustomer-12 {TimeWindowedCustomer-4} <-tailChainSwap-> null {TimeWindowedCustomer-16}).
--------------------------------------------
--------------------------------------------
11:40:29.474 [main ] DEBUG LS step (11674), time spent (120004), score (-4200029hard/-45093medium/-1554780000soft), best score (0hard/-45064medium/-1558380000soft), accepted/selected move count (0/1), picked move (TimeWindowedCustomer-9 {TimeWindowedCustomer-5 -> TimeWindowedCustomer-2}).
11:40:29.477 [main ] INFO Local Search phase (1) ended: time spent (120007), best score (0hard/-45064medium/-1558380000soft), score calculation speed (5451/sec), step total (11675).
11:40:29.477 [main ] INFO Solving ended: time spent (120007), best score (0hard/-45064medium/-1558380000soft), score calculation speed (22762/sec), phase total (2), environment mode (REPRODUCIBLE).
仅在每个步骤索引上保证可重复性,而不是在时间上(尽管它们是相关的)。当使用终止时间时,例如 2 分钟,无法保证如何OptaPlanner 将获得多少 CPU 个周期,以及 JVM 将如何以及何时进行热点优化。在某些情况下,它实际上可能几乎没有 CPU 个周期。在其他情况下,它会得到很多 - 在任何情况下,OptaPlanner 都会使用它得到的东西,不会浪费任何东西。
看step index级别,两次跑完全一样(除了耗时):
First run:
11:37:06.194 ...LS step (11039), time spent (119999), score (0hard/-45187medium/-1556640000soft), best score (0hard/-45154medium/-1549560000soft), accepted/selected move count (1/3), picked move (TimeWindowedCustomer-1 {Vehicle-220} <-tailChainSwap-> TimeWindowedCustomer-8 {Vehicle-78}).
Second run:
11:40:25.467 ...LS step (11039), time spent (116004), score (0hard/-45187medium/-1556640000soft), best score (0hard/-45154medium/-1549560000soft), accepted/selected move count (1/3), picked move (TimeWindowedCustomer-1 {Vehicle-220} <-tailChainSwap-> TimeWindowedCustomer-8 {Vehicle-78}).
要在 2 个结果之间获得完全相同的结果,改为使用步长限制终止。
我已经从 Optaplanner 版本 7.5 迁移到 7.10。在迁移时我看到 bulk(Output) 不一样。再次 运行ning 时,我没有得到相同的输出。您能否分享我在迁移时需要考虑哪些必要步骤?你能帮帮我吗?
工作计划也不一样。下面附上屏幕截图:
主要区别在于 运行 1 执行 LS 11040 但 运行 2 同时达到 LS 11600 加上环境和其他 运行 参数保持不变.
Job Schedule diffference
log1_run
11:35:06.421 [main ] INFO Solving started: time spent (225), best score (-1722init/0hard/0medium/0soft), environment mode (REPRODUCIBLE), random (JDK with seed 0).
11:35:06.682 [main ] DEBUG CH step (0), time spent (487), score (-1721init/0hard/0medium/-900000soft), selected move count (543), picked move (TimeWindowedCustomer-1 {null -> Vehicle-393}).
11:35:06.756 [main ] DEBUG CH step (1), time spent (561), score (-1720init/0hard/0medium/-1560000soft), selected move count (544), picked move (TimeWindowedCustomer-2 {null -> TimeWindowedCustomer-7}).
11:35:07.229 [main ] DEBUG CH step (2), time spent (1034), score (-1719init/0hard/0medium/-2520000soft), selected move count (545), picked move (TimeWindowedCustomer-3 {null -> Vehicle-396}).
11:35:07.266 [main ] DEBUG CH step (3), time spent (1071), score (-1718init/0hard/0medium/-3360000soft), selected move count (546), picked move (TimeWindowedCustomer-4 {null -> Vehicle-328}).
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
11:37:06.194 [main ] DEBUG LS step (11039), time spent (119999), score (0hard/-45187medium/-1556640000soft), best score (0hard/-45154medium/-1549560000soft), accepted/selected move count (1/3), picked move (TimeWindowedCustomer-1 {Vehicle-220} <-tailChainSwap-> TimeWindowedCustomer-8 {Vehicle-78}).
11:37:06.200 [main ] DEBUG LS step (11040), time spent (120005), score (-54512774442hard/-30651medium/-1659540000soft), best score (0hard/-45154medium/-1549560000soft), accepted/selected move count (0/1), picked move (TimeWindowedCustomer-12 {TimeWindowedCustomer-4} <-tailChainSwap-> null {TimeWindowedCustomer-16}).
11:37:06.203 [main ] INFO Local Search phase (1) ended: time spent (120008), best score (0hard/-45154medium/-1549560000soft), score calculation speed (5349/sec), step total (11041).
11:37:06.203 [main ] INFO Solving ended: time spent (120008), best score (0hard/-45154medium/-1549560000soft), score calculation speed (22645/sec), phase total (2), environment mode (REPRODUCIBLE).
log2_运行
11:38:29.684 [main ] INFO Solving started: time spent (213), best score (-1722init/0hard/0medium/0soft), environment mode (REPRODUCIBLE), random (JDK with seed 0).
11:38:29.955 [main ] DEBUG CH step (0), time spent (485), score (-1721init/0hard/0medium/-900000soft), selected move count (543), picked move (TimeWindowedCustomer-97041025 {null -> Vehicle-393}).
11:38:30.027 [main ] DEBUG CH step (1), time spent (557), score (-1720init/0hard/0medium/-1560000soft), selected move count (544), picked move (TimeWindowedCustomer-1 {null -> TimeWindowedCustomer-6}).
11:38:30.075 [main ] DEBUG CH step (2), time spent (605), score (-1719init/0hard/0medium/-2520000soft), selected move count (545), picked move (TimeWindowedCustomer-2 {null -> Vehicle-396}).
11:38:30.114 [main ] DEBUG CH step (3), time spent (644), score (-1718init/0hard/0medium/-3360000soft), selected move count (546), picked move (TimeWindowedCustomer-3 {null -> Vehicle-328}).
-------------------------------------------
--------------------------------------------
11:40:25.467 [main ] DEBUG LS step (11039), time spent (116004), score (0hard/-45187medium/-1556640000soft), best score (0hard/-45154medium/-1549560000soft), accepted/selected move count (1/3), picked move (TimeWindowedCustomer-1 {Vehicle-220} <-tailChainSwap-> TimeWindowedCustomer-8 {Vehicle-78}).
11:40:25.470 [main ] DEBUG LS step (11040), time spent (116011), score (0hard/-45187medium/-1556640000soft), best score (0hard/-45154medium/-1549560000soft), accepted/selected move count (0/1), picked move (TimeWindowedCustomer-12 {TimeWindowedCustomer-4} <-tailChainSwap-> null {TimeWindowedCustomer-16}).
--------------------------------------------
--------------------------------------------
11:40:29.474 [main ] DEBUG LS step (11674), time spent (120004), score (-4200029hard/-45093medium/-1554780000soft), best score (0hard/-45064medium/-1558380000soft), accepted/selected move count (0/1), picked move (TimeWindowedCustomer-9 {TimeWindowedCustomer-5 -> TimeWindowedCustomer-2}).
11:40:29.477 [main ] INFO Local Search phase (1) ended: time spent (120007), best score (0hard/-45064medium/-1558380000soft), score calculation speed (5451/sec), step total (11675).
11:40:29.477 [main ] INFO Solving ended: time spent (120007), best score (0hard/-45064medium/-1558380000soft), score calculation speed (22762/sec), phase total (2), environment mode (REPRODUCIBLE).
仅在每个步骤索引上保证可重复性,而不是在时间上(尽管它们是相关的)。当使用终止时间时,例如 2 分钟,无法保证如何OptaPlanner 将获得多少 CPU 个周期,以及 JVM 将如何以及何时进行热点优化。在某些情况下,它实际上可能几乎没有 CPU 个周期。在其他情况下,它会得到很多 - 在任何情况下,OptaPlanner 都会使用它得到的东西,不会浪费任何东西。
看step index级别,两次跑完全一样(除了耗时):
First run:
11:37:06.194 ...LS step (11039), time spent (119999), score (0hard/-45187medium/-1556640000soft), best score (0hard/-45154medium/-1549560000soft), accepted/selected move count (1/3), picked move (TimeWindowedCustomer-1 {Vehicle-220} <-tailChainSwap-> TimeWindowedCustomer-8 {Vehicle-78}).
Second run:
11:40:25.467 ...LS step (11039), time spent (116004), score (0hard/-45187medium/-1556640000soft), best score (0hard/-45154medium/-1549560000soft), accepted/selected move count (1/3), picked move (TimeWindowedCustomer-1 {Vehicle-220} <-tailChainSwap-> TimeWindowedCustomer-8 {Vehicle-78}).
要在 2 个结果之间获得完全相同的结果,改为使用步长限制终止。