// // For latex output // import static choco.Choco.*; import choco.cp.model.CPModel; import choco.kernel.model.Model; import choco.kernel.model.variables.integer.IntegerVariable; import choco.cp.solver.CPSolver; import choco.kernel.solver.Solver; import choco.kernel.solver.variables.integer.IntDomainVar; import choco.cp.solver.search.integer.varselector.MinDomain; public class Note { Model model; Solver solver; int n; // skippers int m; // boats int matches; // number of matches, all pairs int boatPairs; // all pairs of boats int flights; // a flight is up to m boats IntegerVariable[][] match; // match[i][j] = k <-> skippers i and j are in a match in flight k IntegerVariable[][] tMatch; // transpose of match IntegerVariable[] fMatch; // flattened match IntegerVariable[] flightSize; // maximum number of pairs in a flight, i.e. boatPairs Note (int n,int m) { this.n = n; this.m = m; matches = n*(n-1)/2; boatPairs = m/2; flights = (int)Math.ceil((double)matches/(double)boatPairs); model = new CPModel(); solver = new CPSolver(); match = new IntegerVariable[n][n]; tMatch = new IntegerVariable[n][n]; fMatch = new IntegerVariable[matches]; flightSize = makeIntVarArray("size",flights,0,boatPairs); for (int i=0,k=0;i "+ match[i][j]); */ for (int i=0;i