Question: JAVA IMPLEMENTATION OF BRUTE FORCE TO STABLE MATCHING PROBLEM - (Implement the function in bold) In this problem we will consider a version of the
JAVA IMPLEMENTATION OF BRUTE FORCE TO STABLE MATCHING PROBLEM - (Implement the function in bold)
In this problem we will consider a version of the problem for professors and students and their fully ordered list of preferences. The Stable Matching Problem, as discussed in the text, assumes that all men and women have a fully ordered list of preferences. In this problem we will consider a version of the problem for professors and students and their fully ordered list of preferences. Note that ties in preference lists are not allowed. As before we have a set P of n professors and a set S of n students. Assume each professor and each student ranks the members of the opposite group
A brute force solution to this problem involves generating all possible permutations of men and women, and checking whether each one is a stable matching, until a stable matching is found. For this assignment, you are provided with Preferences.java class which includes the necessarry input structures for the problem. Please see the comments in Preferences.java file for details. You are also given Assignment1.java file where you will put your implementation for this part under stableMatchBruteForce() function which returns ArrayList
// Part1: Implement a Brute Force Solution public static ArrayList
}
Preferences.java
import java.util.ArrayList;
/** * Class to provide input to Stable Matching algorithms */ public class Preferences { /** Number of professors. */ private int numberOfProfessors;
/** Number of students. */ private int numberOfStudents;
/** A list containing each professor's preference list. */ private ArrayList
/** A list containing each student's preference list. */ private ArrayList
public Preferences(int numberOfProfessors, int numberOfStudents, ArrayList
public int getNumberOfProfessors() { return numberOfProfessors; }
public void setNumberOfProfessors(int numberOfProfessors) { this.numberOfProfessors = numberOfProfessors; }
public int getNumberOfStudents() { return numberOfStudents; }
public void setNumberOfStudents(int numberOfStudents) { this.numberOfStudents = numberOfStudents; }
public ArrayList
public void setProfessors_preference(ArrayList
public ArrayList
public void setStudents_preference(ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
