live Life
live Life

Reputation: 13

Optaplanner result is not reproducible

I have migrated from Optaplanner version 7.5 to 7.10. While migration I saw bulk(Output) is not the same. While running for another time I am not getting the same output. Can you share which are necessary steps I need to consider while migration? Can you help me out?

The Job schedule is different too. Screenshot attached below:

The primary difference is for Run 1 executes LS 11040 but Run 2 for the same time gets to reach LS 11600 plus with environment and other run parameters maintained without being changed.

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

Upvotes: 0

Views: 167

Answers (1)

Geoffrey De Smet
Geoffrey De Smet

Reputation: 27357

Reproducibility is only guaranteed on each step index, not on time (although they are correlated). When using time spent termination, for example 2 minutes, there is no guarantee how much CPU cycles OptaPlanner will get and how and when the JVM will hotspot optimize. In some situations, it might actually get almost no CPU cycles. In other situations it gets plenty - in any case OptaPlanner uses what it gets, nothing goes to waste.

Looking at the step index level, the two runs are exactly the same (except for the time spent):

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

To get the exact same result between 2 results, use a step limit termination instead.

Upvotes: 1

Related Questions