我使用Drools的5.4.0.CR1,當我開始與Drools的最好成績是空
...
XmlSolverFactory configurer = new XmlSolverFactory();
configurer.configure(SOLVER_CONFIG);
Solver solver = configurer.buildSolver();
solver.setPlanningProblem(initialSolution);
solver.solve();
....
我有這樣的輸出
[exec:exec]
2012-04-30 11:10:46,296 [main] INFO Solving started: time spend (169), score (-13hard/0soft), new best score (-13hard/0soft), random seed (0).
2012-04-30 11:10:46,338 [main] DEBUG Step index (0), time spend (213), score (-12hard/0soft), new best score (null), accepted move size (10) for picked step (03-05-2012 P emp:EMPLOYEE1 => L).
2012-04-30 11:10:46,356 [main] DEBUG Step index (1), time spend (231), score (-12hard/0soft), new best score (null), accepted move size (10) for picked step (02-05-2012 P emp:EMPLOYEE2 => S).
java.lang.NullPointerException
at org.drools.planner.core.score.buildin.hardandsoft.DefaultHardAndSoftScore.compareTo(DefaultHardAndSoftScore.java:125)
at org.drools.planner.core.score.buildin.hardandsoft.DefaultHardAndSoftScore.compareTo(DefaultHardAndSoftScore.java:27)
at org.drools.planner.core.localsearch.decider.acceptor.tabu.AbstractTabuAcceptor.isAccepted(AbstractTabuAcceptor.java:121)
at org.drools.planner.core.localsearch.decider.acceptor.CompositeAcceptor.isAccepted(CompositeAcceptor.java:58)
at org.drools.planner.core.localsearch.decider.DefaultDecider.processMove(DefaultDecider.java:159)
這是跟蹤日誌:
2012-04-30 11:40:16,745 [main] INFO Solving started: time spend (110), score (-13hard/0soft), new best score (-13hard/0soft), random seed (0).
2012-04-30 11:40:16,781 [main] TRACE Move score (-13hard/0soft), accepted (true) for move (01-05-2012 M emp:EMPLOYEE1 => P).
2012-04-30 11:40:16,794 [main] TRACE Move score (-13hard/0soft), accepted (true) for move (04-05-2012 L emp:EMPLOYEE2 => G).
2012-04-30 11:40:16,794 [main] TRACE Ignoring not doable move (01-05-2012 P emp:EMPLOYEE3 => P).
2012-04-30 11:40:16,807 [main] TRACE Move score (-13hard/0soft), accepted (true) for move (01-05-2012 M emp:EMPLOYEE4 => S).
2012-04-30 11:40:16,819 [main] TRACE Move score (-13hard/0soft), accepted (true) for move (03-05-2012 P emp:EMPLOYEE5 => A).
...
2012-04-30 11:40:16,876 [main] TRACE Move score (-12hard/0soft), accepted (true) for move (03-05-2012 P emp:EMPLOYEE21 => L).
2012-04-30 11:40:16,876 [main] TRACE Ignoring not doable move (01-05-2012 L emp:EMPLOYEE22 => L).
2012-04-30 11:40:16,876 [main] TRACE Ignoring not doable move (03-05-2012 N emp:EMPLOYEE23 => N).
2012-04-30 11:40:16,887 [main] TRACE Move score (-13hard/0soft), accepted (true) for move (02-05-2012 N emp:EMPLOYEE14 => TS).
2012-04-30 11:40:16,898 [main] DEBUG Step index (0), time spend (265), score (-12hard/0soft), new best score (null), accepted move size (10) for picked step (03-05-2012 P emp:EMPLOYEE21 => L).
看來最好的解決辦法不會更新與分數值,但是我們定義的解決方案類作爲你的榜樣與getter和setter SCOR(例如皇后)即
任何人有關於「新的最佳分數」爲空的建議?
謝謝!
無我在對象解決方案private Har中使用dAndSoftScore分數;並且在xml文件配置中 HARD_AND_SOFT scoreDefinitionType> –
有關在方法compareTo(HardAndSoftScore other)中調試DefaultHardAndSoftScore的更多信息,請參閱「其他」 –
當調用'BestSolutionRecaller#extractBestSolution'時調試'stepScope.getScore()= = null「,接下來,當它返回null時,在」ScoreDirector#calculateScore「上調試。 –