Optaplanner Исключение из нулевого указателя Best Score

14:46:27.239 [main] INFO  o.o.core.impl.solver.DefaultSolver - Solving started: time spent (155), best score (3uninitialized/-3hard/-3soft), environment mode (REPRODUCIBLE), random (JDK with seed 0).
14:46:27.320 [main] DEBUG o.o.c.i.c.DefaultConstructionHeuristicPhase -     CH step (0), time spent (237), score (0hard/-2soft), selected move count (3), picked move (Requests [id=4, res=null] {null -> Resources [Name=Doc2, Id=0002]}).
14:46:27.331 [main] DEBUG o.o.c.i.c.DefaultConstructionHeuristicPhase -     CH step (1), time spent (248), score (3hard/-1soft), selected move count (3), picked move (Requests [id=5, res=null] {null -> Resources [Name=Doc2, Id=0002]}).
14:46:27.347 [main] DEBUG o.o.c.i.c.DefaultConstructionHeuristicPhase -     CH step (2), time spent (264), score (5hard/0soft), selected move count (3), picked move (Requests [id=6, res=null] {null -> Resources [Name=Doc2, Id=0002]}).
14:46:27.348 [main] INFO  o.o.c.i.c.DefaultConstructionHeuristicPhase - Construction Heuristic phase (0) ended: step total (3), time spent (264), best score (null).

Хотя результат подсчитывается на шаге 1 и 2, почему я получаю исключение Null Pointer для лучшего результата.

ОШИБКА MSG

Exception in thread "main" java.lang.NullPointerException
at org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore.compareTo(HardSoftScore.java:152)
at org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore.compareTo(HardSoftScore.java:30)
at org.optaplanner.core.impl.localsearch.decider.acceptor.lateacceptance.LateAcceptanceAcceptor.isAccepted(LateAcceptanceAcceptor.java:67)
at org.optaplanner.core.impl.localsearch.decider.LocalSearchDecider.processMove(LocalSearchDecider.java:166)
at org.optaplanner.core.impl.localsearch.decider.LocalSearchDecider.doMove(LocalSearchDecider.java:149)
at org.optaplanner.core.impl.localsearch.decider.LocalSearchDecider.decideNextStep(LocalSearchDecider.java:121)
at org.optaplanner.core.impl.localsearch.DefaultLocalSearchPhase.solve(DefaultLocalSearchPhase.java:72)
at org.optaplanner.core.impl.solver.DefaultSolver.runPhases(DefaultSolver.java:215)
at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:176)
at app.resourceAllocation.main(resourceAllocation.java:44)

1 ответ

Эта ошибка была исправлена ​​в https://issues.jboss.org/browse/PLANNER-207 несколько лет назад.

Другие вопросы по тегам