0% found this document useful (0 votes)
93 views

Sudoku Orbits

A Sudoku puzzle has 81 numbers inside its cells so the number of permutations that are possible is 81! a valid permutation maintains the integrity of the puzzle's axioms since each permutation must equally shift / swap the numbers in the puzzle. The symmetric group,, of these is of particular interest since it eliminates the need for a single swap through other categorized manipulations.

Uploaded by

Stephen Kruc
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views

Sudoku Orbits

A Sudoku puzzle has 81 numbers inside its cells so the number of permutations that are possible is 81! a valid permutation maintains the integrity of the puzzle's axioms since each permutation must equally shift / swap the numbers in the puzzle. The symmetric group,, of these is of particular interest since it eliminates the need for a single swap through other categorized manipulations.

Uploaded by

Stephen Kruc
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Sudoku Orbits

Introduction
Sudoku is one puzzle that has grown in popularity throughout the computer science and mathematical communities. A Sudoku puzzle comprised of nine squares with numbers1-9 where each number is unique to its square, row and column. An example of a completed square shows the relation of each square's uniqueness. (Fig 1) 5 3 4 6 7 8 9 1 2 6 7 2 1 9 5 3 4 8 1 9 8 3 4 2 5 6 7 8 5 9 7 6 1 4 2 3 4 2 6 8 5 3 7 9 1 7 1 3 9 2 4 8 5 6 9 6 1 5 3 7 2 8 4 2 8 7 4 1 9 6 3 5 3 4 5 2 8 6 1 7 9
Example puzzle Fig 1

Each distinct puzzle is a composition of permutations from some set original puzzle. An orbit is a set of the puzzles that only differ by one permutation. A permutation that maps one valid puzzle to another is not unique however. To prove this we must first understand the permutations themselves.

Valid Sudoku Permutations


A Sudoku puzzle has 81 numbers inside its cells so the number of permutations that are possible is 81! which is a huge number. The only problem is most, that is, of them are not valid puzzle permutations. A valid permutation maintains the integrity of the puzzles axioms. In the same way a homeomorphism should maintain certain properties of the space being mapped into. Our puzzle properties, as was stated above, are that every number is unique to its square, row, and column. These rules restrict our permutations to be symmetrical in nature since each permutation must equally shift/swap the numbers in the puzzle. A good way to look at permutations is like binary operators. In the same way that a binary operation is given two elements to get a single output and that same operation has an inverse. When you swap two rows or two elements in the puzzle that is a single operation with a single output. We will, for this study, adapt this idea to better explain the set of permutations that will be performed. For the Sudoku puzzle there exists several different permutations, the symmetric group, , of these is of particular interest since it eliminates the need for a single swap through other categorized manipulations to the puzzle. Like mentioned before of all the permutations of the 81

elements, there are only a few that we are interested. So we define our subgroup, { | We use and to denote that is the set of row or column swaps, is the set of entire 3x3 square rows or columns, and represents the transposition or rotation of the puzzle around an axis (fig 2). If we needed to span the entire set of valid puzzles we would also include our set of elements which represents a relabeling of the elements. The reason we leave this category of permutations out of our subgroup is because the orbits that we will be finding sit around a certain set of these relabeling operations. As Laura Taalman has demonstrated in her research we construct a minimum complete set of Sudoku puzzles.
5 6 1 8 4 7 9 2 3 4 2 8 9 6 3 1 7 5 3 7 9 5 2 1 6 8 4 6 1 3 7 8 9 5 4 2 r 7 9 4 6 5 2 3 1 8 8 5 2 1 3 4 7 9 6 9 3 5 4 7 8 2 6 1 1 4 6 2 9 5 8 3 7 2 8 7 3 1 6 4 5 9 8 4 7 5 6 1 9 2 3 8 5 2 1 3 4 7 9 6 9 3 5 4 7 8 2 6 1 1 4 6 2 9 5 8 3 7 2 8 7 3 1 6 4 5 9 7 9 4 6 5 2 3 1 8 t 5 6 1 8 4 7 9 2 3 3 7 9 5 2 1 6 8 4 4 2 8 9 6 3 1 7 5 6 1 3 7 8 9 5 4 2 5 2 1 3 7 9 6 8 4 9 6 3 4 2 8 1 7 5 7 8 9 6 1 3 5 4 2 s 6 5 2 7 9 4 3 1 8 1 3 4 8 5 2 7 9 6 4 7 8 9 3 5 2 6 1 2 9 5 1 4 6 8 3 7 3 1 6 2 8 7 4 5 9

(Elements of

)Fig 2

This minimal set contains unique equivalence classes based on the puzzle it starts with. These equivalence classes are our orbits of the puzzle.

Order of an Orbit
Now that we know the essentials and the permutation cycles that we will be concentrating on, we can turn our attention to finding the order of , the size of our orbit. With little to no math involved we can see that the order of swapping pillars, (column of squares). Since there are {( )( )( )( )( ) ( )( )( ) has 6 only 3 Pillars the permutation group elements, which is 3!. In the same manner we can find the order of the Band (row of squares) as the same value. For the row swap in a given Band there are 3 locations to swap to and this can occur for any given number of Bands. Since there are three locations to swap in the Band, like before, we can find that order to be 3! but there are also three Bands that this can occur in so we

have 3 of these swaps inside of Bands giving us as our order for the row swap and consequentially the column swap as well. That leaves the easiest permutation group for last, the rotation. ( ) simply because it only has two states, the operation it performs undoes itself since this operation is its own inverse. Since all of these can occur on the same ( ) puzzle the order of our entire set, .

Building a Program
Now that the hard work is done we can begin to represent this subgroup in our program. I started with a method for every type of operation that would manipulate a given puzzle for each given operation counting them then reporting the amount. This counting found the order of the same way we did above. Through simple multiplication of the counts returned the size of the orbit was found. Open MP parallel sections were then added to add some substantial speed to the program (fig 3). Even with the added parallelism and getting a good linear decrease in time, this seemed to be the long way around to get the size of an orbit.
1 2 3 4 5 6 7 8 Fig 3 Threads 25.235 17.34 12.132 9.265 9.86 7.01 6.12 4.596

Making it Run Faster


From what we just learned about the symmetric group that we took our subset from, the order of this set is based off of the size of the puzzle not the current elements in the 81 locations of the board. So I rewrote the methods that were brute forcing permutations and counting into simple factorials that would work on most of the traditional puzzle boards. The overall speed up is tremendous, but the number of threads only increased the runtime since there wasnt a need for more than one or two threads.

Extra Credit
The question of space and time was risen. When researching the Sudoku groups I came across another writing of Laura Taalman, MINIMAL COMPLETE SHIDOKU SYMMETRY GROUPS. In this paper further detail is explored in how to construct a permutation group that spans the entire set of Sudoku boards. She found for Shindoku that there was a that when crossed with the permutation (123) can span the entire symmetrical group. I have not finished figuring out what the minimal symmetry is for the 9x9 puzzle, but when found it could

also yield better compression of the sudoku boards. The puzzle could be represented by 9 pointers generated by maps of the minimal set and one square of the puzzle.

You might also like