Как сделать так, чтобы этап эвристики построения назначал все объекты при чрезмерно ограниченном планировании?

#optaplanner

Вопрос:

Как говорится в названии. Я разработчик, новичок в optaplanner. До того, как я переключился на чрезмерно напряженное планирование, фаза CH работала правильно: здесь CH назначает 21 объект, как и ожидалось, и я смог найти оптимальное решение (игнорируйте средний уровень баллов).:

 2021-10-01 12:26:07,933 [main] INFO  Solving started: time spent (3221), best score (-21init/0hard/0medium/0soft), environment mode (REPRODUCIBLE), move thread count (NONE), random (JDK with seed 0).
2021-10-01 12:26:10,664 [main] DEBUG     CH step (0), time spent (5955), score (-20init/0hard/0medium/-130soft), selected move count (21120), picked move (optaplanner.domain.Allocation@7c51782d {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=47, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:12,924 [main] DEBUG     CH step (1), time spent (8215), score (-19init/-1hard/0medium/-3025soft), selected move count (21120), picked move (optaplanner.domain.Allocation@77bc2e16 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=45, availability=2021-10-07T14:00-2021-10-07T22:00}}).
2021-10-01 12:26:14,137 [main] DEBUG     CH step (2), time spent (9428), score (-18init/-3hard/0medium/-3025soft), selected move count (21120), picked move (optaplanner.domain.Allocation@48e8c32a {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@50915d5, index=0, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:15,293 [main] DEBUG     CH step (3), time spent (10584), score (-17init/-3hard/0medium/-3164soft), selected move count (21120), picked move (optaplanner.domain.Allocation@20a7953c {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=46, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:16,027 [main] DEBUG     CH step (4), time spent (11318), score (-16init/-4hard/0medium/-6098soft), selected move count (21120), picked move (optaplanner.domain.Allocation@57c00115 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=42, availability=2021-10-07T14:00-2021-10-07T22:00}}).
2021-10-01 12:26:16,654 [main] DEBUG     CH step (5), time spent (11945), score (-15init/-6hard/0medium/-6098soft), selected move count (21120), picked move (optaplanner.domain.Allocation@411a5965 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@50915d5, index=45, availability=2021-10-07T14:00-2021-10-07T22:00}}).
2021-10-01 12:26:17,267 [main] DEBUG     CH step (6), time spent (12558), score (-14init/-6hard/0medium/-6247soft), selected move count (21120), picked move (optaplanner.domain.Allocation@4fe533ff {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=45, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:17,850 [main] DEBUG     CH step (7), time spent (13141), score (-13init/-7hard/0medium/-9221soft), selected move count (21120), picked move (optaplanner.domain.Allocation@5377414a {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=39, availability=2021-10-07T14:00-2021-10-07T22:00}}).
2021-10-01 12:26:18,541 [main] DEBUG     CH step (8), time spent (13832), score (-12init/-9hard/0medium/-9221soft), selected move count (21120), picked move (optaplanner.domain.Allocation@4e83a98 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@50915d5, index=42, availability=2021-10-07T14:00-2021-10-07T22:00}}).
2021-10-01 12:26:19,182 [main] DEBUG     CH step (9), time spent (14473), score (-11init/-9hard/0medium/-9380soft), selected move count (21120), picked move (optaplanner.domain.Allocation@17aa8a11 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=44, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:19,758 [main] DEBUG     CH step (10), time spent (15049), score (-10init/-10hard/0medium/-9416soft), selected move count (21120), picked move (optaplanner.domain.Allocation@71b639d0 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=45, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:20,332 [main] DEBUG     CH step (11), time spent (15623), score (-9init/-12hard/0medium/-12250soft), selected move count (21120), picked move (optaplanner.domain.Allocation@18a25bbd {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@63661fc7, index=45, availability=2021-10-07T14:00-2021-10-07T22:00}}).
2021-10-01 12:26:20,939 [main] DEBUG     CH step (12), time spent (16230), score (-8init/-12hard/0medium/-12419soft), selected move count (21120), picked move (optaplanner.domain.Allocation@5d5b9ecb {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=43, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:21,499 [main] DEBUG     CH step (13), time spent (16790), score (-7init/-13hard/0medium/-15413soft), selected move count (21120), picked move (optaplanner.domain.Allocation@1ee27d73 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=36, availability=2021-10-07T14:00-2021-10-07T22:00}}).
2021-10-01 12:26:22,085 [main] DEBUG     CH step (14), time spent (17376), score (-6init/-14hard/0medium/-15449soft), selected move count (21120), picked move (optaplanner.domain.Allocation@5e5aafc6 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@50915d5, index=44, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:22,669 [main] DEBUG     CH step (15), time spent (17960), score (-5init/-14hard/0medium/-15628soft), selected move count (21120), picked move (optaplanner.domain.Allocation@542f6803 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=42, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:23,253 [main] DEBUG     CH step (16), time spent (18544), score (-4init/-15hard/0medium/-18662soft), selected move count (21120), picked move (optaplanner.domain.Allocation@5583098b {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=33, availability=2021-10-07T14:00-2021-10-07T22:00}}).
2021-10-01 12:26:23,833 [main] DEBUG     CH step (17), time spent (19124), score (-3init/-16hard/0medium/-18698soft), selected move count (21120), picked move (optaplanner.domain.Allocation@5807efad {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@63661fc7, index=43, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:24,427 [main] DEBUG     CH step (18), time spent (19718), score (-2init/-16hard/0medium/-18887soft), selected move count (21120), picked move (optaplanner.domain.Allocation@53a84ff4 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=41, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:25,010 [main] DEBUG     CH step (19), time spent (20301), score (-1init/-17hard/0medium/-18923soft), selected move count (21120), picked move (optaplanner.domain.Allocation@7ce85af2 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=42, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:25,660 [main] DEBUG     CH step (20), time spent (20951), score (-19hard/0medium/-18953soft), selected move count (21120), picked move (optaplanner.domain.Allocation@316acbb5 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@65130cf2, index=45, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:26:25,662 [main] INFO  Construction Heuristic phase (0) ended: time spent (20953), best score (-19hard/0medium/-18953soft), score calculation speed (25027/sec), step total (21).
2021-10-01 12:26:25,961 [main] DEBUG     LS step (0), time spent (21252), score (-17hard/0medium/-24372soft), new best score (-17hard/0medium/-24372soft), accepted/selected move count (1000/1000), picked move (optaplanner.domain.Allocation@5296ab0c {ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=47, availability=2021-10-08T14:00-2021-10-08T22:00} -> ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=41, availability=2021-10-05T14:00-2021-10-05T22:00}}).
2021-10-01 12:26:26,114 [main] DEBUG     LS step (1), time spent (21405), score (-15hard/0medium/-40094soft), new best score (-15hard/0medium/-40094soft), accepted/selected move count (1000/1067), picked move (optaplanner.domain.Allocation@730794bb {ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=45, availability=2021-10-08T14:00-2021-10-08T22:00} -> ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=46, availability=2021-10-01T14:00-2021-10-01T22:00}}).
2021-10-01 12:26:26,309 [main] DEBUG     LS step (2), time spent (21600), score (-13hard/0medium/-47776soft), new best score (-13hard/0medium/-47776soft), accepted/selected move count (1000/1160), picked move (optaplanner.domain.Allocation@73ed094c {ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=46, availability=2021-10-08T14:00-2021-10-08T22:00} -> ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=20, availability=2021-10-04T14:00-2021-10-04T22:00}}).
2021-10-01 12:26:26,471 [main] DEBUG     LS step (3), time spent (21762), score (-11hard/0medium/-65742soft), new best score (-11hard/0medium/-65742soft), accepted/selected move count (1000/1145), picked move (optaplanner.domain.Allocation@3c37489b {ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=42, availability=2021-10-08T14:00-2021-10-08T22:00} -> ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=0, availability=2021-10-01T14:00-2021-10-01T22:00}}).
2021-10-01 12:26:26,649 [main] DEBUG     LS step (4), time spent (21940), score (-9hard/0medium/-75202soft), new best score (-9hard/0medium/-75202soft), accepted/selected move count (1000/1148), picked move (optaplanner.domain.Allocation@a386ccf {ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=41, availability=2021-10-08T14:00-2021-10-08T22:00} -> ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=0, availability=2021-10-05T14:00-2021-10-05T22:00}}).
2021-10-01 12:26:26,832 [main] DEBUG     LS step (5), time spent (22123), score (-8hard/0medium/-75202soft), new best score (-8hard/0medium/-75202soft), accepted/selected move count (1000/1172), picked move (optaplanner.domain.Allocation@144402f6 {ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=42, availability=2021-10-07T14:00-2021-10-07T22:00} -> ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=11, availability=2021-10-05T14:00-2021-10-05T22:00}}).
--------------------(omitting other steps)--------------------
2021-10-01 12:27:04,541 [main] DEBUG     LS step (347), time spent (59832), score (0hard/0medium/-42754soft),     best score (0hard/0medium/-42754soft), accepted/selected move count (1000/1359), picked move (optaplanner.domain.Allocation@64047c70 {ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=46, availability=2021-10-06T14:00-2021-10-06T22:00}} <-> optaplanner.domain.Allocation@3c37489b {ResourceTimegrain{resource=optaplanner.domain.Resource@276b68af, index=44, availability=2021-10-06T14:00-2021-10-06T22:00}}).
2021-10-01 12:27:04,635 [main] DEBUG     LS step (348), time spent (59926), score (0hard/0medium/-42754soft),     best score (0hard/0medium/-42754soft), accepted/selected move count (1000/1365), picked move (optaplanner.domain.Allocation@68bb44fe {ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=6, availability=2021-10-07T14:00-2021-10-07T22:00}} <-> optaplanner.domain.Allocation@62f89e6a {ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=33, availability=2021-10-07T14:00-2021-10-07T22:00}}).
2021-10-01 12:27:04,709 [main] DEBUG     LS step (349), time spent (60000), score (0hard/0medium/-42754soft),     best score (0hard/0medium/-42754soft), accepted/selected move count (802/1086), picked move (optaplanner.domain.Allocation@7f77b1b0 {ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=13, availability=2021-10-07T14:00-2021-10-07T22:00}} <-> optaplanner.domain.Allocation@6f8a9b12 {ResourceTimegrain{resource=optaplanner.domain.Resource@34d644b5, index=39, availability=2021-10-07T14:00-2021-10-07T22:00}}).
2021-10-01 12:27:04,709 [main] INFO  Local Search phase (1) ended: time spent (60000), best score (0hard/0medium/-42754soft), score calculation speed (11876/sec), step total (350).
2021-10-01 12:27:04,712 [main] INFO  Solving ended: time spent (60000), best score (0hard/0medium/-42754soft), score calculation speed (15115/sec), phase total (2), environment mode (REPRODUCIBLE), move thread count (NONE).
 

