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