Package minicp.examples
Class StableMatching
java.lang.Object
minicp.examples.SatisfactionProblem
minicp.examples.StableMatching
Stable Matching problem:
Given n students and n companies, where each student (resp. company) has
ranked each company (resp. student) with a unique number between 1 and n
in order of preference (the lower the number, the higher the preference),
say for summer internships, match the students and companies such that
there is no pair of a student and a company who would both prefer to be
matched with each other than with their actually matched ones.
If there are no such pairs, then the matching is said to be stable.
Wikipedia.
-
Field Summary
FieldsModifier and TypeFieldDescriptionIntVar[]IntVar[]final intfinal int[][]final int[][]IntVar[]IntVar[]Fields inherited from class minicp.examples.SatisfactionProblem
dfs -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCreates a model for the optimization A CP model is composed of the variables + a search procedure This method should set the values forSatisfactionProblem.dfssuch thatSatisfactionProblem.solve()can be called afterwardsstatic voidsolve(boolean verbose, Predicate<SearchStatistics> limit) Runs the search defined in theSatisfactionProblem.dfsand possibly prints each found solutiontoString()Methods inherited from class minicp.examples.SatisfactionProblem
getNSolutions, resetNSolutions, solve, solve, solve
-
Field Details
-
n
public final int n -
rankCompanies
public final int[][] rankCompanies -
rankStudents
public final int[][] rankStudents -
student
-
company
-
studentPref
-
companyPref
-
-
Constructor Details
-
StableMatching
-
-
Method Details
-
buildModel
public void buildModel()Description copied from class:SatisfactionProblemCreates a model for the optimization A CP model is composed of the variables + a search procedure This method should set the values forSatisfactionProblem.dfssuch thatSatisfactionProblem.solve()can be called afterwards- Specified by:
buildModelin classSatisfactionProblem
-
solve
Description copied from class:SatisfactionProblemRuns the search defined in theSatisfactionProblem.dfsand possibly prints each found solution- Overrides:
solvein classSatisfactionProblem- Parameters:
verbose- if true, prints the number of found solutions each time a new one is foundlimit- a predicate called at each node that stops the search when it becomes true- Returns:
- statistics related to the search
-
toString
-
main
-