Go to the documentation of this file.
24 public static void Main(String[] args) {
32 const long numVals = 3;
33 IntVar x = solver.MakeIntVar(0, numVals - 1,
"x");
34 IntVar y = solver.MakeIntVar(0, numVals - 1,
"y");
35 IntVar z = solver.MakeIntVar(0, numVals - 1,
"z");
40 solver.Add(solver.MakeAllDifferent(
new IntVar[]{x, y}));
41 Console.WriteLine($
"Number of constraints: {solver.Constraints()}");
46 DecisionBuilder db = solver.MakePhase(
47 new IntVar[]{x, y, z},
48 Solver.CHOOSE_FIRST_UNBOUND,
56 while (solver.NextSolution()) {
58 Console.WriteLine($
"Solution: {count}\n x={x.Value()} y={y.Value()} z={z.Value()}");
61 Console.WriteLine($
"Number of solutions found: {solver.Solutions()}");
65 Console.WriteLine(
"Advanced usage:");
66 Console.WriteLine($
"Problem solved in {solver.WallTime()}ms");
67 Console.WriteLine($
"Memory usage: {Solver.MemoryUsage()}bytes");
static void Main(String[] args)
This is a simple CP program.