Question: Please write code in matlab 5. Matlab problem: Write a Matlab function (or function in alternative language) that simulates the Gale-Shapley algorithm. The input/output syntax

 Please write code in matlab 5. Matlab problem: Write a MatlabPlease write code in matlab

5. Matlab problem: Write a Matlab function (or function in alternative language) that simulates the Gale-Shapley algorithm. The input/output syntax should be of the form: [Match,NunStages] GaleShapleyAlgorithm(P1,P2) where P1 and P2 are the preference structures for Group 1 and Group 2 respectively. Both matrices are of dimension mx n where m is the size of Group 1 and n is the size of Group 2. With regards to Question #5, Group 1 is the men (m-4), Group 2 is the wonen (n = 3), PI is the right matrix representing the Men's Preferences, and P2 is the left matrix representing the Women's Preferences. Match is a matrix of dimension minm, x 2 which indicates the matches after running the Gale-Shapley algorithm. For example, consider the case: Match 2 1 This situation corresponds to scenario where the first individual in Group 1 is paired with the third individual in Group 2, the second individual in Group 1 is paired with the first individual in Group 2, etc. NumStages is an integer returning the number of stages that it took the Gale-Shapley algorithm to return a proposal

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!