// // How many dominos are there? // Expressed as a CP // // Can we prove this is correct using a counting argument? // import choco.Problem; import choco.ContradictionException; import choco.integer.*; import choco.Solver; import choco.Solution; public class Domino { public static void main(String[] args) { Problem pb = new Problem(); IntDomainVar v1 = pb.makeEnumIntVar("v1",0,6); IntDomainVar v2 = pb.makeEnumIntVar("v2",0,6); pb.post(pb.leq(v1,v2)); if (pb.solve().booleanValue()){ System.out.println("[" + v1.getVal() + " : " + v2.getVal() + "]"); //System.out.println(pb.pretty()); while (pb.nextSolution().booleanValue()) System.out.println("[" + v1.getVal() + " : " + v2.getVal() + "]"); //System.out.println(pb.pretty()); } /* Solver s = pb.getSolver(); pb.solve(true); System.out.println("feasible: " + pb.isFeasible()); System.out.println("nbSol: " + s.getNbSolutions()); */ } }