Created
January 3, 2017 15:54
-
-
Save ge0ffrey/458dd9f28685b3197cda66c5f7769eb9 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
rule "Fairness standard deviation" | |
when | |
accumulate ( | |
$c : candidate | |
accumulate ( | |
$f : FederalState ( winningCandidate == $c ); | |
$candidateSum : sum( $f.getElectoralVotes() ) | |
); | |
$variance : sum($candidateSum * $candidateSum) | |
) | |
then | |
// Square root of variance is standard deviation | |
scoreHolder.addSoftConstraintMatch(kcontext, Math.sqrt($variance)); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment