[rules-users] drools-solver NPE in DefaultSimpleScore

Andrew Waterman andrew.waterman at gmail.com
Fri Nov 27 13:42:11 EST 2009


Hi Geoffrey,

My bad; when I migrated to the new Score implementation I failed to  
update my code to properly clone scores in my cloneSolution()  
implementation.  Thanks for letting me know where to look!

best wishes,

Andrew

On Nov 26, 2009, at 12:16 PM, Geoffrey De Smet wrote:

> 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