当前位置: 首页 > 知识库问答 >
问题:

如何使施工启发式阶段在过度约束规划中分配所有实体?

卞轶
2023-03-14

正如标题所说。我是Optaplanner的新开发人员。在我切换到过度约束规划之前,CH阶段工作正常:这里是CH按预期分配21个实体,LS能够找到一个最优解决方案(忽略中等得分级别):

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

共有1个答案

陆俭
2023-03-14

步骤(“赋值null->null”)并非毫无意义。它显示OptaPlanner决定将某些内容保留为空。它做出了这个决定,因为这是一个决定,在所有可能的决定中,导致了最好的分数。(否则就不会做出这个决定。)

最有可能的是,分配给非空值会破坏硬约束,而OptaPlanner通过分配空值避免了这一点。OptaPlanner在这里的行为与预期一致--你说你有比无效更重要的关注点,OptaPlanner尊重你的选择。(无效性只是一个中等约束,而其他一些约束很难,因此更重要。)

如果希望赋值所有变量,请不要将其设为空。

或者,为未赋值变量是一个问题的情况设计重权重的硬约束。(但这与一开始就不让它们为空有什么不同?)

 类似资料:
  • 我正试图用java的Optaplanner实现一个简单的云平衡系统,该系统具有过度约束的规划。 最喜欢的是,我正在尝试使用Optaplanner Java库实现一个简单的云平衡系统,该系统具有过度约束的规划。我将模型映射到我的问题(车辆和资产),进行变量替换cpuPower- 如果我使用这个简单的例子,我会收到一个所有进程都已签名的响应,尽管其中一些不能分配给计算机。对于这个问题,optaplan

  • 我想为VRP创建一个过度约束规划的增量分数。我创建了一个传统的虚拟车辆,其中包括所有计划外的客户。 示例: Optaplanner将Customer1从Vehicle1移动到Vehicle2: 当我得到AfterVariableChanged:previousStandstill(Customer1)时,在Customer.getVehicle()中,我有旧车辆的价值,我不知道是否需要添加软成本(

  • 我有这样的设定: 在施工启发式阶段,如果 optaplanner 在为所有规划实体分配初始值之前获得 0 HARD 分数(可行解决方案),那么在分配更多规划实体初始值后再次变得不可行(-1 HARD),我注意到当施工启发式阶段结束时,optaplanner 不会执行本地搜索,而只是将不可行的解决方案报告为最终最佳解决方案。 最终的最佳解决方案不应该是所有规划实体都被分配了一个值并从那里开始检查是否

  • 我一直试图让过度约束的计划来适应我的情况,但不断遇到一些失败的硬约束仍然被分配的问题。如果之前有人回答过这个问题,我很抱歉,但是我看到的大多数示例/解决方案都是围绕Drools展开的,我在这个项目中使用的是streams API。使用optaplanner的quarkus 1.4.2实现,如果有帮助的话。 任何关于我可能做错什么的见解都将不胜感激,并提前感谢:)

  • 我所说的一阶约束是什么意思 首先,我将解释箭头上的一阶约束的含义:由于箭头的方式不美观,您不能使用本地绑定的名称,在箭头操作符号中需要箭头命令。 下面是一个例子来说明:

  • 问题内容: 在我们的web.xml中,我们具有以下安全约束 这很有效,除了我们需要以编程方式打开和关闭此约束之外,因此本质上需要编写一个过滤器来执行类似的操作。这可以在码头做吗?从本质上讲,我们需要能够基于自定义配置系统更改此功能的打开或关闭。 问题答案: 可以在Jetty中进行操作,但我认为您不能在jetty.xml中有条件地进行操作。 我知道您可以通过在应用程序中嵌入Jetty并以编程方式配置