LivingInSyn / rcir

Ranked Choice Instant Runoff library written in Rust
MIT License
12 stars 2 forks source link

Exhausted ballots still count towards total for deciding majorities #1

Closed timotree3 closed 5 years ago

timotree3 commented 5 years ago

Consider this set of ballots:

Let's see what we get by doing an Instant-runoff vote by hand.

  1. Eliminate last place candidates:
    • Alice, ___
    • ,
    • ,
    • ,
    • Alice, ___
  2. Is there a majority out of the ballots that still have votes? Yes, Alice should win with a 2/2 majority.

Our implementation gives a different result. It counts ballots that don't have any votes left and in this case finds that Alice would need at least a 3/5 majority to win.

LivingInSyn commented 5 years ago

You're right. This behavior should be configurable

timotree3 commented 5 years ago

You're right. This behavior should be configurable

I'm glad you agree.

Regarding configuration I can't think of a use case where someone would prefer the current output (which is Err(ElectionError::VotersNoVotes)).

It seems like in order to meet user's expectations given how other sources define the algorithm it should instead return a winner (in this example Ok("alice")).

What do you think?

LivingInSyn commented 5 years ago

Hey, check out this branch:

https://github.com/LivingInSyn/rcir/commit/3f433f9d52ffd4f59b8ea38465f6090f4a53d115

Basically, I added a mode where you can operate under a 'complete majority' mode, by which you have to have >= 50% of all of the voters in agreement, or 'remaining majority' mode, where you need >= 50% of the non-empty voters

This doesn't fix the great VotersNoVotes error name, but I'll try and come up with a fix for that tomorrow

LivingInSyn commented 5 years ago

Closed in favor of:

https://github.com/LivingInSyn/rcir/pull/4

timotree3 commented 5 years ago

Cool. I'm still not clear what use case people would want to use the CompleteMajority mode. It's good for there to be a RemainingMajority option either way though. :)