Open carlschroedl opened 6 years ago
Hi,
If you're interested. I collected many examples from various sources, to build many tests for my Condorcet PHP: https://github.com/julien-boudry/Condorcet/blob/master/Tests/lib/Algo/Methods/RankedPairsTest.php
It should be noted that not all examples use the margin for ranking the pairs. Documentation on this subject is very divided. However, with the exception of test number 11, all give the same results.
Since we use the same language, it might even be conceivable for us to cross-test our implementations, it would be quite easy to do. I'll check your tests and see if I can backport them.
Hi @julien-boudry ! We admire your work. Thanks for noting a good area for us to collaborate! I like the way you are encoding the test ballots. I wonder if there is an opportunity to define a small standalone repo that defines file formats and parsers for preferential ballots, margins, and results? This would enable people to share election test scenarios across multiple applications. What do you think?
Hi,
I think it's a great idea.
I use a very simple format describe here : https://github.com/julien-boudry/Condorcet/wiki/II-%23-B.-Vote-management-%23-1.-Add-Vote
Same way:
$election->getResult('Schulze Winning')->getResultAsString(); // Return a string like "A > B = C > D > E > G = H"
I do not provide a real standard format. However, there is a method that can be easily converted to user output.
$election>getPairwise(false)->getExplicitPairwise(); // Return a simple array with candidate as string (by name) instead object.
Look like :
The case is more complicated. These stats depend on the method used, and I implement very different ones.
Without much work of reflection and standardization, however, I have implemented for each one a few data that are specific to them.
$election->getResult('Ranked Pairs Margin')->getStats() ; // Return an explicit array with candidate as string name.
Example with Ranked Pairs (test number 8) :
Perhaps I could consider writing a more formal documentation at least for the votes and results. And create the corresponding repository.
However, I won't really have much time this month. But I keep the idea!
Great ideas @julien-boudry ! Our group has a meeting tomorrow. I will talk about your ideas at the meeting.
This issue is a follow-on to #42. We added many test ballots. We added tests to check that the correct margins were produced by the MarginCalculator class. Now we need to add tests to assert that the RankedPairsCalculator class can produce the correct final ranking given the margins returned by the MarginCalculator class.
A google drive spreadsheet defines the ballots, the expected margins, and the expected final rankings for several scenarios. The expected final rankings in the spreadsheet currently include ties, but that is incorrect -- our implementation breaks ties. Before we create the RankedPairsCalculator tests, we need to update the expected final rankings in the spreadsheet to reflect our implementation's tie-breaking scheme. The tie-breaking scheme is mentioned in the README. It is implemented in the following classes:
https://github.com/pivot-libre/tideman/blob/0.x/src/MarginTieBreaker.php https://github.com/pivot-libre/tideman/blob/0.x/src/TieBreakingMarginComparator.php https://github.com/pivot-libre/tideman/blob/0.x/src/TotallyOrderedBallotMarginTieBreaker.php