Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question #76

Open
DrSam opened this issue Nov 4, 2022 · 2 comments
Open

Question #76

DrSam opened this issue Nov 4, 2022 · 2 comments

Comments

@DrSam
Copy link

DrSam commented Nov 4, 2022

Hi Izear
Thanks for your great work here. We are using your repo in our app Forby.io and we would like to add 2 algorithms based on some research we came across:

Minimax-TD

https://drive.google.com/file/d/1ZvId-tdOLb4vWp0pm5XZaBK2FkqkXLXh/view?usp=share_link

And Score Voting:
https://en.wikipedia.org/wiki/Score_voting
Just adds up the scores. We are using +5 to -5 as our options.

Are you interested in adding these?
I am willing to hire someone to develop these.
Thanks,
[email protected]

@lzear lzear mentioned this issue Nov 5, 2022
@lzear
Copy link
Owner

lzear commented Nov 5, 2022

Hello @DrSam
Thanks a lot for the messages, and for building something a product with smarter voting systems!

Minimax-TD

Sharing the examples you emailed me, so information don't get lost:

The inventor of Minimax-TD gave me these instructions:

The Minimax-TD process:

  1. Do the pairwise comparisons using Margins (the number of voters ranking X above Y minus the number of voters ranking Y above X. )
  2. Find the Smith Set, the smallest non-empty set of candidates such that each member defeats every candidate outside the set in a pairwise comparison. That Algorithm may be found here.
  3. If there is one member of the Smith set, that is the winner.
  4. If there are multiple members of the Smith set, using Margins Minimax method, the candidate in the Smith set with the lowest 'worst pairwise defeat' (which can be negative, equivalent to the lowest 'worst pairwise victory' if there are no defeats) is the winner. See examples below...
  5. Remove the winner and repeat the process to find each successive place (2nd, 3rd, etc)

Example 1:

A, B, and C are the members of the Smith set.

  • A beat B: 58% to 42%. (16% margin)
  • B beat C: 68% to 32% (36% margin)
  • C beat A: 70% to 30%. (40% margin)
  • A beat D: 55% to 45%. (10% margin)
  • B beat D: 60% to 40%. (20% margin)
  • C beat D: 99% to 1%. (98% margin)

Look for the lowest 'worst pairwise defeat' in all of the comparisons (not just within the smith set):

  • A's 'worst pairwise defeat' is 40% margin against C (70%-30%)
  • B's 'worst pairwise defeat' is 16% margin against A (58%-42%)
  • C's 'worst pairwise defeat' is 36% margin against B (68%-32%)
    B has the smallest 'worst pairwise defeat', therefore B is the winner.

Example 2:

A and B are the members of the Smith set. Both of them beat every other candidate but they tied each other.

  • A tied B: 50% to 50% (0% margin)
  • A beat C: 68% to 32% (36% margin)
  • A beat D: 99% to 1% (98% margin)
  • B beat C: 70% to 30% (40% margin)
  • B beat D: 60% to 40% (20% margin)
  • C beat D: 55% to 45% (10% margin)

Look for the lowest 'worst pairwise defeat', and since there are no defeats, look for the lowest 'worst pairwise victory' (not just within the smith set):

  • A's 'worst pairwise victory' is -36% margin against C (32% -68%)
  • B's 'worst pairwise victory' is -20% margin against C (40% -60%)
    A has the lowest "worst pairwise victory' against all the candidates, therefore A is the winner.

I think I'm almost done implementing it (see #80).

Note that I added an excludeTies parameter to Minimax and MinimaxTD. With this parameter true, it matches your expectation (see test on Example 2) by making the system more decisive (less ties) but also less monotonous (see monotonicity criterion).

The current state of the PR does not include "5. Remove the winner and repeat the process to find each successive place (2nd, 3rd, etc)". This will probably come in a future PR adding tie-breaking functionalities to every voting systems of the library.

When #80 is merged and the next version is released, you should be able to use it this way:

const minimaxTD = new MinimaxTD({
  candidates: ['A', 'B', 'C', 'D'],
  array: [
    [0, 50, 68, 99],
    [50, 0, 70, 60],
    [32, 30, 0, 55],
    [1, 40, 45, 0],
  ],

  // else, A and B will be tied because their worst duel is between themselves (0)
  excludeTies: true,

  // See: https://en.wikipedia.org/wiki/Minimax_Condorcet_method#Variants_of_the_pairwise_score
  variant: MinimaxVariant.Margins, // default value
})

const results = minimaxTD.scores()
// -> { A: 36, B: 20, C: -1, D: -1, }
// Note that C and D are still tied. Fixing this will be in a later release

Score Voting

I will need a bit of time to think about how to implement this, but it should be doable. I'll try to give a clearer answer within this month.

One other thing

I am extremely happy to see people interested in using this library. I think I must warn you that it's been only maintained by me, so I cannot guarantee that it is bug-free. If you or your employees can provide some help with testing, it would be greatly appreciated 😁

@DrSam
Copy link
Author

DrSam commented Dec 3, 2022

We will test it!
Thanks so much for your great work. It is truly important!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants