-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for final ranking of test ballots #52
Comments
Hi, If you're interested. I collected many examples from various sources, to build many tests for my Condorcet 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. |
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. For ballotI use a very simple format describe here : For ResultSame way: $election->getResult('Schulze Winning')->getResultAsString(); // Return a string like "A > B = C > D > E > G = H" For Condorcet pairwiseI 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. For method statsThe 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
The text was updated successfully, but these errors were encountered: