0

I see that ORTools and CpOptimizer both use global constraints. I know it speeds up the search a lot, but what does it actually do? Like what is the difference between me using (1) or (2) below;

Example for the AllDifferent constraint:

1) x1 != x2, x2 != x3, x1 != x3

and

2) AllDifferent(x1, x2, x3)

???

1 Answers1

1

None. We rebuild the all-different cliques. Still, it will be faster for presolve if you use the AllDifferent formulation.

Now, the CP-SAT is a based on a SAT solver, and prefers Boolean variables. In your case, you can try removing integer variables, and use arrays of Boolean variables with a sum (boolvars) <= 1.

Laurent Perron
  • 8,594
  • 1
  • 8
  • 22