[rules-users] OptaPlanner: score corruption when using insertLogical with custom objects

Geoffrey De Smet ge0ffrey.spam at gmail.com
Wed Jul 24 10:47:12 EDT 2013


Turns out this is a user problem in the equals and hashcode of 
FamilyStart, not a bug in Drools or OptaPlanner :)

     @Override
     public boolean equals(Object other)
     {
         if ((this == other))
             return true;
         if (!(other instanceof FamilyStart))
             return false;
         FamilyStart castOther = (FamilyStart) other;
         return new EqualsBuilder()
.append(this.getTimeslot(), castOther.getTimeslot()) // <== must be Family
.append(this.getTimeslot(), castOther.getTimeslot())
.isEquals();
     }

     @Override
     public int hashCode()
     {
         return new HashCodeBuilder()
.append(getTimeslot()) // <== must be Family
.append(getTimeslot())
.toHashCode();
     }

On 19-07-13 11:56, Geoffrey De Smet wrote:
> Thanks. The zip looks good and isolated (= usable for me). I might look
> into it after PLANNER-160 is done next week.
>
> On 19-07-13 11:25, pvandenbrink wrote:
>> Ok, I've created a small reproducer and attached it to this issue:
>> https://issues.jboss.org/browse/PLANNER-182
>>
>>
>>
>> --
>> View this message in context: http://drools.46999.n3.nabble.com/OptaPlanner-score-corruption-when-using-insertLogical-with-custom-objects-tp4024932p4025055.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> 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