Although there are 2339 pentomino tilings of the 6 x 10 rectangle,
many pairs of solutions are similar. We show that the solutions can
be divided into 911 equivalence classes by the similarity transformations:
The reader may be either amused or frustrated to find further transformations of Figure 1, including one where an end of the W is surrounded by the U. The latter is achieved with two of the above transformations and then two more. In all, the equivalence class containing this solution has twelve members.
Having observed that in some cases a whole sequence of solutions are related by simple transformations, the problem naturally attracted me when looking for pattern specification problems as part of research on a new subsequence algebra [Hansen, 1990]. To provide a baseline, the program reported here was coded in C.
It is possible that the most important application of pentomino studies is to intrigue students and expand their spatial relations skills. However, the topic has proven a fertile topic of intellectual study with investigations into various tiling problems, especially on the infinite plane [Conway, 1990; Golomb, 1985]. Tiling problems have also been used to test hardware concepts such as parallel processor architectures [Furuichi, 1990] and neural network machines [Kajiura, 1989]. My own aspirations in undertaking the study included finding good computer representations for shapes and the hope that a better understanding of symmetries could lead to better techniques for manually solving the tiling problem.
Two solutions are in the same equivalence class if they are
identical except for a similarity transformation, where the
similarity transformations of interest are
Case 3 is met by only the FN and LP pairs shown in Figures 4a and 4b. When these patterns occur, they often merge two sets of solutions with interesting transformations, so we decided to add them to the definition of equivalence. Ninety-one instances of these patterns were found, resulting in 54 fewer equivalence classes.
The term orientation will refer to any rotation or reflection of a subset. If the subset exceeds six units in width, it has the four orientations consisting of itself, its half-turn rotation, and reflections about its horizontal or vertical axis. A subset not exceeding six units also has reflections about each diagonal and rotations of a quarter turn in each direction. When comparing two solutions, a re-orientation of a piece is the change in orientation it undergoes if moved from one solution to the other.
The principle data structures are those for "mask", "oriented pentomino", and "solution". A mask data structure represents the outline shape of one or more pentominoes; it contains the height, the width, and a bitmap with one byte for each of up to 10 columns. The bit map contents are normalized by shifting so neither the bottom row nor the leftmost column is all zeroes.
Each pentomino is represented with a set of up to eight oriented pentomino data structures, one for each orientation. The data structure has a mask giving the shape of the piece and an array of pointers to the other orientations of the same pentomino. With the latter a single array access yields the result of applying any given re-orientation to the pentomino. For example, suppose Lx is the array of pointers for the L piece oriented as on the left side of Figure 4b. Then Lx[NortheastSouthwestReflection] points to the oriented pentomino structure for the L on the right of the Figure.
The solution data structure has both a string form of the solution and its "polar" representation. The latter consists of an array of twelve elements, each pointing to an oriented pentomino structure and giving its row/column location in the solution. Two solutions have pentomino j in common if and only if they have the same values in the j'th element of their polar representations.
The steps of the computation are outlined in Algorithm 1. The first step (labeled {1}) is to assign to each solution its own unique equivalence class. Then {2} all pairs of solutions are compared--considering all four orientations of the first against the second--and when two are found equivalent, their classes are merged {9} by changing all solutions which have the class number of the first to have the class number of the second.
Symmetry of a subset {7} is tested by building a mask representing the shape of the subset and seeing if one of the symmetric re-orientations of the mask is identical to the mask. If this succeeds, the pieces are further tested to ensure both subsets have their pieces in the same relative positions. For this test a polar representation of one subset is successively re-oriented and checked against the other. For this reason, the re-orientation operations are programmed for both masks and the polar representation.
Checking the pentominos that differ to see if they can be split in two congruent subsets {8} is the computationally most intensive task. All (C^{n}_{n/2})/2 possible halvings of the subset have to be tested; this is only 3 tests for Ndiff of 4, but 126 tests for Ndiff of 10. Fortunately, large values of Ndiff were uncommon because the solution list was partially equivalence-class ordered in earlier experiments. The congruence test for each halving was optimized by first computing and comparing the bounding rectangles before generating masks and checking congruence.
Steps {7} and {8} both require rotation and reflection of shapes represented as mask data structures. Only three such operations were implemented--reflections about the vertical, horizontal, and northeast-southwest axes--because all other re-orientations can be generated by multiple applications of these. Reflection about the horizontal axis was done simply by swapping bytes from opposite ends of the bit mask. Reflection about the vertical axis was computed via a precalculated array, Vreflect, giving the vertical reflection for each byte pattern. For instance, Vreflect[0xB] is the value 0x34 (that is, the reflection of 001011 is 110100). Reflection about the northeast-southwest axis used a precalculated array of bitmaps indexed by column position and contents. If the i^{th} column has contents j, the bitmap NESW[i][j] has one bits in the right positions to be a reflection of j in the i^{th} column. The bitmaps selected by each byte of the mask are OR'ed together to make a composite bitmap for the northeast-southwest reflected mask value.
As described so far, the algorithm required three and a quarter hours on an IBM RT/PC workstation with its APC card. This is not an unreasonable use of resource since workstations normally sit idle every night. However, it was a pleasant surprise to find an additional step which greatly reduced the computation.
Observe that when a subset of pieces is re-oriented for a symmetric transformation from one solution to another, all the pieces must undergo the same transformation: all reflected horizontally, or all rotated 180 degress, or whatever. Similarly when swapping two congruent subsets between two solutions all pieces must undergo the same re-orientation, except in the case of one-quarter turns, where half the pieces turn one way and half the other. The improved algorithm was created by introducing step {5} to test that all pieces have the same re-orientation between the two puzzles; for simplicity, all quarter turns were treated as equal.
The improved algorithm took only 25 minutes on the same processor. Most of the work of the algorithm is done in steps {4} and {5}, the first of which rejects all but 636402 of the 10931601 solution pairs considered and the second of which rejects all but 2633 of the remainder.
One interesting aspect of equivalence classes is their "bushiness". Some classes have a sequence of transformations from one solution to the next, where each solution has only one transformation in and another out; other classes have several transformations applicable in each solution so a few transformations can generate a relatively large class. This aspect of the various classes is revealed in Figure 5 where the x-axis orders the equivalence classes according to size and the y-axis is the number of transformations applicable to solutions in the class.
The similarity transformations identified include
The definition of subset demands that the difference between two solutions be formed by moving the pieces of the subset as a block, without rearranging their internal order. Relaxing this restiction produces many more equivalences by symmettry with arbitrary rearrangement of pieces. Curiously, however, the number of equivalence classes is reduced by only three if the restriction is relaxed for the similarity transformations of swapping two congruent subsets. The additional equivalences arise from the shapes shown in Figure 6.
The various similarity transformations involved 199 subset shapes, as detailed in Appendix 2. One shape--the 3x3 square with a unit square in the middle of one side--appears in both lists and is counted twice here. Curiously, it is the only symmetric shape that appears among the shapes which form pairs of congruent subsets. Many shapes can be made with more than one set of pieces; altogether 320 combinations of shape and composition occurred.
Four of the shapes discovered are not connected subsets. In each case, however, the pattern is composed of two symmetric and connected components, each of which applies individually, so the underlying solutions would be in the same equivalence classes even if disconnected shapes were disallowed.
Many of the smaller shapes appear as subsets of other, larger ones, so apparently the symmetry structure of pentomino tilings is not yet completely elucidated.
Acknowledgment: Rebecca L. Hansen's curiosity and enthusiasm contributed greatly to my choosing and finishing this work.
Furuichi, M., Taki, K., Ichiyoshi, N., "A multi-level load balancing scheme for OR-parallel exhaustive search programs on the Multi-PSI." SIGPLAN Notices, vol. 25, no. 3, March 1990, pp. 50-9; from proceedings of Second ACM Sigplan Symposium on Principles and Practice of Parallel Programming, Seattle, WA, USA, 14-16 March 1990.
Golomb, Solomon W., Polyominoes, Scribner (New York, 1965).
Golomb, S.W., "Polyominoes which tile rectangles." Journal of Combinatorial Theory, Series A, vol. 51, no. 1, May 1989, pp. 117-24.
Wilfred J. Hansen, "Programming Language Support for Multi-Media Text with an Algebra for Subsequences", Information Technology Center, Carnegie-Mellon, 1990.
Kajiura, M., Akiyama, Y., Anzai, Y., "Solving large scale puzzles with neural networks." in Architectures, Languages and Algorithms, IEEE Comput. Soc. Press (Los Alamitos, CA, 1989) pp. 562-9; from proceedings IEEE International Workshop on Tools for Artificial Intelligence, Fairfax, VA, 23-25 Oct. 1989.
Figure A2.1 shows the 73 shapes that occurred in swapping two congruent subsets; all but one are asymmetric. Sometimes a similarity transformation that could be expressed as swapping two congruent subsets could also have been expressed as a symmetry transform; the two counts for each piece set are for the cases where symmetry did not hold or did hold, respectively.
The shapes most often found in swapping two congruent subsets had the following number of occurrences and alternate piece compositions:
70 PV FP NP UX
42 LN PU VZ LP
36 FL TY
29 FTY LNU FNV PUX
26 NV TY IL
22 LP IT
21 FU PV LP PT PZ UY
Figures A2.2 and A2.3 show the 126 shapes that occurred when there was a symmetric subset transformation. Frequently occuring such shapes were:
112 FX
103 FT
81 PV FP NP
81 PT NZ
76 PW LP
76 PUV FPU PUY LNV LTY
68 TV
56 PY LW
52 LU
In addition to the shapes shown below, similarity transformations occurred
with the shapes given in Figures 4a and 4b.