// // Toolkit constraint encoding // import java.io.*; import java.util.*; import static choco.Choco.*; import choco.cp.model.CPModel; import choco.cp.solver.CPSolver; import choco.kernel.model.Model; import choco.kernel.solver.Solver; import choco.kernel.model.variables.integer.IntegerVariable; import choco.kernel.solver.variables.integer.IntDomainVar; import choco.kernel.solver.ContradictionException; import choco.cp.solver.search.integer.varselector.StaticVarOrder; public class SR { int n; int[][] rank; // rank[i][j] = k <-> agent_i ranks agent_j as k^th choice int[][] pref; // pref[i][k] = j <-> agent_i has agent_j as k^th choice int[] length; // length of agent's preference list Model model; Solver solver; IntegerVariable[] agent; // domain of ranks, last is unmatched long totalTime, modelTime, solveTime, readTime, modelSize; boolean search; SR(String fname) throws IOException { search = true; totalTime = System.currentTimeMillis(); readTime = System.currentTimeMillis(); read(fname); readTime = System.currentTimeMillis() - readTime; } void read(String fname) throws IOException { BufferedReader fin = new BufferedReader(new FileReader(fname)); n = Integer.parseInt(fin.readLine()); pref = new int[n][n]; rank = new int[n][n]; length = new int[n]; for (int i=0;i 1) sr.solve(args[1]); else sr.solve("first"); sr.stats(); } }