Created
February 14, 2017 16:11
-
-
Save ge0ffrey/76847c8f940fc51382dfeb58a4289e81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import accumulate org.optaplanner.examples.tennis.solver.drools.functions.LoadBalanceAccumulateFunction loadBalance; | |
rule "fairAssignmentCountPerTeam" | |
when | |
accumulate( | |
$t : Team() | |
and accumulate( | |
TeamAssignment(team == $t); | |
$assignmentCount : count() | |
); | |
$result : loadBalance($assignmentCount) | |
) | |
then | |
scoreHolder.addMediumConstraintMatch(kcontext, - (int) $result.getMeanDeviationSquaredSumRootMillis()); | |
end | |
rule "evenlyConfrontationCount" | |
when | |
accumulate( | |
$t1 : Team() | |
and $t2 : Team($t1.getId() < id) | |
and accumulate( | |
TeamAssignment(team == $t1, $d : day) | |
and TeamAssignment(team == $t2, day == $d); | |
$confrontationCount : count() | |
); | |
$result : loadBalance($confrontationCount) | |
) | |
then | |
scoreHolder.addSoftConstraintMatch(kcontext, - (int) $result.getMeanDeviationSquaredSumRootMillis()); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment