/* Gardner's Sum Square problem in Picat. From Scampi's model GardnerSumSquare.scala """ Martin Garner Problem: Let a,b,c,d,e,f,g and h be distinct elements in the set {-7,-5,-3,-2,2,4,6,13} What is the minimum possible value of (a+b+c+d)^2 + (e+f+g+h)^2 @author Pierre Schaus pschaus@gmail.com """ 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 => S = [-7,-5,-3,-2,2,4,6,13], X = [A,B,C,D,E,F,G,H], X :: S, all_different(X), V #= (A+B+C+D)*(A+B+C+D) + (E+F+G+H)*(E+F+G+H), % symmetry breaking increasing([A,B,C,D]), increasing([E,F,G,H]), A #< E, solve($[min(V)],X), println(v=V), println(x=X), fail, nl.