# Go through the voters and construct V(A,B)
+print "\nDefeats matrix\n";
+
foreach my $iv (@invotes) {
my ($votestr,$voter) = @$iv;
eval {
$ch[$i]{Dropped} = $why;
}
-print "# quorum A.6(2)\n";
+print "\nQuorum A.6(2) (quorum is $quorum)\n";
foreach my $i (0..$#choices) {
next if $ch[$i]{Dropped};
drop $i, "quorum ($v < $quorum)";
}
-print "# maj. ratio A.6(3)\n";
+print "\nMajority ratio A.6(3)\n";
foreach my $i (0..$#choices) {
next if $ch[$i]{Dropped};
return 0;
}
-print "defeats graph: $defeats\n";
-
our $schwartz;
for (;;) {
# loop from A6(5)
- print "# transitive closure A.6(5)\n";
+ print "defeats graph: $defeats\n";
+
+ print "\nTransitive closure A.6(5)\n";
my $tdefeats = $defeats->transitive_closure();
print "closure graph: $tdefeats\n";
- print "# Schwartz set A.6(6)\n";
+ print "\nSchwartz set A.6(6)\n";
$schwartz = $defeats->copy();
}
}
- print "# dropping weakest defeats A.6(7)\n";
+ print "\nDropping weakest defeats A.6(7)\n";
our @weakest = ();
$defeats->delete_edge($ia,$ib);
}
- print "# defeats within the Schwartz set, round again\n";
+ print "defeats within the Schwartz set, round again\n";
}
-print "# no defeats within the Schwartz set\n";
-print "FINAL SCHWARTZ SET:\n";
+print "no defeats within the Schwartz set\n";
+print "final schwartz set:\n\n";
+
+if ($schwartz->vertices() == 1) {
+ print "WINNER IS:\n";
+} else {
+ print "WINNER IS ONE OF (CASTING VOTE DECIDES):\n";
+}
printf " %-5s %s\n", $choices[$_], $ch[$_]{Desc}
foreach ($schwartz->vertices());