GithubHelp home page GithubHelp logo

haritha-j / ballot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from conorwilliams/ballot

0.0 0.0 0.0 344 KB

Code for the Churchill MCR postgraduate-rooms ballot

License: Mozilla Public License 2.0

C++ 60.41% Java 26.10% CMake 13.49%

ballot's Introduction



MCR Room Ballot

Welcome to the Churchill MCR postgraduate-room-ballot code, please read on to find out how to:

  1. Run the ballot code if you are the computing officer this year.
  2. Verify that the room ballot was run honestly!

Installation

To build the codebase you will need a c++ compiler supporting c++20, git, make, and a version of cmake greater than or equal to 3.14. Then follow the standard procedure:

git clone https://github.com/ConorWilliams/ballot
cd ballot
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make

You will now have your very own copy of the ballot executable!

Alternatively 64-bit Linux binaries are provided with each release.

Running the ballot

First up you're your going to need a csv file containing everyone's room preferences see example/example.csv to get an idea of the expected format. Now compile the program, navigate to example/ and run the ballot like:

../build/ballot run example.csv

This will generate two files public_ballot.json and secret_ballot.csv. The first can be distributed and used by members of the MCR to anonymously verify the ballot was run fairly. The second contains the room assignments and some additional info. You should email each student their result, "id" and "secret_name" (last three fields in secret_ballot.csv respectively).

If you would like to encourage particular rooms to fill up (e.g. the hostels) then you can pass in a list of prefixes, for example:

../build/ballot run example.csv -h RR CJ

would preferentially fill all rooms beginning with the letters "RR" or "CJ".

Finally you can control the total number of allocated rooms using the -m or --max-rooms options.

Verifying the ballot

To verify the MCR computing officer hasn't fiddled your position you need a copy of the public_ballot.json file they generated, your "id" and "secret_name" which you should have received securely. Now run:

./ballot verify YOUR_ID YOUR_SECRET_NAME

where you can supply the optional flag -i /path/to/public_ballot.json to specify the location of the public ballot file if it is not in your current working directory.

Details about the ballot

The ballot code formulates the task as solving the balanced linear assignment problem. We define a cost function which assigns a value to allocating any student to any room. The student-room pairs are then permuted until the global minimum of the cost function (value summed over all pair) is found. This is done using the Jonker-Volgenant algorithm.

In order to allow the possibility that all students get kicked off the ballot the list of rooms is augmented with p (the number of people) "kicked-rooms". To ensure balanced assignment, preference-free null-people are appended to the list of people.

If the total number of allocated rooms needs to be limited the lowest priority students are removed from the ballot.

The cost function

In summary, the cost function prioritises people getting their first choices but prefers kicking people off the ballot to assigning them to a room they didn't want. Finally, the cost function ensures all houses designated as "hostels" are preferentially filled.

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.