
<ConsistencyModule:> count(+Value, ?Vars, +Rel, ?N)

   Constrain the number of occurrence of Value in Vars (Occ) to satisfy  the relation Occ Rel N

Arguments
   +Value              An integer (or a domain variable)
   ?Vars               A collection (a la collection_to_list/2) of domain variables or integers
   +Rel                One of the atom: #>, #>=, #<, #=<, #=, #\=
   ?N                  An integer or domain variable

Type
   library(gfd)

Description
   Constrain the number of occurrences of Value in Vars to satisfy the
   constraint defined by Rel:

           Rel N

   Rel can be one of #>, #>=, #<, #=<, #=, #\= (or equivalently,
   >, >=, <, =<, =, \=).

   occurrences/3, atmost/3, atleast/3 are defined using count/3. For example,

         atmost(N, Vars, Value)

   is defined by:

        count(Value, Vars, (#=
   This constraint can be embedded in a constraint expression in its
   functional form (without the last argument).

   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
   Value is a domain variable, then the propagation is weak, achieving
   neither domain or bound consistency until Value becomes ground.

   This constraint is known as count in the global constraint catalog.
   It is implemented using gecode's count() constraint (variants with
   int or IntVar for argument representing Value).



Modes and Determinism
   count(+, +, +, +)
   count(?, +, +, +)
   count(?, +, +, ?)
   count(+, +, +, ?)

Examples
   
[eclipse 33]: count(5, [](4,5,5,4,5), (#>=), 2).   % succeed

[eclipse 34]:  count(5, [](4,5,5,4,5), (#>), 2).   % succeed

[eclipse 35]: count(5, [](4,5,5,4,5), (#=), 2).    % fail

[eclipse 36]: count(5, [](4,5,5,4,5), (#\=), 2).   % succeed

[eclipse 37]: count(5, [](4,5,5,4,5), (#=<), 2).   % fail

[eclipse 38]: count(5, [](4,5,5,4,5), (#<), 2).    % fail

[eclipse 39]: count(5, [](4,5,5,4,5), (#>=), 3).   % succeed

[eclipse 40]: count(5, [](4,5,5,4,5), (#>), 3).    % fail

[eclipse 41]: count(5, [](4,5,5,4,5), (#=), 3)     % succeed

[eclipse 42]: N :: [3,5], count(3, [3,A,3,5,3,3], (#=), N).

N = 5
A = 3

[eclipse 43]:  N :: [3,5], count(3, [3,A,3,5,3], (#=), N).

N = 3
A = A{[-1000000 .. 2, 4 .. 1000000]}

[eclipse 44]:  N :: [3,5], count(3, [3,A,3,5,3], (#<), N).

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

[eclipse 45]:  N :: [3,5], count(3, [3,A,3,5,3], (#>), N).

N = 3
A = 3

[eclipse 46]:  N :: [3,5], count(3, [3,A,3,5,3], (#>=), N).

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

[eclipse 47]: N :: [3,5], count(3, [3,A,3,5,3], (#=<), N).

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

[eclipse 48]: N :: [3,5], count(3, [3,A,3,5,3], (#\=), N).

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




