This repository includes two matching algorithms that are used for Pair Research:
- Stable Roommates Matching
- Maximum Weighted Matching
- Python 3.13
- uv
- Run
uv syncto set up your virtual environment and install packages. - Activate environment using
source .venv/bin/activate. - Run
pre-commit installto set up commit hooks for Python linting + formatting, and Markdown formatting. - Run
jupyter notebookto start a notebook server. Analysis notebooks are contained in thesr_analysis/directory.- You will need an
.envwith the MongoDB URI to the Pair Research database asMONGO_URI=<URI>.
- You will need an
cat input.json | python pair_research.pyExample:
Input: [(0, 1, 93), (0, 2, -20), (0, 3, 2), (1, 2, -13), (1, 3, 10), (2, 3, 80)]
- Matching person 0 and person 1 gives a score of 93
- Matching person 0 and person 2 gives a score of -20
- Matching person 0 and person 3 gives a score of 2
- Matching person 1 and person 2 gives a score of -13
- Matching person 1 and person 3 gives a score of 10
- Matching person 2 and person 3 gives a score of 80
Output: [1, 0, 3, 2]
- Person 0 is matched with person 1
- Person 1 is matched with person 0
- Person 2 is matched with person 3
- Person 3 is matched with person 2