Politico's New Yorkers pick a new mayor after chaotic, historic primary begins:
NEW YORK — Polls have closed in New York City’s first ever ranked-choice election and, while the die has been cast, voters may not know the outcome for weeks.
[...] Further extending the ballot count is the advent of ranked-choice voting, which allows New Yorkers to select up to five candidates for each position. The system kicks in when no candidate attains 50 percent of votes on the first pass. The board plans to issue preliminary results of ranked ballots on June 29.
According to this:
More than a dozen Democrats and two Republicans will vie to replace outgoing Mayor Bill de Blasio (D). The ranked-choice election is expected to take weeks to resolve.
So the number of distinct yet valid ways a person could vote is large. I think that it's the sum of 0-, 1-, 2-, 3-, 4- and 5-from-14 possibilities, but I'm not even sure of that (see below).
I'm curious how New York City will physically and computationally implement ranked-choice vote counting.
Question: Algorithmically it can be done via several passes of a sorting function over all ranked-choice votes in a table in memory or on a hard drive, but how do they implement this with the various physical forms of votes cast in New York's mayoral election?
Will they resort to all electronic implementation of the algorithm, all physical, or some hybrid method?
In Python, assuming (for example) exactly 14 candidates available (in math it's number of k-combinations; 0≤k≤5)
from itertools import combinations
possible = []
for n in [0, 1, 2, 3, 4, 5]:
uniques = list(combinations('abcdefghijklmn', n))
possible.append(uniques)
print(n, len(uniques))
all_possible = sum(possible, [])
print('total: ', len(all_possible))
n uniques
0 1
1 14
2 91
3 364
4 1001
5 2002
total: 3473