Optaplanner的结果不可重现

时间:2018-12-02 23:48:13

标签: optaplanner

我已经从Optaplanner 7.5版迁移到7.10版。迁移时,我看到bulk(Output)不一样。再次运行时,我没有得到相同的输出。您能否分享迁移时我需要考虑的哪些必要步骤?你能帮我吗?

工作时间表也不同。屏幕截图如下:

主要区别在于运行1执行LS 11040,但同时运行2达到LS 11600 plus,并且环境和其他运行参数保持不变。

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 _run

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).

1 个答案:

答案 0 :(得分:0)

仅保证每个步骤索引的可重复性,而不保证时间(尽管它们是相关的)。使用终止时间(例如2分钟)时,无法保证OptaPlanner将占用多少CPU周期获取以及JVM将如何以及何时进行热点优化。在某些情况下,它实际上几乎没有获得CPU周期。在其他情况下,它会变得足够多-在任何情况下,OptaPlanner都会使用所获得的东西,没有浪费的东西。

从步骤索引级别看,两次运行完全相同(所花费的时间除外):

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个结果之间获得完全相同的结果,请使用步进限制终止