Hi. I've been publishing a variety of logic puzzles online for many years (at
Krazydad.com), and am interested in using or-tools to more rapidly make puzzle constructors for some new varieties. Over the past several days I've made solvers for about 10 puzzle varieties, which run on large test suites of 800 puzzles. I'm happy to provide some of these puzzle test suites if anyone wants to play with them (and have attached a suite of Sudoku to this message).
I've generalized the example sudoku implementation to solve Sudoku of varying sizes, including Hexadecimal Sudoku, and found that the solver really struggles with hexadecimal (16x16) Sudoku. All my puzzles are solved in under a second with my own dancing-links solver, but I found a number of hex-sudoku that take a pathologically long time using ortools - almost 5 minutes for the following puzzle:
[[14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 4, 3, 6],
[0, 0, 0, 0, 10, 14, 0, 0, 4, 7, 0, 2, 8, 0, 0, 0],
[4, 10, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 11, 2, 0],
[8, 0, 2, 16, 0, 0, 0, 0, 0, 0, 0, 9, 7, 15, 0, 12],
[0, 0, 0, 14, 0, 0, 3, 13, 1, 9, 15, 16, 0, 8, 12, 11],
[0, 8, 0, 0, 0, 0, 9, 0, 12, 0, 0, 14, 13, 0, 0, 7],
[0, 0, 0, 0, 11, 0, 5, 0, 0, 0, 3, 0, 2, 0, 0, 0],
[13, 0, 12, 0, 0, 0, 0, 8, 11, 0, 10, 0, 0, 3, 0, 0],
[0, 0, 4, 0, 0, 1, 0, 11, 3, 0, 0, 0, 0, 7, 0, 5],
[0, 0, 0, 7, 0, 13, 0, 0, 0, 1, 0, 8, 0, 0, 0, 0],
[15, 0, 0, 9, 3, 0, 0, 12, 0, 16, 0, 0, 0, 0, 13, 0],
[3, 16, 13, 0, 15, 9, 4, 2, 5, 10, 0, 0, 11, 0, 0, 0],
[11, 0, 14, 4, 12, 0, 0, 0, 0, 0, 0, 0, 6, 16, 0, 9],
[0, 9, 8, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 4, 10],
[0, 0, 0, 2, 6, 0, 15, 9, 0, 0, 14, 12, 0, 0, 0, 0],
[7, 15, 1, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]]
I'm curious if anyone can find tweaks that can speed up solving this one?
I've already found that CHOOSE_MIN_SIZE is much faster than the default IntVarStrategy (CHOOSE_FIRST_UNBOUND) for most Sudoku-like puzzles (with the exception of Killer Sudoku).
I'm attaching my modified Sudoku Solver, along with a suite of 10 Hex Sudoku puzzles that are particularly troublesome, and a suite of regular "Super Tough" Sudoku from my website.