Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A package for stable matching problems with couples

Project description

Scarf

Scarf is a python library for solving stable matching problems with couples, where one application is the National Resident Matching Program. The package is named after Hebert Scarf, the inventor of Scarf's lemma and algorithm.

Features

  • Written in python3.
  • Solve for a near feasible stable matching given the preference of doctors and hospitals, and hospital capacities.
  • Generate random doctor hospital instances.
  • Accelerated with Numba. It is fast!

Accepted input format:

  • Python Lists
  • JSON

Algorithms:

Installation

pip install scarfmatch

Usage

  import scarf
  single_pref = [[0, 1, 2], 
                 [1, 0]]
  couple_pref = [[(0, 0), (1, 1), (1, 0), (0, 1), (2, 2)],
                 [(1, 1), (2, 2), (1, -1)]]
  hospital_pref = [0, (0, 1), 1, (1, 0), (0, 0), (1, 1)]
  hospital_cap = [2, 3, 1]

  S = scarf.create_instance(single_pref, couple_pref, hospital_pref, hospital_cap)
  sol = scarf.solve(S)

Support

License

Released under MIT license

Copyright (c) 2019 Dengwang Tang <dwtang@umich.edu>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for scarfmatch, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size scarfmatch-0.0.2-py3-none-any.whl (18.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size scarfmatch-0.0.2.tar.gz (16.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page