× Home (CS 211) Notes Projects Waxman's Website

Purpose

The goal of this project to match n men and n women with their preference rankings of each other and give a "stable" set of marriages. This project uses backtracking to find its solutions.

What is a "Stable" matching

A matching is stable if there are no “instabilities.” Say the match assigns m1 to w1 and m2 to w2. An instability is the situation where there is a mutual greater preference for the other person’s partner than for one’s own. For example m1 would prefer w2 to w1 and likewise w2 prefers m1 to m2.

Test Function

  1. Check if women has already been married: q[ col ] == q[ i ]

  2. Check how much any other man likes the women that has just been married (women c) and compares that to how much he likes his own wife. If he likes women c more than his own wife. That is an issue. mp[ i ][ q[col] ] < mp[ i ][ q[i] ]
    Now check how much women c likes the other men and compare that to how much they like her own husband. If women c likes the other man more than her own husband. That’s an unstable marriable. wp[ q[col] ][ i ] < wp[ q[col] ][ col ]

  3. Check how much the current man married (Man c) likes other women and compare it to how much he likes his current wife. mp[ col ][ q[i] ] < mp[ col ][ q[col] ]
    Now check how much other women like man c and compare it to how much each women likes their own husband. If they like man c more then we have an unstable marriage.wp[ q[i] ][ col ] < wp[ q[i] ][ i ]


Resource
Template
Output
This is to be submitted on blackboard as a .cpp file. File name follows the following format: lastName_firstName.cpp