As I see it you just put the puzzle in as close to 123456789123456...... as possible with the top left corner as
- Code: Select all
123
456
789
Or am I totally off ?
123
456
789
Wolfgang wrote:A puzzle is in canonical form, when the solution grid, considered as number with 81 digits (the first 9 digits correspond to the first row - not box, the next 9 to the second row etc.) is the smallest under all equivalent grids.
gfroyle wrote:So the concept of a CANONICAL grid is
- choose SOME RULE that picks out ONE individual grid from the entire equivalence class and DEFINE that grid to be the "canonical" one.
gfroyle wrote:(d) Convert grid to a graph, use the graph-labelling program nauty, and then convert graph back to a grid.
The ONLY advantage of the last one is that it is very fast for puzzles with few clues - for 17 clue puzzles I can find the canonical grids at the rate of about 4000 per second (on a standardish 2.4G PIV). Given that I am processing millions of 17/18-clue puzzles, I need to work quickly with the canonical version to avoid repetitions.
gsf wrote:are the nauty timings are for 17 clue puzzles (with holes) or for completed grids?
if not for completed grids then do the nauty timing estimates differ for completed grids?
eclark wrote:Though a description of how to use that to get a canocilzation would be cool
gfroyle wrote:These are for 17 clue puzzles with holes; the times for completed puzzles are SIGNIFICANTLY slower... about 30 per second, rather than 4000 per second. I have not attempted to analyse the reasons behind this and to determine if it is an artefact of my implementation or a fundamental property of canonically labelling certain classes of graphs. My suspicion is that it is the latter, and it would be nice to figure out why, but time is my enemy at the moment... (and with a new baby in three weeks, no prospect of any improvement !)
gsf wrote:congratulations on the new arrival -- your first?
at the moment I don't see how the function can be modified to handle holes
I'll repost my solver source with the 9x9 canon() code isolated in a separate file
so you can test
When she arrives, she'll be a baby sister for Amy.. two girls !
eclark wrote:Is the nauty utility open source and or freely avaliable for *nix ?
Edit: never mind I found it here:
http://www.cs.sunysb.edu/~algorith/implement/nauty/implement.shtml
http://cs.anu.edu.au/people/bdm/
Though a description of how to use that to get a canocilzation would be cool
eclark wrote:gsf wrote:I'll repost my solver source with the 9x9 canon() code isolated in a separate file
so you can test
I'd love to see that too. I'm always looking for new code.