7

I'm looking for a voting algorithm that picks the winners based on combination of majority of votes and number of votes.

Real life example:

Our company has a cereal bar. We have room for 3 different cereals. We want to allow our employees to vote on which cereals they want.

We don't want to strictly pick the top 3 winners based on popularity because there may be a minority of employees who can only eat 1 particular cereal (for whatever reason) and we'd like to give them special allowance as possible.

Given the following vote outcome, here is the results we'd like the algorithm to give us.

Vote scenario and desired outcome

I'm looking for an algorithm that does this kind of ranking. If you can at least provide the name of what I'm looking for that would be a big help as I could search for it better. :)

Thanks!

joshuapoehls
  • 32,695
  • 11
  • 50
  • 61
  • 2
    One thing to bear in mind is that your problem as described gives more power to people who select fewer choices. If I'm happy with any of them, but particularly fond of one, I could claim that's the only one I like, and practically 'force' you to choose it, since I provided no alternatives. – Nick Johnson Dec 14 '11 at 22:58
  • @NickJohnson Perhaps that's as it should be since, in that case, you're saying if you cannot have X then you have no preference for the others. There is no guarantee that your one constraint will be selected if the problem is not solvable. – PengOne Dec 14 '11 at 23:18
  • @PengOne No guarantee, no, but your preference is more likely to be respected than those of another more honest voter. This is more apparent if you're asked to rank items in preference order. If I'm honest and rank my favorite 3 from 1 to 3, I'm less likely to get my desired outcome than if I only rank my favorite, and assign no value to the others. – Nick Johnson Dec 14 '11 at 23:32

3 Answers3

5

There is no one perfect voting system - see http://en.wikipedia.org/wiki/Arrow%27s_impossibility_theorem. There have been various attempts to get past this by bending the rules, including http://en.wikipedia.org/wiki/Range_voting.

One idea close to range voting is to give everybody 12 votes and allow them to distribute them as they wish. Looking at your example, if you assume that people who have multiple choices distribute their 12 votes equally - 12x1 or 6x2 or 4x3 or 3x4 - then I think that you get your desired outcome, with Lucky Charms getting a total of 10 votes and everything else getting more than this.

mcdowella
  • 19,301
  • 2
  • 19
  • 25
  • I love that theorem. The title of this question immediately leads your thoughts on it, I suppose. – Thomas Ahle Dec 15 '11 at 00:53
  • Voting has been on my mind this year - the UK had a referendum to change from first past the post voting to what we call the Single Transferrable Vote and I think the US may know as instant runoff. (The attempt to change the system failed). – mcdowella Dec 15 '11 at 04:53
  • What you describe is not range voting. In range voting you can give any of the choices as many points as you like. – Argeman Apr 19 '12 at 11:37
2

If the number of cereals is small, you can view your problem as a subset-cover problem and brute force your way to finding what configuration gives the most "happyness"

var max_happyness = -INF
for every subset {c1, c2, c3} of C:
    max_hapyness = max(max_happyness, happyness(i1,i2,i3))

You still have the problem of defining a suitable happyness function though. For example, you could choose a happyness function that as a first priority computes the number of people that get to eat any food. Then as a second priority the number of people that like two of the cereals, then those who like three cereals and so on.

Pros: If you can define a happyness function, this gives the guaranteed best result.

Cons: You have to be able to define a happyness function.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
hugomg
  • 68,213
  • 24
  • 160
  • 246
2

You may want to consider generalizations of Hall's marriage theorem and/or the assignment problem.

The idea for this paradigms is to create a bipartite graph where the nodes are people and cereals, with an edge between person p and cereal c if p voted for c. The goal is to select 3 cereals such that the graph resulting from removing all other cereals is

  1. connected (everyone will eat at least one of the selected cereals), and

  2. maximizes the minimum/average degree of each person (maximizes min/avg happiness)

You could instead think about this as a Maximum Coverage Problem. In this case, you have sets C1,C2,...,Cm where Ci is the set of people who like cereal i. For you example, taking the cereals and people in the order listed in the table, you have

C1 = {1,5}
C2 = {2}
C3 = {1,4,5}
C4 = {3,5}

Let n be the number of people, so that Ci is a subset of {1,2,...,n}. The goal is to find k sets such that the cardinality of the union is maximized. If multiple solutions exist, choose the one that minimizes the cardinality of intersections (minimizes the amount by which one person dominates) or maximizes the number of times the least frequent element is repeated (maximizes the happiness of the least happy person).

For this example, there smallest k for which all elements are covered is k=3 and it gives the unique solution C2,C3,C4.

However you look at it, you have an NP-problem, but there are known algorithms to solve them (check the wikipedia articles for references).

PengOne
  • 48,188
  • 17
  • 130
  • 149
  • While its true that it is NP complete, hopefully the number of types of cereal / politicians is small enough to make brute force search feasible. – hugomg Dec 15 '11 at 02:12