Coder Social home page Coder Social logo

stablematch's Introduction

stablematch

Stable Matching Algorithm for the Hospital-Residents Problem

The Hospital-Resident problem involves finding stable matches between residents (doctors) and hospitals. This program uses an extended version of the Gale-Shapley algorithm, originally developed by Rob Irving[1].

#To build

gnatmake src/solve_hr.adb

#To generate sample data

python data/generate_preflists.py

#To run

./solve_hr < data.txt

#Input Input is given as text on standard input as follows:

  • Line 1: N, M, positive integers, numbers of residents and hospitals respectively
  • Lines 2..N+1: the resident preference lists, each has form X : A B C ...
  • Lines N+2..M+N+1: the hospital preference lists, each has form X : P : A B C ..., where P is the number of positions available

Sample data can be generated using the script generate_preflists.py in the data folder.

#Output Output is given as a list of matched pairs in the form (Resident,Hospital) saved to file as output_ro (resident-optimal) and output_ho (hospital-optimal).

#References

  1. Dan Gusfield & Robert W. Irving, The Stable Marriage Problem: Structure and Algorithms (MIT Press)

stablematch's People

Contributors

enriquecanals avatar vishnuravi avatar

Watchers

 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.