[rules-users] OptaPlanner: score corruption when using insertLogical with custom objects
pvandenbrink
pieter.van.den.brink at topicus.nl
Wed Jul 17 07:02:25 EDT 2013
ge0ffrey wrote
> The 7 one probably got inserted with it didn't reach to 5 yet. That was
> a good logicalInsertion.
> The issue is, why didn't it get retracted when a move made changes so it
> did reach to 5?
I've added a printline in the rules xml file before the insertLogical. At
one point shortly before the corruption occurs the following two lines
appear immediately one after another:
inserting FamilyStart for Family 11 at tijdslot Timeslot 5
inserting FamilyStart for Family 11 at tijdslot Timeslot 7
This seems strange, it's as if they're inserted almost at the same time.
ge0ffrey wrote
> This one looks good, but I am mostly interested in those of the
> logically inserted objects (FamilyStart, etc).
FamilyStart implements it as follows:
@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.getFamily(), castOther.getFamily())
.append(this.getTimeslot(), castOther.getTimeslot()).isEquals();
}
@Override
public int hashCode()
{
return new
HashCodeBuilder().append(getFamily()).append(getTimeslot()).toHashCode();
}
Similarly, FamilyEnd:
@Override
public boolean equals(Object other)
{
if ((this == other))
return true;
if (!(other instanceof FamilyEnd))
return false;
FamilyEnd castOther = (FamilyEnd) other;
return new EqualsBuilder().append(this.getFamily(), castOther.getFamily())
.append(this.getTimeslot(), castOther.getTimeslot()).isEquals();
}
@Override
public int hashCode()
{
return new
HashCodeBuilder().append(getFamily()).append(getTimeslot()).toHashCode();
}
--
View this message in context: http://drools.46999.n3.nabble.com/OptaPlanner-score-corruption-when-using-insertLogical-with-custom-objects-tp4024932p4024969.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list