On 15 May 2012 00:30, Christopher Dolan <christopher.dolan@avid.com> wrote:
I may be way off track, but I saw score corruption like yours in two cases:

1) broken .equals()/.hashCode() method.
I had a couple of model classes that accidentally looked at mutable data in their .equals() and .hashCode() methods. When these were applied as the cause of the constraint, the revert action then failed to find the constraint because the removed instance wasn't .equals() to the inserted instance. I solved this by reverting to Object.equals() and Object.hashCode().

I don't think that problem with .equals() or .hashCode() methods, because I'm using <b>apache EqualsBuilder</b> and <b>apache HashCodeBuilder</b>, this is 1st, and 2nd my each planning entity has al least unique <b>id</b>.
 
2) broken variable assignment in aggregate predicates (https://issues.jboss.org/browse/JBRULES-3482)
This is fixed in 5.4.0.Final.
If your rules use collect() or accumulate() with a complicated first argument to either, then Drools becomes confused about which variable to assign the value to. In most cases, this results in a ClassCastException. But in some cases where the facts happened to be the same class, you ended up with the wrong fact assigned as the cause of the constraint.
yes, I'm using accumulate(), but not in this rule(wxGroupChildClassesInSamePeriodWithDiffLessons) and I've switched to 5.4.Final version, same problem....
 
-----Original Message-----
From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Nurlan
Sent: Friday, May 11, 2012 5:06 PM
To: rules-users@lists.jboss.org
Subject: [rules-users] Score curruption exception in drools-planner-5.4.0.CR1

Hi guys!
I have some exception and I don't know why?
My rule *someRuleId* has weight *1*
2012-05-12 03:47:08,224 [main] DEBUG     Step index (570), time spend
(115566), score (0hard/0soft), initialized planning entity
(SomePlanningEntity [id=21, …]).
2012-05-12 03:47:08,465 [main] DEBUG     Step index (571), time spend
(115807), score (0hard/0soft), initialized planning entity
(SomePlanningEntity [id=20, …]).
java.lang.IllegalStateException: Score corruption: the workingScore
(-4hard/0soft) is not the uncorruptedScore (0hard/0soft):
 The workingMemory has 4 ConstraintOccurrence(s) in excess:
   someRuleId/NEGATIVE_HARD:[SomePlanningEntity [id=2482309, …],
SomePlanningEntity [id=54, …]]=1
   someRuleId/NEGATIVE_HARD:[SomePlanningEntity [id=2482309, …],
SomePlanningEntity [id=57, …]]=1
   someRuleId/NEGATIVE_HARD:[SomePlanningEntity [id=57, …],
SomePlanningEntity [id=2482309, …]]=1
   someRuleId/NEGATIVE_HARD:[SomePlanningEntity [id=54, …],
SomePlanningEntity [id=2482309, …]]=1
 Check the score rules who created those ConstraintOccurrences. Verify that
each ConstraintOccurrence's causes and weight is correct.
       at
org.drools.planner.core.score.director.AbstractScoreDirector.assertWorkingScore(AbstractScoreDirector.java:101)
       at
org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.doMove(DefaultGreedyDecider.java:111)
       at
org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.decideNextStep(DefaultGreedyDecider.java:78)
       at
org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:63)
       at
org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:183)
       at
org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:151)
       …
       …


--
View this message in context: http://drools.46999.n3.nabble.com/Score-curruption-exception-in-drools-planner-5-4-0-CR1-tp3981199.html
Sent from the Drools: User forum mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
Regards, 
Nurlan Rakhimzhanov