Closed David1one closed 4 years ago
Are you using the the latest pypi/pip package version or master branch version?
I'm using the pip version, 1.0.9.
I have actually fixed this in the master branch already.
I have now released it as a new version in PyPI, so if you upgrade the package it should probably work.
pip install -U pyrankvote
The change should have been pushed till PyPI for some time ago. I initially thought it would make more sense to pick a candidate at random if ballots where exhausted, but I later changed it because it is not a very common practice among STV-systems.
I also did some other changes at the same time, like electing and rejecting more than one candidate per round if possible, so the results are now more compact. The hope was also to be able to clean up the code a bit before releasing it as version 2, but I never got around to it.
—Jon
As you say Jon, this now provides the correct output.
Thank you very much for updating the package!
-David
Thanks for reporting this issue by the way. It is nice to get some feedback on unexpected behaviour even if it's not strictly a bug.
And thanks for descriptive titles, splitting up the issues and providing example code. It makes it a lot quicker to investigate.
No worries! Thanks for packaging the updated version into pip.
Instead of discarding votes that are not transferable, the single_transferable_vote function appears to randomly reallocate votes that do not have further preferences specified.
See test data: In Milo's elimination round, two ballots specify only Milo as a preference. But instead of these two ballots being discarded, they are randomly redistributed to Rua and Maeve.
STV bug report - input.txt STV bug report - output.txt