julien-boudry / Condorcet

Command line application and PHP library, providing an election engine with a high-level interface. Native support 20+ voting methods, easy to extend. Support simple elections with ease or billions of votes in low resource environment. Intensively tested and highly polyvalent.
https://www.condorcet.io
MIT License
119 stars 11 forks source link

Different results when running different numbers of methods #155

Closed LiamM32 closed 1 year ago

LiamM32 commented 1 year ago

Just to test that the program works as it should for the Schulze Method, I tested the set of votes in the Wikipedia example.

I discovered some strange behaviour. Sometimes A wins, sometimes E wins with the Schulze method.

I found that if I run the program interactively, and run the votes through many different methods, then E is the winner of both Schulze methods. If I only run it through Schulze Winning & Schulze Margins, then A is the winner of both Schulze methods. If I use a .cvotes file, then A is the winner. output1.txt output2.txt output3.txt

It wouldn't let me upload the .cvotes file, so here it is:

#From Wikipedia Example: https://en.wikipedia.org/wiki/Schulze_method#Example
#/Candidates: A; B; C; D; E
#/Implicit Ranking: true
#/Weight allowed: false

#Here are the votes:
A > C > B > E > D *5
A > D > E > C > B *5
B > E > D > C > B *8
C > A > B > E > D *3
C > A > E > B > D *7
C > B > A > D > E *2
D > C > E > B > A *7
E > B > A > D > C *8
julien-boudry commented 1 year ago

There is an error in your inputs.

Output 2 and 3 are equal and give the same result. But Vote N°3 is invalid. But output 1 has a different and valid vote N°3, it is valid. So the result is different, and it's normal.

Can you confirm that can I close this issue as not a bug? ;-)

julien-boudry commented 1 year ago

If it's confusing, a project could be to migrate for permissive philosophy with silent error (can have som advantage) to a more strict error intolerant inputs.

LiamM32 commented 1 year ago

I don't think the program should stop without results when this happens, but there should be warning messages for invalid votes, and it should display a limited number of invalid votes in the output. There should also be a function in the public API to verify that a vote is valid, if there isn't already.

LiamM32 commented 1 year ago

Yes this turned out to be the case. Thank you as I could not find what was the difference between the two sets of votes. When corrected, E is the winner, as the Wikipedia example says should happen.