| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
39
|
|
|
39
|
|
5681911
|
use strict; |
|
|
39
|
|
|
|
|
290
|
|
|
|
39
|
|
|
|
|
1278
|
|
|
2
|
39
|
|
|
39
|
|
212
|
use warnings; |
|
|
39
|
|
|
|
|
82
|
|
|
|
39
|
|
|
|
|
1069
|
|
|
3
|
39
|
|
|
39
|
|
762
|
use 5.024; |
|
|
39
|
|
|
|
|
135
|
|
|
4
|
39
|
|
|
39
|
|
247
|
use feature qw /postderef signatures/; |
|
|
39
|
|
|
|
|
94
|
|
|
|
39
|
|
|
|
|
5249
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Toolkit for implementing voting methods. |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Vote::Count; |
|
9
|
39
|
|
|
39
|
|
12173
|
use namespace::autoclean; |
|
|
39
|
|
|
|
|
406889
|
|
|
|
39
|
|
|
|
|
196
|
|
|
10
|
39
|
|
|
39
|
|
16733
|
use Moose; |
|
|
39
|
|
|
|
|
10674857
|
|
|
|
39
|
|
|
|
|
286
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
39
|
|
|
39
|
|
302752
|
use Data::Dumper; |
|
|
39
|
|
|
|
|
98457
|
|
|
|
39
|
|
|
|
|
2929
|
|
|
13
|
39
|
|
|
39
|
|
19128
|
use Time::Piece; |
|
|
39
|
|
|
|
|
269716
|
|
|
|
39
|
|
|
|
|
279
|
|
|
14
|
39
|
|
|
39
|
|
5437
|
use Path::Tiny; |
|
|
39
|
|
|
|
|
23768
|
|
|
|
39
|
|
|
|
|
2200
|
|
|
15
|
39
|
|
|
39
|
|
20459
|
use Vote::Count::Matrix; |
|
|
39
|
|
|
|
|
141
|
|
|
|
39
|
|
|
|
|
2000
|
|
|
16
|
|
|
|
|
|
|
# use Storable 3.15 'dclone'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
39
|
|
|
39
|
|
401
|
no warnings 'experimental'; |
|
|
39
|
|
|
|
|
89
|
|
|
|
39
|
|
|
|
|
15266
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION='2.00'; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Vote::Count - a tool kit for preferential ballots |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 VERSION 2.00 |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 A Toolkit for Resolving Preferential Ballots. |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Vote::Count provides a combination of methods and variations for conducting elections and studying different methods of resolving preferential ballots. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DOCUMENTATION |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 L<OVERVIEW|Vote::Count::Overview> |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
An overview of Preferential Voting and an introduction to Vote::Count. Read this document first. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 L<COMMON|Vote::Count::Common> |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
The core methods of Vote::Count are documented in this Module. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 L<CATALOG|Catalog> |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Catalog of Preferential Voting Methods implemented by Vote::Count and the Modules providing them. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 L<MULTIMEMBER|MultiMember> |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Overview of Preferential Ballots for Multi-Member Elections and their implementation in Vote::Count. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
has 'PairMatrix' => ( |
|
53
|
|
|
|
|
|
|
is => 'ro', |
|
54
|
|
|
|
|
|
|
isa => 'Object', |
|
55
|
|
|
|
|
|
|
lazy => 1, |
|
56
|
|
|
|
|
|
|
builder => '_buildmatrix', |
|
57
|
|
|
|
|
|
|
); |
|
58
|
|
|
|
|
|
|
|
|
59
|
46
|
|
|
46
|
|
124
|
sub _buildmatrix ( $self ) { |
|
|
46
|
|
|
|
|
90
|
|
|
|
46
|
|
|
|
|
95
|
|
|
60
|
46
|
100
|
|
|
|
1400
|
my $tiebreak = |
|
61
|
|
|
|
|
|
|
defined( $self->TieBreakMethod() ) |
|
62
|
|
|
|
|
|
|
? $self->TieBreakMethod() |
|
63
|
|
|
|
|
|
|
: 'none'; |
|
64
|
46
|
|
|
|
|
1173
|
return Vote::Count::Matrix->new( |
|
65
|
|
|
|
|
|
|
BallotSet => $self->BallotSet(), |
|
66
|
|
|
|
|
|
|
Active => $self->Active(), |
|
67
|
|
|
|
|
|
|
TieBreakMethod => $tiebreak, |
|
68
|
|
|
|
|
|
|
LogTo => $self->LogTo() . '_matrix', |
|
69
|
|
|
|
|
|
|
); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub BUILD { |
|
73
|
161
|
|
|
161
|
0
|
233877
|
my $self = shift; |
|
74
|
|
|
|
|
|
|
# Verbose Log |
|
75
|
161
|
|
|
|
|
820
|
$self->{'LogV'} = localtime->cdate . "\n"; |
|
76
|
|
|
|
|
|
|
# Debugging Log |
|
77
|
161
|
|
|
|
|
24162
|
$self->{'LogD'} = qq/Vote::Count Version $VERSION\n/; |
|
78
|
161
|
|
|
|
|
679
|
$self->{'LogD'} .= localtime->cdate . "\n"; |
|
79
|
|
|
|
|
|
|
# Terse Log |
|
80
|
161
|
|
|
|
|
17728
|
$self->{'LogT'} = ''; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# load the roles providing the underlying ops. |
|
84
|
|
|
|
|
|
|
with |
|
85
|
|
|
|
|
|
|
'Vote::Count::Common', |
|
86
|
|
|
|
|
|
|
'Vote::Count::Approval', |
|
87
|
|
|
|
|
|
|
'Vote::Count::Borda', |
|
88
|
|
|
|
|
|
|
'Vote::Count::BottomRunOff', |
|
89
|
|
|
|
|
|
|
'Vote::Count::Floor', |
|
90
|
|
|
|
|
|
|
'Vote::Count::IRV', |
|
91
|
|
|
|
|
|
|
'Vote::Count::Log', |
|
92
|
|
|
|
|
|
|
'Vote::Count::Score', |
|
93
|
|
|
|
|
|
|
'Vote::Count::TieBreaker', |
|
94
|
|
|
|
|
|
|
'Vote::Count::TopCount', |
|
95
|
|
|
|
|
|
|
; |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
98
|
|
|
|
|
|
|
1; |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
#INDEXSECTION |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=pod |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 INDEX of Vote::Count Modules and Documentation |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=over |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
L<Vote::Count - a tool kit for preferential ballots> |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
L<Vote::Count::Approval> |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L<Vote::Count::Borda> |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item * |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
L<Vote::Count::BottomRunOff> |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
L<Vote::Count::Catalog> |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
L<Vote::Count::Charge> |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item * |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
L<Vote::Count::Charge::Cascade> |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item * |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
L<Vote::Count::Common> |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item * |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
L<Vote::Count::Floor> |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item * |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
L<Vote::Count::Helper> |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
L<Vote::Count::Helper::FullCascadeCharge> |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
L<Vote::Count::Helper::NthApproval> |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L<Vote::Count::Helper::Table> |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L<Vote::Count::Helper::TestBalance;> |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
L<Vote::Count::IRV> |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
L<Vote::Count::Log> |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
L<Vote::Count::Matrix> |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
L<Vote::Count::Method::Cascade> |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
L<Vote::Count::Method::CondorcetDropping> |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
L<Vote::Count::Method::CondorcetIRV> |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
L<Vote::Count::Method::CondorcetVsIRV> |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
L<Vote::Count::Method::MinMax> |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item * |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
L<Vote::Count::Method::STAR> |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item * |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
L<Vote::Count::Method::WIGM> |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=item * |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
L<Vote::Count::MultiMember - Overview of Multi Member and Proportional Elections and Vote::Count support for them.> |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item * |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
L<Vote::Count::Overview> |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item * |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
L<Vote::Count::Range> |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item * |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
L<Vote::Count::RankCount> |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=item * |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
L<Vote::Count::ReadBallots> |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=item * |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
L<Vote::Count::Redact> |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=item * |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
L<Vote::Count::Score> |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=item * |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
L<Vote::Count::Start> |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item * |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
L<Vote::Count::TextTableTiny> |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=item * |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
L<Vote::Count::TieBreaker> |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=item * |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
L<Vote::Count::TopCount> |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=back |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=cut |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
#FOOTER |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=pod |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
BUG TRACKER |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
L<https://github.com/brainbuz/Vote-Count/issues> |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
AUTHOR |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
John Karr (BRAINBUZ) brainbuz@cpan.org |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
CONTRIBUTORS |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
Copyright 2019-2021 by John Karr (BRAINBUZ) brainbuz@cpan.org. |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
LICENSE |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
This module is released under the GNU Public License Version 3. See license file for details. For more information on this license visit L<http://fsf.org>. |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
SUPPORT |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
This software is provided as is, per the terms of the GNU Public License. Professional support and customisation services are available from the author. |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=cut |
|
277
|
|
|
|
|
|
|
|