>From my very poor understanding of Planner: the components of the
score must directly reflect the current state of the data, as it is
changed by some "move".

The cited rule rearranges and evaluates TripAtTimeWithResource "on the
fly" on its RHS. So, if a move changes TripAtTimeWithResource so that
its position according to the custom collation sequence changes, the
relationship between overall state and score is not reflected in the
data.

-W


On 09/01/2013, megwoods <[email protected]> wrote:
> 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@43b, resource=All(17), startTime=TimeUnit
> [minute=285]]]=750
>     to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
> [trip=a.c.t.p.p.m.TripInstance@46c, resource=All(17), startTime=TimeUnit
> [minute=75]]]=1700
>     to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
> [trip=a.c.t.p.p.m.TripInstance@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@43b, resource=All(17), startTime=TimeUnit
> [minute=285]]]=100
>     to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
> [trip=a.c.t.p.p.m.TripInstance@421, resource=All(17), startTime=TimeUnit
> [minute=75]]]=1710
>     to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
> [trip=a.c.t.p.p.m.TripInstance@43b, resource=All(17), startTime=TimeUnit
> [minute=285]]]=1650
>     to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
> [trip=a.c.t.p.p.m.TripInstance@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.
> _______________________________________________
> rules-users mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to