/* Global constraint not_in in Picat. From Global Constraint Catalogue http://www.emn.fr/x-info/sdemasse/gccat/Cnot_in.html """ Constraint not_in(VAR,VALUES) Purpose Remove the values of the VALUES collection from the domain variable VAR. Example (2, <1, 3>) The constraint not_in holds since the value of its first argument VAR=2 does not occur within the collection <1, 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 = 2, Values = new_list(N), Values :: 1..3, V :: 1..3, Values = [1,3], % V #= 2, not_in(V, Values), Vars = Values ++ [V], solve(Vars), println(values=Values), println(v=V), nl, fail, nl. go => true. not_in(V, Values) => foreach(I in 1..Values.len) Values[I] #!= V end.