[rules-users] Drools planner Score corruption issue: how to tackle?

Reinis drools at orbit-x.de
Fri Jan 11 06:14:12 EST 2013


Hi,

I want to reinforce statement from Geoffrey by saying that from roughly 
10 memory corruptions I have had so far, 8 were caused by bugs in MY 
identity/equality code!

If you write your own move implementations, here is one additional 
example of the bug I have had and that have caused me sleepless nights 
with sporadic memory corruption:

public class MyMove implements Move {

...

     public void doMove(ScoreDirector scoreDirector) {
scoreDirector.beforeVariableChanged(myPlanningVariableInstance, 
"myPlanningVariable");
         myPlaningVariableInstance.setValue(toValue);
scoreDirector.beforeVariableChanged(myPlanningVariableInstance, 
"myPlanningVariable"); //notice how I use beforeVariableChanged instead 
of afterVariableChanged...
     }
}

br
Reinis

On 01/10/2013 03:30 PM, Geoffrey De Smet wrote:
>
> Op 10-01-13 10:54, Michiel Vermandel schreef:
>> Hi,
>>
>> While running a planning I get after about 5 minutes a score corruption:
>>
>> Exception in thread "main" java.lang.IllegalStateException: Score 
>> corruption: the workingScore (-33hard/0soft) is not the 
>> uncorruptedScore (-23hard/0soft):
>>   The workingMemory has 1 ConstraintOccurrence(s) in excess:
>>     noConsecutiveIV/NEGATIVE_HARD:[Inspection of B747-AX145.I#1 
>> -233344192, Inspection of B737-AC126.I#1 -24157252, Andy]=10
>>   Check the score rules who created those ConstraintOccurrences. 
>> Verify that each ConstraintOccurrence's causes and weight is correct.
>>
>> This occurs in the localSearch phase (when only running the 
>> construction heuristic phase, I do not get this exception).
>>
>> How do I start in tackling this issue?
> Start by looking at the "causes" vararg parameter you're giving to new 
> IntConstraintOccurrence,
> including the equals/hashCode() of each of those elements.
> Read up about insertLogical in the Drools Expert manual.
>
> PS: for 6.0 we're working on unmatchListeners which would allow us to 
> avoid the insertLogical and the "causes" parameter.
>>
>> Thanks a lot!
>>
>> Michiel
>> -----------------
>> http://www.codessentials.com - Your essential software, for free!
>> Follow us at http://twitter.com/#!/Codessentials
>>
>>
>> _______________________________________________
>> 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