algo-hr-matching

Solid

"Implement Gale-Shapley stable matching algorithm for two-sided matching problems. Use this skill when the user needs to match candidates to positions, assign students to schools, or solve any two-sided preference matching — even if they say 'optimal job matching', 'stable assignment', or 'candidate-position pairing'.".

AI & Automation 22 stars 8 forks Updated 6 days ago MIT

Install

View on GitHub

Quality Score: 84/100

Stars 20%
45
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Gale-Shapley Stable Matching ## Overview Gale-Shapley (deferred acceptance) finds a stable matching between two equally-sized sets where no unmatched pair prefers each other over their current match. Runs in O(n²) worst case. Proposer-optimal: the proposing side gets their best stable partner. ## When to Use **Trigger conditions:** - Matching candidates to job positions based on mutual preferences - Assigning students to schools or residents to hospitals - Any two-sided matching where stability (no blocking pairs) is required **When NOT to use:** - For one-sided assignment (use Hungarian algorithm) - When preferences are based on scores, not rankings (use optimization) ## Algorithm ``` IRON LAW: The Proposing Side Gets Their BEST Stable Partner Gale-Shapley is proposer-optimal and reviewer-pessimal. If employers propose, they get their best stable match; candidates get their worst. The CHOICE of who proposes determines which stable matching is found. ``` ### Phase 1: Input Validation Collect: preference rankings from both sides. Each participant ranks all members of the other side. **Gate:** Complete preference lists, equal-sized groups (or handle unequal with dummy entries). ### Phase 2: Core Algorithm 1. All proposers are "free" (unmatched) 2. While any proposer is free and hasn't proposed to everyone: - Free proposer proposes to their highest-ranked unproposed-to reviewer - Reviewer accepts if unmatched, or replaces current match if new proposer is preferr...

Details

Author
charlieviettq
Repository
charlieviettq/awesome-agent-skill
Created
2 months ago
Last Updated
6 days ago
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category