Here are some comments in addition to @Dekker1's answer.
First some questions: Which solver did you use? Was the first answer found directly the optimal solution?
You might get a faster solve time with some other FlatZinc solver. I tested the model that you originally included in the question (and later removed) and with some different FlatZinc solvers. Also, I printed out the objective value (makespan
) to compare the intermediate solutions.
Gecode: Finds a solution immediately with a makespan of 69, but then takes long time find the optimal value (which is 17). After 15 minutes no improvement was done, and I stopped the run. For Gecode you might get (much) better result with different search strategies, see more on this here: https://www.minizinc.org/doc-2.3.1/en/lib-annotations.html#search-annotations .
Chuffed: finds a makespan of 17 almost directly, but it took in all 8min28s to prove that 17 is the optimal value. Testing with free search is not faster (9min23s).
OR-tools: Finds the makespan (and proves that it's optimal) of 17 in 0.6s.
startX: [0, 0, 0, 3, 3, 13, 0, 14, 6, 9, 4, 6, 0, 10, 7, 15]
startY: [0, 3, 7, 0, 6, 5, 12, 0, 2, 6, 12, 0, 15, 12, 12, 12]
makespan: 17
----------
==========
The OR-tools solver can sometimes be faster when using free search (the -f
flag), but in this case it's slower: 4.2s. At least with just 1 thread. When adding some more threads (here 12), the optimal solutions was found in 0.396s with the free search flag.
There are quite a lot of different FlatZinc solver that one can test. See the latest MiniZinc Challenge page for some of them: https://www.minizinc.org/challenge2021/results2021.html .
Regarding cumulative
, it seems that some solvers might be faster with this constraint, but some are slower. The best way is to compare with and without the constraint on some different problem instances.
In summary, one might occasionally have to experiment with different constraints and/or solvers and/or search strategies.