This page lists the global constraints available in version DEV (rotd-2009-10-14) of the MiniZinc library.
all_different(array[int] of var int: x) all_different(array[int] of var set of int: x)
Constrains the array of objects x to be all different.
all_disjoint(array[int] of var set of int: x)
Ensures that every pair of sets in the array x is disjoint.
all_equal(array[int] of var int: x) all_equal(array[int] of var set of int: x)
Constrains the array of objects x to have the same value.
among(var int: n, array[int] of var int: x, set of int: v)
Requires exactly n variables in x to take one of the values in v.
at_least(int: n, array[int] of var int: x, int: v) at_least(int: n, array[int] of var set of int: x, set of int: v)
Requires at least n variables in x to take the value v.
at_most(int: n, array[int] of var int: x, int: v) at_most(int: n, array[int] of var set of int: x, set of int: v)
Requires at most n variables in x to take the value v.
at_most1(array[int] of var set of int: s)
Requires that each pair of sets in s overlap in at most one element.
count(array[int] of var int: x, var int: y, var int: c)
Constrains c to be the number of occurrences of y in x.
cumulative(array[int] of var int: s, array[int] of var int: d, array[int] of var int: r, var int: b)
Requires that a set of tasks given by start times s, durations d, and
resource requirements r, never require more than a global resource bound
b at any one time.
Aborts if s, d, and r do not have identical index sets.
Aborts if a duration or resource requirement is negative.
decreasing(array[int] of var bool: x) decreasing(array[int] of var float: x) decreasing(array[int] of var int: x) decreasing(array[int] of var set of int: x)
Requires that the array x is in (non-strictly) decreasing order.
disjoint(var set of int: s, var set of int: t)
Requires that sets s and t do not intersect.
distribute(array[int] of var int: card, array[int] of var int: value, array[int] of var int: base)
Requires that card[i] is the number of occurrences of value[i] in base.
In this implementation the values in value need not be distinct.
Aborts if card and value do not have identical index sets.
element(var int: i, array[int] of var bool: x, var bool: y) element(var int: i, array[int] of var float: x, var float: y) element(var int: i, array[int] of var int: x, var int: y) element(var int: i, array[int] of var set of int: x, var set of int: y)
The same as x[i] = y. That is, y is the ith element of the array x.
exactly(int: n, array[int] of var int: x, int: v) exactly(int: n, array[int] of var set of int: x, set of int: v)
Requires exactly n variables in x to take the value v.
global_cardinality(array[int] of var int: x, array[int] of var int: c)
Requires that c[i] is the number of occurrences of i in x.
global_cardinality_low_up(array[int] of var int: x, array[int] of int: cover, array[int] of int: lb, array[int] of int: ub)
Requires that for all i, the value cover[i] appears at least lb[i] and at most ub[i] times in the array x.
increasing(array[int] of var bool: x) increasing(array[int] of var float: x) increasing(array[int] of var int: x) increasing(array[int] of var set of int: x)
Requires that the array x is in (non-strictly) increasing order.
int_set_channel(array[int] of var int: x, array[int] of var set of int: y)
Requires that x[i] = j if and only if i ∈ y[j].
inverse(array[int] of var int: f, array[int] of var int: invf)
Constrains two arrays to represent inverse functions of each other. All the values in each array must be within the index set of the other array.
inverse_set(array[int] of var set of int: f, array[int] of var set of int: invf)
Constrains the two arrays f and invf so that a j ∈ f[i] if and only if i ∈ invf[j]. All the values in each array's sets must be within the index set of the other array.
lex_lesseq(array[int] of var float: x, array[int] of var float: y) lex_lesseq(array[int] of var int: x, array[int] of var int: y) lex_lesseq(array[int] of var set of int: x, array[int] of var set of int: y)
Requires that the array x is lexicographically less than or equal to
array y.
Compares them from first to last element, regardless of indices.
lex_less(array[int] of var int: x, array[int] of var int: y) lex_less(array[int] of var float: x, array[int] of var float: y) lex_less(array[int] of var set of int: x, array[int] of var set of int: y)
Requires that the array x is strictly lexicographically less than array y.
Compares them from first to last element, regardless of indices.
link_set_to_booleans(var set of int: s, array[int] of var bool: b)
The array of booleans b is the characteristic representation of the set s.
Aborts if the index set of b is not a superset of the possible values of s.
maximum(var int: m, array[int] of var int: x) maximum(var float: m, array[int] of var float: x)
Constrains m to be the maximum of the values in x. (The array x must have at least one element.)
member(array[int] of var bool: x, var bool: y) member(array[int] of var float: x, var float: y) member(array[int] of var int: x, var int: y) member(array[int] of var set of int: x, var set of int: y) member(var set of int: x, var int: y)
Requires that y occurs in the array or set x.
minimum(var float: m, array[int] of var float: x) minimum(var int: m, array[int] of var int: x)
Constrains m to be the minimum of the values in x. (The array x must have at least one element.)
nvalue(var int: n, array[int] of var int: x)
Requires that the number of distinct values in x is n.
partition_set(array[int] of var set of int: s, set of int: universe)
Partitions universe into disjoint sets.
precedence(array[int] of var int: x)
Ensures that the first occurrence of i is before that of j for i < j and that the first value used is the value 1.
range(array[int] of var int: x, var set of int: s, var set of int: t)
Requires that the image of function x (represented as an array) on set
of values s is t.
Aborts if ub(s) is not a subset of the index set of x.
regular(array[int] of var int: x, int: Q, int: S, array[int,int] of int: d, int: q0, set of int: F)
The sequence of values in array x (which must all be in the range 1..S)
is accepted by the DFA of Q states with input 1..S and transition
function d (which maps 〈1..Q, 1..S〉 to 0..Q)
and initial state q0
(which must be in 1..Q) and accepting states F (which all must be in
1..Q). State 0 is reserved to be an always failing state.
Aborts if Q < 1.
Aborts if S < 1.
Aborts if the transition function d is not in [1..Q, 1..s].
Aborts if the start state, q0, is not in 1..Q.
Aborts if F is not a subset of 1..Q.
roots(array[int] of var int: x, var set of int: s, var set of int: t)
Requires that x[i] ∈ t for all i ∈ s.
sequence(array[int] of var int: x, int: k, int: lb, int: ub)
Requires that in each subsequence x[i], ..., x[i + k - 1] the sum of the values is between lb and ub.
sort(array[int] of var int: x, array[int] of var int: y)
Requires that the multiset of values in x is the same as the
multiset of values in y but y is in sorted order.
Aborts if the cardinality of the index sets of x and y
is not equal.
sum_pred(var int: i, array[int] of set of int: sets, array[int] of int: c, var int: s)
Requires that the sum of c[i1]...c[iN] equals s, where i1..iN are the
elements of the ith set in sets.
This constraint is usually named sum, but using that would conflict with the MiniZinc built-in
function of the same name.
table(array[int] of var bool: x, array[int, int] of bool: t) table(array[int] of var int: x, array[int, int] of int: t)
Represents the constraint x ∈ t where we
consider each row in t to be a tuple and t as a set of tuples.
Aborts if the second dimension of t does not equal the number of variables in x.