/* Global constraint not_all_equal in Picat. From Global Constraint Catalogue http://www.emn.fr/x-info/sdemasse/gccat/Cnot_all_equal.html """ Constraint not_all_equal(VARIABLES) Purpose The variables of the collection VARIABLES should take more than one single value. Example (<3, 1, 3, 3, 3>) The not_all_equal constraint holds since the collection <3, 1, 3, 3, 3> involves more than one value (i.e., values 1 and 3). """ This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go ?=> N = 5, Variables = new_list(N), Variables :: 1..3, % Variables = [3,1,3,3,3], not_all_equal(Variables), solve(Variables), println(variables=Variables), fail, nl. go => true. not_all_equal(Variables) => NVal :: 2..Variables.len, nvalue(NVal, Variables).