# 4.2.4.2. Additional Gecode constraints¶

## among_seq¶

 predicate among_seq(array [int] of var int: x, set of int: S, int: l, int: m, int: n) predicate among_seq(array [int] of var bool: x, bool: b, int: l, int: m, int: n)  Every subsequence of x of length l has at least m and at most n occurrences of the values in S

## circuit_cost¶

 predicate circuit_cost(array [int] of int: c, array [int] of var int: x, var int: z)  Constrains the elements of x to define a circuit where x[i] = j means that j is the successor of i. Additionally, constrain z to be the cost of the circuit. Each edge cost is defined by array c.

## circuit_cost_array¶

 predicate circuit_cost_array(array [int] of int: c, array [int] of var int: x, array [int] of var int: y, var int: z)  Constrains the elements of x to define a circuit where x[i] = j means that j is the successor of i. Additionally, constrain z to be the cost of the circuit. Each edge cost is defined by array c. The variables y[i] are constrained to be the edge cost of the node x[i].

## gecode_array_set_element_intersect¶

 predicate gecode_array_set_element_intersect(var set of int: x, array [int] of var set of int: y, var set of int: z)  Constrain z to be the intersection of all sets in y that are selected by x: $$i \in {\bf z} \leftrightarrow \forall j \in {\bf x}: (i \in {\bf y}[j])$$

## gecode_array_set_element_intersect_in¶

 predicate gecode_array_set_element_intersect_in(var set of int: x, array [int] of var set of int: y, var set of int: z, set of int: u)  Constrain z to be a subset of u, and z to be the intersection of all sets in y that are selected by x: $$i \in {\bf z} \leftrightarrow \forall j \in {\bf x}: (i \in {\bf y}[j])$$

## gecode_array_set_element_partition¶

 predicate gecode_array_set_element_partition(var set of int: x, array [int] of var set of int: y, var set of int: z)  Constrain z to be the disjoint union of all sets in y that are selected by x: $$i \in {\bf z} \leftrightarrow \exists j \in {\bf x}: (i \in {\bf y}[j])$$ and $$i \in {\bf x} \land j \in {\bf x} \land i\neq j \rightarrow {\bf y}[i] \cap {\bf y}[j]=\emptyset$$