An open API service indexing awesome lists of open source software.

https://github.com/snawoot/copeland

Copeland's preferential voting method implementation.
https://github.com/snawoot/copeland

copeland preferential-voting voting voting-application voting-system

Last synced: over 1 year ago
JSON representation

Copeland's preferential voting method implementation.

Awesome Lists containing this project

README

          

# copeland

Copeland's preferential voting method implementation. Outputs Copeland's score and ranking for each candidate.

## Usage

### Create ballot files

Just create plain text files with list of preferences for each voter. One candidate name per line.

Example:

a1.txt

```
Bob
Charlie
Alice
Donald
```

a2.txt

```
Donald
Alice
Charlie
Bob
```

a3.txt

```
Alice
Charlie
Bob
Donald
```

### Run the program

```
copeland a1.txt a2.txt a3.txt
```

Example output:

```
Registered names:
ALICE
BOB
CHARLIE
DONALD

Scores:
Rank 1:
3 ALICE
Rank 2:
2 CHARLIE
Rank 3:
1 BOB
Rank 4:
0 DONALD
```

Note: candidate which scored against every other candidate (having score *N-1* with default scoring settings, where *N* is number of candidates), also happens to be a Condorcet winner.

## Synopsis

```
$ copeland -h
Usage:

copeland [OPTION]... [BALLOT FILE OR DIRECTORY]...

Process files with preference lists and output Copeland's ranking.

Options:
-names string
filename of list of names in the voting. If not specified names inferred from first ballot
-normalize-case
normalize case (default true)
-score-loss float
score for tie against opponent
-score-tie float
score for tie against opponent (default 0.5)
-score-win float
score for win against opponent (default 1)
-skip-errors
skip ballot errors, but still report them
-version
show program version and exit
```