Imagine a small garden, divided into 8 equal parts, each a square foot. The garden is 4 ft x 2 ft, so the "bins" are in two rows. Let's number them as:
0 1 2 3
4 5 6 7
Now, each of these plants has other plants that they like, that's good for them to be next to. I can score a particular arrangement by how many of these good relationships I end up with. I've done this in a python script, described here.
Without repeating all those details here, my problem is that there are too many permutations. If I just run it through python's handy permutation generator, there's 8! cases. (I'm stating this problem here as 8 spaces, but my real garden is 16 bins. The problem is too large to solve with 16! possible arrangements.)
My math question is, how can I iterate through a list of unique permutations that also consider how these two rows are arranged? If they were all in one row, the answer is easy, 8!. With 2 rows, there are rotations and mirrors that are really the same answer.
0 1 2 3 is same when mirrored 3 2 1 0
4 5 6 7 7 6 5 4
0 1 2 3 is same when mirrored 4 5 6 7
4 5 6 7 0 1 2 3
0 1 2 3 is same when rotated 7 6 5 4
4 5 6 7 3 2 1 0
I'd like to score all the possible arrangements, but skip those that are mirrors or rotations of things I've already considered. My usual hack-job attempts at iterating through such things include a lookup table, where I'd simply look through a list of ones completed. In this case, that lookup through potentially 8! (16! in my real problem) would take much longer than simply scoring each permutation.
How can I iterate through this and potentially reduce my problem set from 16! (~20 trillion) to perhaps 5 trillion? Or, failing a direct answer, what would you call this kind of problem? I'm not sure what to look up and read about. If I knew enough to know what to tag this problem as, I'd be farther along!