Context: I am trying to answer this question about solving the peg solitaire, and I already posted as an answer some code devised for treating the board
as a graph.
The algorithm in Mathematica for solving the problem I implemented there (please don't care to read the code) is a first try brute force approach which I want to refine.
One way for doing this is aborting the calculation of the branches already explored, and those symmetrically equivalent.
AFAIK, the symmetry of the problem is represented in the Dihedral D4 group.
So my problem: I have a vector with the occupancy state of the board
$S =\{o_1, ...,o_{33}\}$ $(o_i \in \{ True, False \})$
and I want to find a function that when applied to an occupancy state vector returns the same Real number for all eight symmetric states (and of course bijective, returning a different value for any other input).
Any suggestions?
Edit
For example, the following program in Mathematica calculates a bijective bilinear invariant under D4 for the easy board:
x1 x4 x2 x3
>
bl = Times @@@ Union[Sort /@ Tuples[{x1, x2, x3, x4}, 2]]; coef = Array[a, Length@bl]; (* This is the first nuance, I've to write down the one member for each symmetry class*) base = {{1, 0, 0, 0}, {1, 1, 0, 0}, {1, 0, 1, 0}, {1, 1, 1, 0}, {1, 1, 1, 1}, {0, 0, 0, 0}}; f[{x1_, x2_, x3_, x4_}] := Evaluate[coef.bl]; (*This is the second problem: I calculate all members of each class (in this case by rotations)*) g[x_] := Table[RotateRight[x, i], {i, 4}]; fi = FindInstance[ Unequal @@ (f /@ base) && And @@ Equal @@@ (f /@ g /@ base) , coef, Integers]; -f[{x1, x2, x3, x4}] /. fi[[1]]
And the result is
$f(x_1,x_2,x_3,x_4) = x_1^2 + x_1 x_2 + x_2^2 + x_2 x_3 + x_3^2 + x_1 x_4 + x_3 x_4 + x_4^2$
f value .......... Equivalent boards
I am sure there must be a better way ...