Project rename broke builds.
Fixes build; prettifies output
Modified for ties
This is a simple implementation of a post on r/EndTPTP. The poposal suggested a modification of STAR to address some percieved deficiences. The proposal is described in detail on the MARS voting ElectoWiki page.
In this repository is an implementation of the proposal, plus two sets of input data to test it with.
Binaries are available from https://downloads.ser1.net/software/ (note the trailing slash). Binaries are signed with my public key, 7ABD6668FDD1 (which is available from public keyservers).
Using the example data in the repository:
10235(hg:default)ยป go run main.go < input-1.csv
Total votes in input: 15
Summary of distributions
# A B C
7 5 4 0
5 0 1 5
2 4 1 5
1 0 5 1
Subtotals
# A B C
43 40 36
Winner by score: A with 43
Summary of diffs
# A B C
7 0 -5 -5
6 0 5 5
2 0 -5 5
Modifiers
# A B C
0 -15 5
Totals
# A B C
43 25 41
Highest combined total: A with 43
As in the comments in the thread, if the voter who voted 0,5,1 changes their score to 0,5,4 then it tips the balance and the vote goes to candidate C:
...
Totals
# A B C
43 25 44
Highest combined total: C with 44
Other data sets can be downloaded from the repository; they're simple CSV files. The first line is the list of candidates, e.g. "Zippy,Zaphod,Mr. Toad,Y. Cornelius", and following lines are score votes for each candidate (one vote per line). Min/max score values are taken from the scores (max is the max score seen in the file; min is the smallest; the range is max-min).
Binaries are available from https://downloads.ser1.net/software/ (note the trailing slash), or you can review the code and build (and run it) yourself. The entire program is one file with no external dependencies and 327 lines of code.
To build (or run the source) you need go. You can
either go get
to build a binary or go run
the project.
go get hg.sr.ht/~ser/MARS
You'll get a program called MARS
in your $GOPATH/bin
, usually
~/go/bin
. Compiled or downloaded, you would then either download an input
file from the repository, or create your own, and run it with:
MARS < inputdataset.csv
Alternatively, check out the repository and run it on the command line:
hg clone https://hg.sr.ht/~ser/MARS
cd MARS
go run . < input-1.csv
The program takes no arguments and reads data from the command line. The data file is described above and sample data sets can be downloaded from the repository. For example, two people voting between three candidates would have three lines:
Candidate A,Candidate B,Candidate C
5,4,0
4,1,5
Voter 1 scores candidate A 5, candidate B 4, and candidate C 0. Voter 2 scored A 4, B 1, and C 5.
In the repository data sets, input-X.csv
is a base set; input-X.Y.csv
is a mutation of the data set, usually by a single vote, to demonstrate how
a vote change affects the outcomes.
The original post was made by u/jan_kasimir on 2020-02-13.
As the system has evolved, I'm removing the history from this README; see either the Reddit discussion or the ElectoWiki page for details.