Implementing stable matching for swap auction execution
This hard coding problem tests your ability to implement a stable matching algorithm in a real financial context. Swap execution facilities use batch auctions to improve liquidity, and the matching engine must guarantee stability—if two parties would prefer each other to their assigned partners, the auction fails and participants leave the platform.
The core challenge is translating preference lists into an algorithm that produces a pairing where no initiator-counterparty pair would both benefit from deviating. You'll need to reason carefully about the algorithm's structure, handle the preference rankings efficiently, and ensure every participant is matched exactly once. The constraint that n ≤ 8 allows for a range of solution approaches, from classical stable-matching strategies to constraint-satisfaction methods.
- Graph-based bipartite matching and stability constraints
- Preference ranking and blocking pair detection
- Perfect matching under preference ordering
- Algorithm correctness verification (why your matching is stable)