/* Symmetry breaking in Picat. From http://symnet.dcs.st-and.ac.uk/summerschool/Symnet2004Gent1.ppt, page 22 With symmetry breaking this model has 6471432500 solutions (go2/0 too 11min3.31s). This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go => model(L), print_sol(L), fail, nl. go2 => Count = count_all(model(_L)), println(count=Count), nl. print_sol([A,B,C,D,E,F,G]) => printf("%2d^3 + %2d^3 + %2d^3 + %2d^3 == %2d^3 + %2d^3 + %2d^3\n",A,B,C,D,E,F,G). model(L) => L = [A,B,C,D,E,F,G], L :: 1..50, A*A*A + B*B*B + C*C*C + D*D*D #= E*E*E + F*F*F + G*G*G /\ % symmetries in left side A #<= B, B #<= C, C #<= D, % symmetries in right side E #<= F, F #<= G, % and between the sides A #<= E, solve($[ff,split],L).