I'm using the OR-Tools CP-SAT solver to fill a table with integers, with various constraints, as illustrated by the x
in the following figure.
| | A | B | C | D | E |
| 1 | x | x | x | x | x |
| 2 | x | x | x | x | x |
| 3 | x | x | x | x | x |
| 4 | x | x | x | x | x |
| 5 | x | x | x | x | x |
Sadly, the solving time become prohibiting when the dimensions of the table increase. I know that if a given problem has no solution with, for instance, 5 columns (A-E
), it won't have a solution with any number of additional columns (A-Z
). Therefore, theoretically, I should be able to know quickly if a problem with 26 columns is infeasible by checking beforehand if the same problem with 5 columns, or 6 columns, or 7 columns, … is infeasible.
How could I make the solver aware of this fact? I have tried to loop over the number of columns and breaking at the first failure, but it comes with two problems:
- the solver can't use the knowledge gained in the previous iteration of the loop;
- the solver fails quickly if the problem is infeasible, but takes a long time to succeed; if a 26-column problem is feasible until the 25th column, then I've lost a long time in finding 25 useless partial solutions.
Is is impossible, or have I overlooked a way to do that? Is there any way to use a decision strategy, for instance?