endolith / elsim

Election Simulator 3000: Simulates a variety of elections and voting methods
https://endolith.github.io/elsim
MIT License
7 stars 4 forks source link

Switch ranked ballot representation? #8

Open endolith opened 2 years ago

endolith commented 2 years ago

Currently it's using the representation that matches how we often write ballots:

A > B > C
B > C > A
B > A > C

becomes

0, 1, 2
1, 2, 0
1, 0, 2

Where rows are voters, columns are rankings, and cells contain candidate IDs.

But this format doesn't allow for expressions of indifference, and for elimination methods, this requires either shuffling cells around or separate pointers for each row and is a bit clunky.

The other convention is more general because it allows indifference:

1, 2, 3
3, 1, 2
2, 1, 3

Here the rows are voters, columns are candidates, and cells store rankings. Does this also simplify or speed up the calculation of elimination methods? Borda just becomes a column sum, for instance.