line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
39
|
|
|
39
|
|
5665843
|
use strict; |
|
39
|
|
|
|
|
284
|
|
|
39
|
|
|
|
|
1193
|
|
2
|
39
|
|
|
39
|
|
220
|
use warnings; |
|
39
|
|
|
|
|
103
|
|
|
39
|
|
|
|
|
1113
|
|
3
|
39
|
|
|
39
|
|
759
|
use 5.024; |
|
39
|
|
|
|
|
142
|
|
4
|
39
|
|
|
39
|
|
224
|
use feature qw /postderef signatures/; |
|
39
|
|
|
|
|
82
|
|
|
39
|
|
|
|
|
5166
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Toolkit for implementing voting methods. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use namespace::autoclean; |
9
|
39
|
|
|
39
|
|
10553
|
use Moose; |
|
39
|
|
|
|
|
392286
|
|
|
39
|
|
|
|
|
225
|
|
10
|
39
|
|
|
39
|
|
15167
|
use MooseX::StrictConstructor; |
|
39
|
|
|
|
|
10650407
|
|
|
39
|
|
|
|
|
284
|
|
11
|
39
|
|
|
39
|
|
308938
|
|
|
39
|
|
|
|
|
802988
|
|
|
39
|
|
|
|
|
288
|
|
12
|
|
|
|
|
|
|
use Data::Dumper; |
13
|
39
|
|
|
39
|
|
377568
|
use Time::Piece; |
|
39
|
|
|
|
|
102672
|
|
|
39
|
|
|
|
|
2793
|
|
14
|
39
|
|
|
39
|
|
14761
|
use Path::Tiny; |
|
39
|
|
|
|
|
258545
|
|
|
39
|
|
|
|
|
267
|
|
15
|
39
|
|
|
39
|
|
5676
|
use Vote::Count::Matrix; |
|
39
|
|
|
|
|
24548
|
|
|
39
|
|
|
|
|
2025
|
|
16
|
39
|
|
|
39
|
|
17883
|
# use Storable 3.15 'dclone'; |
|
39
|
|
|
|
|
162
|
|
|
39
|
|
|
|
|
2458
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
no warnings 'experimental'; |
19
|
39
|
|
|
39
|
|
583
|
|
|
39
|
|
|
|
|
118
|
|
|
39
|
|
|
|
|
9863
|
|
20
|
|
|
|
|
|
|
our $VERSION='2.02'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Vote::Count - a tool kit for preferential ballots |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 VERSION 2.02 |
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|Vote::Count::Catalog> |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Catalog of Preferential Voting Methods implemented by Vote::Count and the Modules providing them. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 L<MULTIMEMBER|Vote::Count::MultiMember> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Overview of Preferential Ballots for Multi-Member Elections and their implementation in Vote::Count. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# This should be in tiebreaker's BUILD but |
53
|
|
|
|
|
|
|
# I've found role's BUILD unreliable. |
54
|
|
|
|
|
|
|
if ( defined $self->TieBreakMethod ) { |
55
|
177
|
|
|
177
|
|
344
|
if ( lc( $self->TieBreakMethod ) eq 'precedence' ) { |
|
177
|
|
|
|
|
313
|
|
|
177
|
|
|
|
|
285
|
|
56
|
177
|
100
|
|
|
|
5633
|
unless ( defined $self->PrecedenceFile() ) { |
57
|
71
|
100
|
|
|
|
1875
|
die |
58
|
13
|
100
|
|
|
|
344
|
'Precedence File must be defined when setting TieBreakMethod to Precedence'; |
59
|
1
|
|
|
|
|
30
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
if ( $self->TieBreakerFallBackPrecedence ) { |
63
|
|
|
|
|
|
|
no warnings 'uninitialized'; |
64
|
176
|
100
|
|
|
|
5168
|
my $tb = $self->TieBreakMethod; |
65
|
39
|
|
|
39
|
|
304
|
if ( $tb eq 'none' or $tb eq 'all' or !defined($tb) ) { |
|
39
|
|
|
|
|
98
|
|
|
39
|
|
|
|
|
14143
|
|
66
|
8
|
|
|
|
|
227
|
die |
67
|
8
|
100
|
33
|
|
|
186
|
"FATAL: TieBreakerFallBackPrecedence will not be triggered if the TieBreakMethod is none, all or undefined.\n"; |
|
|
|
66
|
|
|
|
|
68
|
3
|
|
|
|
|
90
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my $self = shift; |
73
|
|
|
|
|
|
|
# Verbose Log |
74
|
|
|
|
|
|
|
$self->{'LogV'} = localtime->cdate . "\n"; |
75
|
177
|
|
|
177
|
0
|
216587
|
# Debugging Log |
76
|
|
|
|
|
|
|
$self->{'LogD'} = qq/Vote::Count Version $VERSION\n/; |
77
|
177
|
|
|
|
|
862
|
$self->{'LogD'} .= localtime->cdate . "\n"; |
78
|
|
|
|
|
|
|
# Terse Log |
79
|
177
|
|
|
|
|
24598
|
$self->{'LogT'} = ''; |
80
|
177
|
|
|
|
|
677
|
# Force build of Active, Methods that deal with it often go to $self->{'Active'} |
81
|
|
|
|
|
|
|
# make sure it is built before this happens, Active has to be built after |
82
|
177
|
|
|
|
|
14597
|
# loading ballotset. |
83
|
|
|
|
|
|
|
$self->GetActive(); |
84
|
|
|
|
|
|
|
$self->_tiebreakvalidation(); |
85
|
|
|
|
|
|
|
} |
86
|
177
|
|
|
|
|
1039
|
|
87
|
177
|
|
|
|
|
1078
|
# load the roles providing the underlying ops. |
88
|
|
|
|
|
|
|
with |
89
|
|
|
|
|
|
|
'Vote::Count::Common', |
90
|
|
|
|
|
|
|
'Vote::Count::Approval', |
91
|
|
|
|
|
|
|
'Vote::Count::Borda', |
92
|
|
|
|
|
|
|
'Vote::Count::BottomRunOff', |
93
|
|
|
|
|
|
|
'Vote::Count::Floor', |
94
|
|
|
|
|
|
|
'Vote::Count::IRV', |
95
|
|
|
|
|
|
|
'Vote::Count::Log', |
96
|
|
|
|
|
|
|
'Vote::Count::Score', |
97
|
|
|
|
|
|
|
'Vote::Count::TieBreaker', |
98
|
|
|
|
|
|
|
'Vote::Count::TopCount', |
99
|
|
|
|
|
|
|
; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
#INDEXSECTION |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=pod |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 INDEX of Vote::Count Modules and Documentation |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=over |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
L<Vote::Count - a tool kit for preferential ballots> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L<Vote::Count::Approval> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item * |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
L<Vote::Count::Borda> |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
L<Vote::Count::BottomRunOff> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
L<Vote::Count::Catalog> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item * |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
L<Vote::Count::Charge> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item * |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
L<Vote::Count::Charge::Cascade> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item * |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
L<Vote::Count::Common> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item * |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
L<Vote::Count::Floor> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
L<Vote::Count::Helper> |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
L<Vote::Count::Helper::FullCascadeCharge> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L<Vote::Count::Helper::NthApproval> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L<Vote::Count::Helper::Table> |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
L<Vote::Count::Helper::TestBalance;> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
L<Vote::Count::IRV> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
L<Vote::Count::Log> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
L<Vote::Count::Matrix> |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
L<Vote::Count::Method::Cascade> |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
L<Vote::Count::Method::CondorcetDropping> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
L<Vote::Count::Method::CondorcetIRV> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
L<Vote::Count::Method::CondorcetVsIRV> |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item * |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
L<Vote::Count::Method::MinMax> |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item * |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
L<Vote::Count::Method::STAR> |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=item * |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
L<Vote::Count::Method::WIGM> |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item * |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
L<Vote::Count::MultiMember - Overview of Multi Member and Proportional Elections and Vote::Count support for them.> |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item * |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
L<Vote::Count::Overview> |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item * |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
L<Vote::Count::Range> |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=item * |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
L<Vote::Count::RankCount> |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=item * |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
L<Vote::Count::ReadBallots> |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=item * |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
L<Vote::Count::Redact> |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=item * |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
L<Vote::Count::Score> |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item * |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
L<Vote::Count::Start> |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=item * |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
L<Vote::Count::TextTableTiny> |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=item * |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
L<Vote::Count::TieBreaker> |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=item * |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
L<Vote::Count::TopCount> |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=back |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=cut |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
#FOOTER |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=pod |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
BUG TRACKER |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
L<https://github.com/brainbuz/Vote-Count/issues> |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
AUTHOR |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
John Karr (BRAINBUZ) brainbuz@cpan.org |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
CONTRIBUTORS |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
Copyright 2019-2021 by John Karr (BRAINBUZ) brainbuz@cpan.org. |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
LICENSE |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
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>. |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
SUPPORT |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
This software is provided as is, per the terms of the GNU Public License. Professional support and customisation services are available from the author. |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=cut |
281
|
|
|
|
|
|
|
|