После переключения на обнуляемую переменную планирования средний уровень оценки имеет ограничение, которое наказывает за каждую неназначенную сущность. Это результат решения того же экземпляра проблемы, для которого optplanner не смог найти оптимальное решение:

 2021-10-01 12:39:29,144 [main] INFO  Solving started: time spent (6235), best score (0hard/-21medium/0soft), environment mode (REPRODUCIBLE), move thread count (NONE), random (JDK with seed 0).
2021-10-01 12:39:33,797 [main] DEBUG     CH step (0), time spent (10892), score (0hard/-20medium/-130soft), selected move count (21121), picked move (optaplanner.domain.Allocation@7c51782d {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=47, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:39:36,698 [main] DEBUG     CH step (1), time spent (13793), score (0hard/-20medium/-130soft), selected move count (21121), picked move (optaplanner.domain.Allocation@77bc2e16 {null -> null}).
2021-10-01 12:39:39,032 [main] DEBUG     CH step (2), time spent (16127), score (0hard/-20medium/-130soft), selected move count (21121), picked move (optaplanner.domain.Allocation@48e8c32a {null -> null}).
2021-10-01 12:39:40,857 [main] DEBUG     CH step (3), time spent (17952), score (0hard/-19medium/-269soft), selected move count (21121), picked move (optaplanner.domain.Allocation@20a7953c {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=46, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:39:41,878 [main] DEBUG     CH step (4), time spent (18973), score (0hard/-19medium/-269soft), selected move count (21121), picked move (optaplanner.domain.Allocation@57c00115 {null -> null}).
2021-10-01 12:39:42,586 [main] DEBUG     CH step (5), time spent (19681), score (0hard/-19medium/-269soft), selected move count (21121), picked move (optaplanner.domain.Allocation@411a5965 {null -> null}).
2021-10-01 12:39:43,354 [main] DEBUG     CH step (6), time spent (20449), score (0hard/-18medium/-418soft), selected move count (21121), picked move (optaplanner.domain.Allocation@4fe533ff {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=45, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:39:44,007 [main] DEBUG     CH step (7), time spent (21102), score (0hard/-18medium/-418soft), selected move count (21121), picked move (optaplanner.domain.Allocation@5377414a {null -> null}).
2021-10-01 12:39:44,633 [main] DEBUG     CH step (8), time spent (21728), score (0hard/-18medium/-418soft), selected move count (21121), picked move (optaplanner.domain.Allocation@4e83a98 {null -> null}).
2021-10-01 12:39:45,251 [main] DEBUG     CH step (9), time spent (22346), score (0hard/-17medium/-577soft), selected move count (21121), picked move (optaplanner.domain.Allocation@17aa8a11 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=44, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:39:45,898 [main] DEBUG     CH step (10), time spent (22993), score (0hard/-17medium/-577soft), selected move count (21121), picked move (optaplanner.domain.Allocation@71b639d0 {null -> null}).
2021-10-01 12:39:46,485 [main] DEBUG     CH step (11), time spent (23580), score (0hard/-17medium/-577soft), selected move count (21121), picked move (optaplanner.domain.Allocation@18a25bbd {null -> null}).
2021-10-01 12:39:47,151 [main] DEBUG     CH step (12), time spent (24246), score (0hard/-16medium/-746soft), selected move count (21121), picked move (optaplanner.domain.Allocation@5d5b9ecb {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=43, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:39:47,862 [main] DEBUG     CH step (13), time spent (24957), score (0hard/-16medium/-746soft), selected move count (21121), picked move (optaplanner.domain.Allocation@1ee27d73 {null -> null}).
2021-10-01 12:39:48,556 [main] DEBUG     CH step (14), time spent (25651), score (0hard/-16medium/-746soft), selected move count (21121), picked move (optaplanner.domain.Allocation@5e5aafc6 {null -> null}).
2021-10-01 12:39:49,193 [main] DEBUG     CH step (15), time spent (26288), score (0hard/-15medium/-925soft), selected move count (21121), picked move (optaplanner.domain.Allocation@542f6803 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=42, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:39:49,781 [main] DEBUG     CH step (16), time spent (26876), score (0hard/-15medium/-925soft), selected move count (21121), picked move (optaplanner.domain.Allocation@5583098b {null -> null}).
2021-10-01 12:39:50,407 [main] DEBUG     CH step (17), time spent (27502), score (0hard/-15medium/-925soft), selected move count (21121), picked move (optaplanner.domain.Allocation@5807efad {null -> null}).
2021-10-01 12:39:51,168 [main] DEBUG     CH step (18), time spent (28262), score (0hard/-14medium/-1114soft), selected move count (21121), picked move (optaplanner.domain.Allocation@53a84ff4 {null -> ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=41, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:39:51,826 [main] DEBUG     CH step (19), time spent (28921), score (0hard/-14medium/-1114soft), selected move count (21121), picked move (optaplanner.domain.Allocation@7ce85af2 {null -> null}).
2021-10-01 12:39:52,372 [main] DEBUG     CH step (20), time spent (29467), score (0hard/-14medium/-1114soft), selected move count (21121), picked move (optaplanner.domain.Allocation@316acbb5 {null -> null}).
2021-10-01 12:39:52,374 [main] INFO  Construction Heuristic phase (0) ended: time spent (29469), best score (0hard/-14medium/-1114soft), score calculation speed (19105/sec), step total (21).
2021-10-01 12:39:52,692 [main] DEBUG     LS step (0), time spent (29787), score (0hard/-14medium/-1114soft),     best score (0hard/-14medium/-1114soft), accepted/selected move count (1000/1000), picked move (optaplanner.domain.Allocation@41418e53 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=43, availability=2021-10-08T14:00-2021-10-08T22:00}} <-> optaplanner.domain.Allocation@7f77b1b0 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=46, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:39:52,873 [main] DEBUG     LS step (1), time spent (29968), score (0hard/-14medium/-1114soft),     best score (0hard/-14medium/-1114soft), accepted/selected move count (1000/1213), picked move (optaplanner.domain.Allocation@c4d9e83 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=44, availability=2021-10-08T14:00-2021-10-08T22:00}} <-> optaplanner.domain.Allocation@6f8a9b12 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=47, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:39:53,061 [main] DEBUG     LS step (2), time spent (30156), score (0hard/-14medium/-1114soft),     best score (0hard/-14medium/-1114soft), accepted/selected move count (1000/1503), picked move (optaplanner.domain.Allocation@7b174491 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=45, availability=2021-10-08T14:00-2021-10-08T22:00}} <-> optaplanner.domain.Allocation@d464e23 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=41, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:39:53,270 [main] DEBUG     LS step (3), time spent (30365), score (0hard/-14medium/-1114soft),     best score (0hard/-14medium/-1114soft), accepted/selected move count (1000/1535), picked move (optaplanner.domain.Allocation@7f77b1b0 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=43, availability=2021-10-08T14:00-2021-10-08T22:00}} <-> optaplanner.domain.Allocation@41418e53 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=46, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:39:53,457 [main] DEBUG     LS step (4), time spent (30552), score (0hard/-14medium/-1114soft),     best score (0hard/-14medium/-1114soft), accepted/selected move count (1000/1532), picked move (optaplanner.domain.Allocation@c4d9e83 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=47, availability=2021-10-08T14:00-2021-10-08T22:00}} <-> optaplanner.domain.Allocation@6f8a9b12 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=44, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:39:53,605 [main] DEBUG     LS step (5), time spent (30700), score (0hard/-14medium/-1114soft),     best score (0hard/-14medium/-1114soft), accepted/selected move count (1000/1548), picked move (optaplanner.domain.Allocation@2957f567 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=42, availability=2021-10-08T14:00-2021-10-08T22:00}} <-> optaplanner.domain.Allocation@7b174491 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=41, availability=2021-10-08T14:00-2021-10-08T22:00}}).
--------------------(omitting other steps)--------------------
2021-10-01 12:40:22,649 [main] DEBUG     LS step (367), time spent (59744), score (0hard/-14medium/-1114soft),     best score (0hard/-14medium/-1114soft), accepted/selected move count (1000/1455), picked move (optaplanner.domain.Allocation@d464e23 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=43, availability=2021-10-08T14:00-2021-10-08T22:00}} <-> optaplanner.domain.Allocation@41418e53 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=41, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:40:22,731 [main] DEBUG     LS step (368), time spent (59826), score (0hard/-14medium/-1114soft),     best score (0hard/-14medium/-1114soft), accepted/selected move count (1000/1545), picked move (optaplanner.domain.Allocation@2957f567 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=42, availability=2021-10-08T14:00-2021-10-08T22:00}} <-> optaplanner.domain.Allocation@c4d9e83 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=44, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:40:22,812 [main] DEBUG     LS step (369), time spent (59907), score (0hard/-14medium/-1114soft),     best score (0hard/-14medium/-1114soft), accepted/selected move count (1000/1535), picked move (optaplanner.domain.Allocation@7b174491 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=45, availability=2021-10-08T14:00-2021-10-08T22:00}} <-> optaplanner.domain.Allocation@7f77b1b0 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=46, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:40:22,890 [main] DEBUG     LS step (370), time spent (59985), score (0hard/-14medium/-1114soft),     best score (0hard/-14medium/-1114soft), accepted/selected move count (1000/1525), picked move (optaplanner.domain.Allocation@6f8a9b12 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=47, availability=2021-10-08T14:00-2021-10-08T22:00}} <-> optaplanner.domain.Allocation@41418e53 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=43, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:40:22,905 [main] DEBUG     LS step (371), time spent (60000), score (0hard/-14medium/-1114soft),     best score (0hard/-14medium/-1114soft), accepted/selected move count (189/293), picked move (optaplanner.domain.Allocation@c4d9e83 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=42, availability=2021-10-08T14:00-2021-10-08T22:00}} <-> optaplanner.domain.Allocation@d464e23 {ResourceTimegrain{resource=optaplanner.domain.Resource@668ea404, index=41, availability=2021-10-08T14:00-2021-10-08T22:00}}).
2021-10-01 12:40:22,905 [main] INFO  Local Search phase (1) ended: time spent (60000), best score (0hard/-14medium/-1114soft), score calculation speed (18451/sec), step total (372).
2021-10-01 12:40:22,906 [main] INFO  Solving ended: time spent (60000), best score (0hard/-14medium/-1114soft), score calculation speed (16769/sec), phase total (2), environment mode (REPRODUCIBLE), move thread count (NONE).
 

Наблюдение:

  • CH не назначил все сущности, что также влияет на LS (я думаю, поскольку это необязательно).
  • У CH были бессмысленные шаги (назначить null -> null)

Как мне убедиться, что все объекты назначены?

Ответ №1:

Шаг («назначить null -> null») не является бессмысленным. Это показывает, что OptaPlanner принимает решение оставить что-то пустым. И он принял это решение, потому что это было решение, которое из всех возможных решений привело к наилучшему возможному результату. (В противном случае это решение не было бы принято.)

Скорее всего, присвоение ненулевых значений нарушило бы жесткое ограничение, и OptaPlanner избежал этого, присвоив значение null. OptaPlanner ведет себя здесь так, как и ожидалось — вы говорите, что у вас есть более важные проблемы, чем недействительность, и OptaPlanner уважает ваш выбор. (Недействительность-это только среднее ограничение, в то время как некоторые другие ограничения являются жесткими и, следовательно, более важными.)

Если вы хотите, чтобы все переменные были назначены, не делайте их недействительными.

Альтернативно, разработайте сильно взвешенные жесткие ограничения для ситуаций, когда неназначенные переменные являются проблемой. (Но чем это будет отличаться от того, чтобы просто не признавать их недействительными в первую очередь?)