[rules-users] [planner] The presumed score is corrupted

Geoffrey De Smet ge0ffrey.spam at gmail.com
Fri Oct 14 03:28:07 EDT 2011


Probably you forgot to notify the workingMemory.update in the doMove method:

     public void doMove(WorkingMemory workingMemory) {
         FactHandle factHandle = workingMemory.getFactHandle(activity);
         activity.setAssignee(...);
         workingMemory.update(factHandle, activity);
     }

Op 14-10-11 09:21, Geoffrey De Smet schreef:
> A corrupted score normally indicates a problem with the Move 
> implementation (or sometimes the score drl).
>
> Basically this happened: for a number of moves, it did the move, 
> calculated the score and undo the move.
> One of those move was associated with a score -10hard/0soft, that was 
> the best one.
> Now, it does that move (which is now called the "step") and when it 
> calculates the score it's a different score 0hard/0soft.
>
> Try TRACE environment and see if it crashes sooner. Copy paste your 
> Move implementation here.
> In Planner 5.4 there will be 2 out-of-the-box Move implementations to 
> use, so writing Move's become optional.
>
> Op 13-10-11 16:37, Guilherme Kunigami schreef:
>> Hi,
>>
>> I've implemented a very simple application using drools planner 
>> consisting of a bunch of activities. My rule file is very simple too 
>> and just counts the number of activities not assigned. When I run 
>> Solver.solve(), I get the following error message:
>>
>> Exception in thread "AWT-EventQueue-0" 
>> java.lang.IllegalStateException: The presumedScore (-10hard/0soft) is 
>> corrupted because it is not the realScore  (0hard/0soft).
>>
>> Presumed workingMemory:
>>   Score rule (remainingActivitiesCount) has count (1) and weight 
>> total (11).
>> Real workingMemory:
>>   Score rule (remainingActivitiesCount) has count (1) and weight 
>> total (0).
>>
>> I've tracked down this message and found this piece of code 
>> @DefaultLocalSearchSolver.solveImplementation():
>>
>> // there is no need to recalculate the score, but we still need to set it
>> localSearchSolverScope.getWorkingSolution().setScore(localSearchStepScope.getScore());
>> if (assertStepScoreIsUncorrupted) {
>>     
>> localSearchSolverScope.assertWorkingScore(localSearchStepScope.getScore());
>> }
>>
>> It seems that the working score is never updated along the algorithm, 
>> but the score in the working memory changes. Thus, when we use the 
>> DEBUG environment, assertStepScoreIsUncorrupted is turned on and the 
>> assertion fails.
>>
>> Should the score be updated or am I using the library incorrectly?
>>
>> Thanks,
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
> -- 
> With kind regards,
> Geoffrey De Smet
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-- 
With kind regards,
Geoffrey De Smet

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111014/b6465828/attachment.html 


More information about the rules-users mailing list