-
Enhancement
-
Resolution: Done
-
Blocker
-
None
-
None
-
NEW
-
NEW
Problem: It's hard to mix a fairness constraint with another constraint on the same score level and remain dataset size independent.
Solution: Standard deviation instead of variance for fairness rules is needed to allow other constraints at the same score level.
Well, its not exactly standard deviation and variance (as it's relative to zero instead of the average), so we'll call it loadBalance() instead.
BEFORE: This is slow and verbose:
rule "fairAssignmentCountPerTeam" when accumulate( $t : Team() and accumulate( $a : TeamAssignment(team == $t); $teamTotal : count($a) ); $total : sum($teamTotal.intValue() * $teamTotal.intValue()) ) then scoreHolder.addMediumConstraintMatch(kcontext, - (int) (Math.sqrt($total) * 1_000_000.0)); end
AFTER: We'll introduce an accumulate function called loadBalance():
rule "fairAssignmentCountPerTeam" when accumulate( TeamAssignment($t : team); $total : loadBalance($t) ) then scoreHolder.addMediumConstraintMatch(kcontext, - (int) ($total * 1_000_000.0)); end
- is related to
-
DROOLS-1424 Variance and standard deviation function in Drools out of the box
- Closed