Various algorithms and tools for stable matching problems
Project description
pyhrtc
pyhrtc is a Python module to inspect various types of stable matching problems. In particular, it can handle the Hospital-Residents problem with both Ties and Couples, also known as HRTC. Having no couples reduces this to the Hospital-Residents problem with Ties, HRT, and by letting all hospitals have capacity 1 we get the Stable Marriage with Ties and Incomplete Lists problem, SMTI.
Features
This package can currently
- read instance files in multiple formats,
- write instance files,
- inspect agents (residents and hospitals),
- combine some pairs of agents into couples,
- find maximum size matchings,
- find maximum size and maximum weight stable matchings.
Status
File formats
This package supports a number of file formats. For these, we will talk about the set of "left" and "right" agents. These are the two bi-partitions of the agents, such that agents on the left may only express preferences for agents on the right, and vice-versa.
The Glasgow format
This format used by researchers working at the University of Glasgow, or their collaborators.
The first line should just be a zero (0). The next two lines contain the number of agents in the left and right partitions respectively. Following this, we have one line for each agent on the left, and then one line for each agent on the right. These are as follows:
For agents on the left, first the line contains an identifier (numeric only), and then the preferences. Preferences within brackets indicate a tie.
For agents on the right, first the line contains an identifier (numeric only), and then the agent's capacity, and then the preferences. Preferences within brackets indicate a tie.
SMTI-GRP
A CSV file containing a row-column matrix, with the first row and columns used as identifiers, can be read in to create an instance of SMTI-GRP.
There is also a second format for SMTI-GRP, which does not have headings. This file contains, as its first two lines, the number of rows and columns respectively. The rest of the file is the matrix of scores, separated by spaces only.
Future plans
This mostly started as a tool to inspect instances of HRTC for various parameters, but it is growing. One day I might even write up a model that would solve HRTC, but that day is not today.
Can I help?
Yes! If you want to add features, or request features, please just raise an issue. I can't promise anything, but it's good to know what people want.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyhrtc-0.0.6.post1.tar.gz
.
File metadata
- Download URL: pyhrtc-0.0.6.post1.tar.gz
- Upload date:
- Size: 28.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c5547fb714db9447df1134d934fceaa27bcbce6971c2c16850dbd6702568e1a |
|
MD5 | 9af6029ae8c3649235c32bda9c6fd94b |
|
BLAKE2b-256 | a6e903b14a44775d87b0230aa5d223fa154f1d86c35aa533f6f0f2a4286a7a62 |
File details
Details for the file pyhrtc-0.0.6.post1-py3-none-any.whl
.
File metadata
- Download URL: pyhrtc-0.0.6.post1-py3-none-any.whl
- Upload date:
- Size: 31.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 651130f8085792a0b0b9bb74daa55452abfca2ed53d662eb4457c617e1f0a43a |
|
MD5 | 2f14dcee7007c2633b7740a2b1bdc7a1 |
|
BLAKE2b-256 | 7d88797e61a7caced3d392d5b0f0a92e3ce7c6f5a8375267218569ea5b808f0f |