bradbeattie / python-vote-core

Python libraries for various electoral methods
http://modernballots.com
Other
140 stars 36 forks source link

One voter for two candidates in SchulzeSTV is broken #8

Closed bradbeattie closed 14 years ago

bradbeattie commented 14 years ago

Have an election for two candidates in which only one voter votes. They vote as follows:

A: 1
B: 1
C: 2
D: 2

You'd expect paper and metal to win, but the current implementation is throwing back some odd results. Schulze's prog02.exe produces the following result:

A 0.000000 0.500000 1.000000 1.000000
B 0.500000 0.000000 1.000000 1.000000
C 0.000000 0.000000 0.000000 0.500000
D 0.000000 0.000000 0.500000 0.000000
The 1. place goes to candidate A.

B 0.000000 0.500000 0.500000
C 0.000000 0.000000 0.500000
D 0.000000 0.500000 0.000000
The 2. place goes to candidate B.

C 0.000000 0.333333
D 0.333333 0.000000
The 3. place goes to candidate C.

The 4. place goes to candidate D.
bradbeattie commented 14 years ago

Fixed. The problem was a broken int/float conversion during the vote management strength calculation.