[rules-users] drools-solver NPE in DefaultSimpleScore

Geoffrey De Smet ge0ffrey.spam at gmail.com
Thu Nov 26 13:21:56 EST 2009


By the way, if you turn on info logging,
it logs each time a new best solution is found.
If you see a null in there, that's the problem.

However, that logging guarantee doesn't apply if you hooked in a custom 
BestSolutionRecaller etc

With kind regards,
Geoffrey De Smet


Geoffrey De Smet schreef:
> Hi Andrew,
> 
> I can't reproduce your problem.
> 
>  > The BestSolution is not null although the best score is.
> 
> The LocalSearchSolverScope cannot have a best solution and not a best score.
> Could you debug to see where LocalSearchSolverScope.setBestSolution() is 
> called and why LocalSearchSolverScope.setBestScore() isn't called or is 
> called with a null argument?
> 
> With kind regards,
> Geoffrey De Smet
> 
> 
> Andrew Waterman schreef:
>> Hi,
>>
>> I migrated some solver code that I had working on 5.0M4 to the 5.1.0  
>> implementation.  I'm now seeing the following while running the solver:
>>
>> java.lang.NullPointerException
>> 	at org.drools.solver.core.score.DefaultSimpleScore.compareTo 
>> (DefaultSimpleScore.java:73)
>> 	at org.drools.solver.core.score.DefaultSimpleScore.compareTo 
>> (DefaultSimpleScore.java:13)
>> 	at  
>> org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller.stepTaken 
>> (BestSolutionRecaller.java:56)
>> 	at  
>> org.drools.solver.core.localsearch.DefaultLocalSearchSolver.stepTaken 
>> (DefaultLocalSearchSolver.java:171)
>> 	at  
>> org.drools.solver.core.localsearch.DefaultLocalSearchSolver.solveImplementation 
>> (DefaultLocalSearchSolver.java:121)
>> 	at org.drools.solver.core.AbstractSolver.solve(AbstractSolver.java:41)
>>
>> I ran my test with a debugger attached, and this call is returning a  
>> Null:
>>
>> Score bestScore = localSearchSolverScope.getBestScore();
>> <org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller:  
>> 55>
>>
>> The BestSolution is not null although the best score is.
>>
>> Should I file an issue on this in JIRA?  Or perhaps this reflects some  
>> change to the old code that I didn't migrate properly?
>>
>> best wishes,
>>
>> Andrew
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 




More information about the rules-users mailing list