Coder Social home page Coder Social logo

rcir's Introduction

RCIR

RCIR is a ranked choice instant runoff library written in rust. It's a work in progress. The library is in the rcir directory, and a sample binary is in the rcir_csv directory.

In the result of a tie for last place and no winner, all the last place candidates are removed, so it is not a 'Spoiler Proof' method Spoiler Effect + Resistance to tactical voting

RCIR will not mutate the input and aims to have as few restrictions on data types as possible

Example

Voter A Voter B Voter C Voter D Voter E
Bob Sue Bill Bob Sue
Bill Bob Sue Bill Bob
Sue Bill Bob Sue Bill

This would result in an ElectionResult::Winner(&"sue") under either operational mode

Tie Example

Voter A Voter B
Bob Sue

This would result in an ElectionResult::Tie([&"Bob", &"Sue"]) under either operational mode

Modes of operation

RCIR has 2 modes of operation:

  • Complete Majority
  • Remaining Majority

The differences between the two can best be explained with this sample:

Start

Voter A Voter B Voter C Voter D Voter E
Alice Bob Chris Sam Alice
Sam Sam Bob Chris Chris

After Round 1

Bob, Chris, and Sam are eliminated (lowest vote getters)

Voter A Voter B Voter C Voter D Voter E
Alice _ _ _ Alice
_ _ _ _ _

Under CompleteMajority, there is no winner and the result would be: ElectionError::NoMajorityWinner because Alice has 2/5 votes, which is below the 50% threshold for a complete majority.

Under RemainingMajority, the result would be an ElectionResult::Winner(&"Alice") because Alice has 100% (2/2) of the remaining ballots of voters who still have candidates left.

rcir's People

Contributors

livinginsyn avatar timotree3 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.