Op 07-12-11 16:44, guyramirez schreef:
> Yes I am getting the same results with your recommended rule.
>
> Also I wrote a Drools program that does not use Planner but instead performs
> the initial insert of the ShiftAdjustment, then the 3 updates with the
> firing of the rules at each insert/update, all in sequence, with the display
> of the score after each firing (so no use of the Solution class). And I get
> exactly the same erroneous results.
Then it's a bug in Drools Expert,
   please create a jira at
   issues.jboss.org/browse/JBRULES
and attach code to reproduce (or even better, create a pull request at 
github.com/droolsjbpm with a regression test).
Also try running with the drools-core/compiler 5.4.0-SNAPSHOT's to see 
if they have it too and report it in the issue.
> I agree with you, it could be in the hashCode and/or equals methods. I will
> check them again against the examples. I have done it so many times already.
> :)
>
>> It's odd indeed that the tmp working memory is incorrect, instead of the
> real one.
> The real working memory is created everytime from scratch to check against
> the presumed score, right?
in environment mode TRACE: yes
in environment mode DEBUG: yes, but not every move, but every step (it's 
too slow otherwise)
>   Somehow the update of a fact (planning entity in
> this case) does not yield the same result as a retract and then insert (or
> plain insert in the case of the real working memory).
yes, there is statefull working memory corruption.
> We looked at the planning entity code earlier. Here is some code for the
> IntervalRequirement class that is being used to match against the
> ShiftAssignment:
>
> public class IntervalRequirement implements Comparable<IntervalRequirement>
> {
>       private int dayAppliesTo;
>       private int interval;
>       private int intervalMinutes;
>       private Position position;
>       private int staffingRequired;
>
> @Override
>       public int compareTo(IntervalRequirement other) {
>               return this.interval - other.interval;
>       }
>
> @Override
>       public boolean equals(Object o) {
>          if (this == o) {
>              return true;
>          } else if (o instanceof IntervalRequirement) {
>               IntervalRequirement other = (IntervalRequirement) o;
>              return new EqualsBuilder()
>                      .append(this.interval, other.interval)
>                      .append(this.position, other.position)
>                      .append(this.staffingRequired, other.staffingRequired)
>                      .isEquals();
>          } else {
>              return false;
>          }
>
>       @Override
>       public int hashCode() {
>               return new HashCodeBuilder()
>                               .append(getClass())
>                               .append(this.interval)
>                               .append(this.position)
>
> .append(this.staffingRequired)
>                               .toHashCode();
>       }
> ...
> }
Looks good, but I am talking about the cloneSolution() of the class that 
implements Solution, not the planning entity.
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Planner-5-3-Final-presumedScore-is-corrupted-when-using-update-on-the-rules-working-memory-tp3546932p3567779.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
>

-- 
With kind regards,
Geoffrey De Smet


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

Reply via email to