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

Geoffrey De Smet ge0ffrey.spam at gmail.com
Fri Jan 11 07:39:28 EST 2013


Op 11-01-13 12:14, Reinis schreef:
> 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!
:) We've all been there.

We are working towards limiting Planner's relying on identity/equals 
code of your domain objects:
Removal of causes parameter and insertLogical with "compensation actions 
unmatch/changeListeners".
Just look how much prettier (and faster) this will be:
https://github.com/droolsjbpm/drools-planner/blob/master/drools-planner-examples/src/main/resources/org/drools/planner/examples/cloudbalancing/solver/cloudBalancingCompensationActionExperimentScoreRules.drl#L32 

(incomplete prototype, do not use yet! ConstraintOccurrence's will still 
be supported too)
>
> 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...
>       }
> }
Writing custom moves is tricky indeed.
I am working on providing more generic moves, so people don't need to 
resort to writing custom moves:
http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e5468
>
> br
> Reinis
Thanks for the input :)
>
> 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
> _______________________________________________
> 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