bradbeattie / python-vote-core

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

Schulze STV bug #10

Closed bradbeattie closed 14 years ago

bradbeattie commented 14 years ago
input = [
    { "count":1, "ballot":{"A":9, "B":1, "C":1, "D":9, "E":9, "F":2 }},
    { "count":1, "ballot":{"A":3, "B":2, "C":3, "D":1, "E":9, "F":9 }},
    { "count":1, "ballot":{"A":9, "B":9, "C":9, "D":9, "E":1, "F":9 }}
]
output = SchulzeSTV.calculate_winner(input, 2, "ranking")

This says that it's a tie between D/E, B/E, and B/D. However, Schulze's prog01.exe disagrees. It also suggests C/E, which we've eliminated.

M 2
C 6
N 3
F 1

BEGIN
  1 99  1  1 99 99  2
  2  3  2  3  1 99 99
  3 99 99 99 99  1 99
END

1 A B C 1.500000 0.000000 0.000000
2 A B D 1.500000 0.000000 0.000000
3 A B E 1.500000 0.000000 1.000000
4 A B F 1.500000 0.000000 1.500000
5 A C D 1.500000 0.000000 0.000000
6 A C E 1.500000 0.000000 1.000000
7 A C F 1.500000 0.000000 1.500000
8 A D E 1.500000 0.000000 0.750000
9 A D F 1.500000 0.000000 0.750000
10 A E F 1.000000 1.000000 1.000000
11 B C D 0.000000 1.500000 0.750000
12 B C E 0.000000 1.000000 1.000000
13 B C F 0.000000 0.000000 1.500000
14 B D E 1.000000 1.000000 1.000000
15 B D F 0.000000 0.750000 1.500000
16 B E F 0.000000 1.000000 1.500000
17 C D E 1.000000 1.000000 1.000000
18 C D F 0.000000 0.750000 1.500000
19 C E F 0.000000 1.000000 1.500000
20 D E F 1.000000 1.000000 1.000000

winning set: 6
B D 
winning set: 7
B E 
winning set: 10
C E 
winning set: 12
D E 
bradbeattie commented 14 years ago

prog02.exe is most certainly not running into a tie.

bradbeattie commented 14 years ago

Getting rid of

graph = CondorcetSystem.remove_weak_edges(graph)
in the schwartz_set_heuristic method solves this issue. WIll test some more first.

bradbeattie commented 14 years ago

Unit tests all pass with the same winners. Done.