1

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();

Zorian
  • 175
  • 1
  • 13
Latifa
  • 11
  • 1

2 Answers2

1

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.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
0

Maybe the problem is simply that kieSession is null. try :

if(kieSession != null) 
    kieSession.fireAllRules();

Without more information it's hard to debug this.

A. Ocannaille
  • 306
  • 4
  • 14