How this calculation works
Compute a strict consensus ranking minimizing weighted pairwise ballot disagreement, with an exact count of all optimal rankings.
F(S)=min_{v∈S}[F(S\{v})+Σ_{u∈S\{v}}P(v,u)], where P(v,u) is ballot weight ranking v above u.A worked example
Equally weighted ballots 0>1>2, 1>2>0 and 2>0>1 have a majority cycle. Ranking 0>1>2 scores 1+1+2=4; three strict rankings attain that optimum.
Good to know
1–14 candidates labeled 0 through n−1, 1–200 complete strict ballot rows. Each row begins with integer weight 0–1,000,000; positive total required. Exact integer subset scores and arbitrary-size optimal-ranking count. One displayed witness, no incomplete ballots, tied input ranks, imposed precedence or fairness guarantee.
Reference: Meila and colleagues: Kemeny ranking objective and exact methods (opens in a new tab) ↗
Minimize total pairwise disagreement
A Kemeny consensus ranking is a strict ordering that minimizes its weighted disagreement with the input ballots. Each unordered candidate pair contributes one disagreement for a ballot when the consensus reverses that ballot's relative order. A ballot weight multiplies every pair disagreement from that row.
This is an optimization criterion rather than a probabilistic model of how preferences arise. It differs from averaging numerical rank positions and from fitting Plackett–Luce parameters. The resulting consensus need not be one of the supplied ballots, and pairwise majority preferences can form a directed cycle.
Compare this with the Plackett Luce ranking model calculator from complete rankings. Minimize total pairwise ballot disagreement over a consensus permutation, rather than estimate a probabilistic ranking model.
Ballots must be complete strict permutations
Declare the number of candidates, labeled zero through n minus one. Each ballot row begins with its nonnegative integer weight, followed by every candidate exactly once in most-preferred-first order. A missing candidate or repeated candidate would leave the pairwise score ambiguous and is rejected.
A zero-weight row has no influence, but the total ballot weight must be positive. Incomplete rankings and tied positions require an additional disagreement convention and are not silently expanded here. The calculator also does not infer individual voters from row weights; one row may summarize many identical ballots.
Subset dynamic programming with a last candidate
Let P(u,v) be the total ballot weight preferring u over v. If candidate v is placed last among a subset S, every other member u precedes v in the consensus. The added disagreement is therefore the sum of P(v,u) over those earlier members.
The algorithm evaluates every possible last candidate and combines that cost with the best ranking of the remaining subset. Exact integer score comparisons select the minimum. A second dynamic-program value counts all optimal strict rankings, using arbitrary-size integers so that a large number of ties does not overflow an ordinary browser number.
A cyclic default produces three optima
The default has three equally weighted ballots: 0 above 1 above 2, 1 above 2 above 0, and 2 above 0 above 1. Each candidate beats another by two ballots to one, producing a majority cycle instead of a consistent majority ordering.
For consensus [0,1,2], pairs 0–1 and 1–2 each disagree with one ballot, while pair 0–2 disagrees with two ballots. The score is one plus one plus two, or four. Two cyclic rotations attain the same score, so the calculator reports three optimal rankings and does not claim the displayed witness is unique.
Inspect the score pair by pair
The returned ranking lists candidates from highest to lowest. Its pair-disagreement table states the weight opposing each chosen relative order. Summing those rows reproduces the scalar Kemeny score, which gives a transparent audit independent of the subset recurrence.
The pairwise-preference matrix records both directions, so P(u,v) plus P(v,u) equals the total ballot weight for distinct candidates. That equality is a useful input consistency check. The diagonal remains zero because a candidate is never compared against itself, and it must not be interpreted as a self-preference measurement.
Exact limits and tie interpretation
At most fourteen candidates and two hundred ballot rows are supported, with bounded nonnegative integer weights. There are 16,384 candidate subsets at the maximum size. Scores remain safe integers under the admitted bounds, while the count of optimal rankings is returned as an exact decimal string.
Only one optimal ordering is displayed even when the count is larger than one. The count refers to different strict labeled permutations, not to different ways of renaming the same candidates. If a policy requires a particular tie-break rule, apply it transparently; the calculator does not conceal a tie by treating its deterministic reconstruction order as a unique consensus.
Keep the aggregation question distinct from fairness
Minimizing total disagreement is one defensible rule for combining rankings, but it does not establish that every ballot is equally informed or that the weights are fair. Those are modeling decisions supplied before the optimization. Changing the weights can change the optimum even when every ballot order stays the same.
The method also does not guarantee that every input voter considers the consensus acceptable. A compromise can minimize the aggregate score while disagreeing substantially with a particular ballot. Use the score table and the reported optimum count to understand those tensions, rather than presenting the final order as an objective truth about the candidates.
A few questions, answered
What is the ballot row format?
Enter a nonnegative integer weight first, followed by every candidate label exactly once in most-preferred-first order.
Can majority preferences form a cycle?
Yes. The default has three cyclic majorities, so no strict ranking agrees with every majority pair.
Does the displayed order imply a unique optimum?
No. Inspect the exact optimal-ranking count; only a count of one establishes uniqueness for this input.
Can I enter tied or incomplete ballots?
No. Those inputs require a different disagreement convention and are explicitly outside this page’s model.