[rules-users] Difficulty determining why I have score corruption

megwoods megan.woods at tollgroup.com
Tue Jan 8 19:00:22 EST 2013


Hi,

I have been at this a couple of days now but I am getting score corruption
from a rule that does the following:

rule "to bigger gap"
    when     
      $res: ResourceInstance()
      $resList : ArrayList(size > 1)
              from collect( TripAtTimeWithResource(resource  == $res) ) 
    then
     -- Sort the list using custom comparator.
     -- Measure a series of deltas between elements in the list.
     -- If the delta is larger than a threshold add a soft constraint.
     insertLogical(new IntConstraintOccurrence("to bigger gap",
ConstraintType.NEGATIVE_SOFT,delta * 10, ttrL));

end

The TripAtTimeWithResource is the planning entity.

I have checked the cloning and been through and checked that all equals and
hashcode methods and they are correct.

If I take this rule out the implementation functions as correctly.

Interestingly though I first prototyped this using a simple score and with
the same 'when' and 'then' clause (inserting a different fact) and no score
corruption was observed.

If anyone has any suggestions I would really like to hear from you.

Cheers Megan Woods

Extract from exception:
The workingMemory has 3 ConstraintOccurrence(s) in excess:
    to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance at 43b, resource=All(17), startTime=TimeUnit
[minute=285]]]=750
    to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance at 46c, resource=All(17), startTime=TimeUnit
[minute=75]]]=1700
    to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance at 421, resource=All(17), startTime=TimeUnit
[minute=75]]]=960
  The workingMemory has 4 ConstraintOccurrence(s) lacking:
    overlapping trips with same
resource/NEGATIVE_HARD:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance at 43b, resource=All(17), startTime=TimeUnit
[minute=285]]]=100
    to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance at 421, resource=All(17), startTime=TimeUnit
[minute=75]]]=1710
    to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance at 43b, resource=All(17), startTime=TimeUnit
[minute=285]]]=1650
    to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance at 46c, resource=All(17), startTime=TimeUnit
[minute=75]]]=950



--
View this message in context: http://drools.46999.n3.nabble.com/Difficulty-determining-why-I-have-score-corruption-tp4021412.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list