Reputation: 11
I use OtpaPlanner to optimize a vehicles routing extension. I have got hard and soft scores but when i try to display constraints Match details i got this message:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.getConstraintMatchTotals(DroolsScoreDirector.java:98)
at org.optaplanner.examples.common.business.SolutionBusiness.getConstraintMatchTotalList(SolutionBusiness.java:239)
the line of error can be this: kieSession.fireAllRules();
Upvotes: 1
Views: 95
Reputation: 27312
You probably forgot to call scoredirector.setWorkingSolution(Solution)
. See section "5.5. Explaining the score" in the docs. This causes the kieSession to be null as Ocannaille's answer explains.
Upvotes: 1
Reputation: 348
Maybe the problem is simply that kieSession
is null
. try :
if(kieSession != null)
kieSession.fireAllRules();
Without more information it's hard to debug this.
Upvotes: 0