You also need the condition that every point in the grid actually has a color. In your language that means that you have to replace your second set with:
"Second set of sets is comprised of all 4-tuples of 17-bit numbers which when ANDed together have no bits set and when ORed together have all bits set."
I don't see how this reformulation would help you solve the problem since these sets of sets are huge. You're also only exploiting the symmetries in one space direction, and you're not exploiting the symmetries in the colors. A better (and standard) way to go at it is to impose additional lexicographic ordering constraints. In addition to the constraints given by the problem you choose an ordering on the colors and add the constraint that row1 <= row 2 <= ... <= row17 where `<=` is the lexicographic ordering on 17-tuples. You do the same for columns and a similar thing for colors. That would (roughly) eliminate the following factor of grids:
4! for the colors
* 17! for the columns
* 17! for the rows
= 3.0 * 10^30
The total number of grids is:
4^(17*17) = 9.9 * 10^173
So eliminating all those symmetries leaves us with:
4^(17*17) / (4!17!17!) = 3.3 * 10^143
Your method only eliminates one of the 17! symmetries, so with your method you'd have to iterate over this many grids:
4^(17*17) / 17! = 2.8 * 10^159
This is hardly trivially computable, but I'd still encourage you to try.
"Second set of sets is comprised of all 4-tuples of 17-bit numbers which when ANDed together have no bits set and when ORed together have all bits set."
I don't see how this reformulation would help you solve the problem since these sets of sets are huge. You're also only exploiting the symmetries in one space direction, and you're not exploiting the symmetries in the colors. A better (and standard) way to go at it is to impose additional lexicographic ordering constraints. In addition to the constraints given by the problem you choose an ordering on the colors and add the constraint that row1 <= row 2 <= ... <= row17 where `<=` is the lexicographic ordering on 17-tuples. You do the same for columns and a similar thing for colors. That would (roughly) eliminate the following factor of grids:
The total number of grids is: So eliminating all those symmetries leaves us with: Your method only eliminates one of the 17! symmetries, so with your method you'd have to iterate over this many grids: This is hardly trivially computable, but I'd still encourage you to try.