- VERSION 1.213
- Definition of Top Count
- TopCount Methods
- Top Counting Range Ballots
This Role is consumed by Vote::Count it provides TopCount and related Methods to Vote::Count objects.
Top Count is tabulation of the Top Choice vote on each ballot. As choices are eliminated the first choice on some ballots will be removed, the next highest remaining choice becomes the Top Choice for that ballot. When all choices on a ballot are eliminated it becomes exhausted and is no longer counted.
Takes a hashref of active choices as an optional parameter, if one is not provided it uses the internal active list accessible via the ->Active() method, which itself defaults to the BallotSet's Choices list.
Returns a RankCount object containing the TopCount.
TopCount supports both Ranked and Range Ballot Types.
For RCV, TopCount respects weighting, 'votevalue' is defaulted to 1 by readballots. Integers or Floating point values may be used.
Returns a hashref of the unweighted raw count from the last TopCount operation.
Returns the Top Choice on a specific ballot from the last TopCount operation. The ballot is identified by it's key in the ballotset.
$Election->TopCount(); my $top = $Election->TopChoice( 'FOO:BAZ:BAR:ZAB');
$self->TopCountMajority( $round_topcount ) or $self->TopCountMajority( undef, $active_choices )
Will find the majority winner from the results of a topcount, or alternately may be given undef and a hashref of active choices and will topcount the ballotset for just those choices and then find the majority winner.
Returns a hashref of results. It will always include the votes in the round and the threshold for majority. If there is a winner it will also include the winner and winvotes.
This method wraps TopCountMajority adding logging, the logging of which would be a lot of boiler plate in round oriented methods. It takes the same parameters and returns the same hashref.
Since Range Ballots often allow ranking choices equally, those equal votes need to be split. The other option is to have a rule that assigns an order among the tied choices in a conversion to Ranked Ballots. To prevent Rounding errors in the addition on large sets the fractions are added as Rational Numbers. The totals are converted to floating point numbers with a precision of 5 places for display.
It is recommended to install Math::BigInt::GMP to improve performance on the Rational Number math used for Top Count on Range Ballots.
John Karr (BRAINBUZ) firstname.lastname@example.org
Copyright 2019-2021 by John Karr (BRAINBUZ) email@example.com.
This module is released under the GNU Public License Version 3. See license file for details. For more information on this license visit http://fsf.org.
This software is provided as is, per the terms of the GNU Public License. Professional support and customisation services are available from the author.