Condorcet Class version :
Number of Candidates :
countCandidates(); ?>
|
Number of votes :
countVotes(); ?>
Candidates list :
getCandidatesList() as $candidatName) {
echo '- '.$candidatName.'
';
}
?>
Registered votes details :
getVotesList() as $vote) {
echo '';
echo '
'.implode(' / ', $vote->getTags()).'';
echo '
';
foreach ($vote as $rank => $value) {
if ($rank === 'tag') {
continue;
} ?>
';
}
?>
Get pairwise :
getPairwise())); ?>
computed in getLastTimer(), 5); ?> second(s).
getWinner() !== null) {
echo $election->getWinner();
} else {
echo 'The votes of this group do not allow natural Condorcet winner because of Condorcet paradox.';
}
?>
getLoser() !== null) {
echo $election->getLoser();
} else {
echo 'The votes of this group do not allow natural Condorcet loser because of Condorcet paradox.';
}
?>
Some pratices about default method :
Use default method :
Defaut:
getResult())); ?>
Change it to MiniMax_Margin :
Defaut:
getResult())); ?>
Vote manipulation :
Display votes with tag "custom_tag_One"
getVotesList('custom_tag_One', true) as $vote) {
echo '';
echo '
'.implode(' / ', $vote->getTags()).'';
echo '
';
foreach ($vote as $rank => $value) {
if ($rank === 'tag') {
continue;
} ?>
';
}
?>
Or without with tag "custom_tag_Two"
getVotesList('custom_tag_Two', false) as $vote) {
echo '';
echo '
'.implode(' / ', $vote->getTags()).'';
echo '
';
foreach ($vote as $rank => $value) {
if ($rank === 'tag') {
continue;
} ?>
';
}
?>
Get a ranking without "custom_tag_One" & "custom_tag_Two" tags and display Kemeny-Young result but don't delete it
['custom_tag_One', 'custom_tag_Two'],
'withTag' => false,
];
var_dump(CondorcetUtil::format($election->getResult('KemenyYoung', $options))); ?>
Delete vote with "custom_tag_One" & "custom_tag_Two" tags and display Kemeny-Young result
removeVotesByTags(['custom_tag_One', 'custom_tag_Two']);
?>
getResult('KemenyYoung'))); ?>
Check the new vote list
getVotesList() as $vote) {
echo '';
echo '
'.implode(' / ', $vote->getTags()).'';
echo '
';
foreach ($vote as $rank => $value) {
if ($rank === 'tag') {
continue;
} ?>
';
}
?>