
<ConsistencyModule:> atmost(?N, +Vars, +V)

   At most N elements of Vars have the value V.

Arguments
   N                   An integer or (domain) variable (array notation accepted)
   +Vars               A collection (a la collection_to_list/2) of (domain) variables or integers
   V                   An integer.

Type
   library(gfd)

Description
   This constraint ensures that at most N element of Vars have the value V.

   This constraint is a specialisation of the more general count/4
   constraint, with the (#=<) relation, i.e. the occurrences of V
   is less than or equal to N. Note that the order in which N and V
   occur in the constraint are swapped with respect to occurrences/3
   and count/4; this is for compatibility with the argument order in
   IC.

   ConsistencyModule is the optional module specification to give the 
   consistency level for the propagation for this constraint: 
   gfd_gac for domain (generalised arc) consistency. Note that if
   V is a domain variable, then the propagation is weak, achieving
   neither domain or bound consistency until V becomes ground.
 
   This constraint is also known as atmost in the global constraint
   catalog, where N is restricted to an integer; the more general 
   count/4 constraint is also known as count in the global 
   constraint catalog, and the constraint is implemented using 
   Gecode's count() constraint.
  


Fail Conditions
      Fails if more than N elements of Vars can be instantiated to V.

Examples
   
[eclipse 33]: atmost(N,  [3, 5, 1, 4, 1, 3], 1).

N = N{[2 .. 6]}

[eclipse 34]: N :: [3,5], atmost(N, [3,A,3,5,3,3], 3).

N = 5
A = A{[-1000000 .. 1000000]}

[eclipse 35]:  N :: [3,6], atmost(N, [3,A,3,5,3,3], 3).

N = 6
A = A{[-1000000 .. 1000000]}

[eclipse 36]: N::[1..3], atmost(N, [3,4,2,3,1], 3).

N = N{[2, 3]}



See Also
   ic_symbolic : atmost / 3, fd_global : atmost / 3, ic_global : atmost / 3, fd : atmost / 3, count / 4, atleast / 3, element / 3, occurrences / 3, eclipse_6 : collection_to_list / 2, lists : collection_to_list / 2
