1. Engineering
  2. Computer Science
  3. please write code in matlab...

Question: please write code in matlab...

Question details

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 Mens Preferences, and P2 is the left matrix representing the Womens 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. Please write code in matlab
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution