votep.pl takes url formatted votes, one per line, on the standard input and runs VRR, IRNR, IRV and Histogram on them, producing HTML results on the standard output.
Virtual Round Robin (Condorcet) | VRR.pm |
Instant Runoff Normalized Ratings | IRNR.pm |
Instant Runoff Voting | IRV.pm |
Histogram | Histogram.pm |
All election methods implement a common interface, taking votes and returning results through functions of the same signature. They are built as perl objects.
$obj->voteNameValues($);
Takes reference to array of alternating names and values like [ "a", 3, "B", 5 ]. Values are ratings, higher better.
$obj->voteNameValueHash($);
Takes reference to hash of name=>value entries like { "a" => 3, "B" => 5 }. Values are ratings, higher better.
$obj->voteOrderedNames($);
Takes reference to array of names ordered with highest ranked first like [ "B", "a" ].
$obj->get_results();
Returns array of alternating names and values, sortedy by winningest first.
$obj->htmlSummary();
Return a string with HTML text representing the results of this election and any other information.
$obj->name();
Return a string with the name of the election method.
Vote.pm contains some common code for parsing strings with vote information
gtEqVotesToNameValues($);
"a > b = c > d" becomes [ "a", 4, "b", 3, "c", 3, "d", 1 ]
gtEqVotesToNameValueHash($);
"a > b = c > d" becomes { "a" => 4, "b" => 3, "c" => 3, "d" => 1 }
urlVotesToNameValueHash($)
"a=9&b=2&c=1&d=3" becomes { "a" => 9, "b" => 2, "c" => 1, "d" => 3 }