# Optimized Preferential Pairings for Groups of Four

Optimized Preferential Pairings for Groups of Four

This Demonstration shows examples of optimal pairings of two groups based on a set of expressed preferences. The pairings were optimized using the Gale–Shapley algorithm available as the StableMarriage function in the Combinatorica package. (There is also a built-in function FindIndependentEdgeSet.) You can choose from five hypothetical scenarios of people's preferences. The grids list the first two preferences for each person in each group, while the graphic on the right links the optimal pair based on the preferences. There are color sliders to distinguish each group. The matching can be used to create partners, match mentors to students, match programs to people, or any other situation in which pairs need to be created given a set of preferences.