4.2.5. Builtins¶
These functions and predicates define built-in operations of the MiniZinc language.
4.2.5.1. Comparison Builtins¶
These builtins implement comparison operations.
Usage: x != y
Return if x
is not equal to y
Usage: x != y
Return if x
is not equal to y
Usage: x != y
Return if array x
is not equal to array y
Usage: x != y
Return if array x
is not equal to array y
Usage: x != y
Return if array x
is not equal to array y
Usage: x != y
Return if array x
is not equal to array y
Usage: x != y
Return if array x
is not equal to array y
Usage: x != y
Return if array x
is not equal to array y
Usage: x != y
Return if array x
is not equal to array y
Usage: x != y
Return if array x
is not equal to array y
Usage: x < y
Return if x
is less than y
Usage: x < y
Return if x
is less than y
Usage: x < y
Return if array x
is lexicographically smaller than array y
Usage: x < y
Return if array x
is lexicographically smaller than array y
Usage: x <= y
Return if x
is less than or equal to y
Usage: x <= y
Return if x
is less than or equal to y
Usage: x <= y
Return if array x
is lexicographically smaller than or equal to array y
Usage: x <= y
Return if array x
is lexicographically smaller than or equal to array y
Usage: x = y
Return if x
is equal to y
Usage: x = y
Return if x
is equal to y
Usage: x = y
Return if x
is equal to y
Usage: x = y
Return if x
is equal to y
Usage: x = y
Return if array x
is equal to array y
Usage: x = y
Return if array x
is equal to array y
Usage: x = y
Return if array x
is equal to array y
Usage: x = y
Return if array x
is equal to array y
Usage: x = y
Return if array x
is equal to array y
Usage: x = y
Return if array x
is equal to array y
Usage: x = y
Return if array x
is equal to array y
Usage: x = y
Return if array x
is equal to array y
Usage: x > y
Return if x
is greater than y
Usage: x > y
Return if x
is greater than y
Usage: x > y
Return if array x
is lexicographically greater than array y
Usage: x > y
Return if array x
is lexicographically greater than array y
Usage: x >= y
Return if x
is greater than or equal to y
Usage: x >= y
Return if x
is greater than or equal to y
Usage: x >= y
Return if array x
is lexicographically greater than or equal to array y
4.2.5.2. Arithmetic Builtins¶
These builtins implement arithmetic operations.
Usage: x * y
Return x
* y
Usage: x * y
Return x
* y
Usage: x * y
Return x
* y
Usage: x * y
Return x
* y
Usage: x + y
Return x
+ y
Usage: x + y
Return x
+ y
Usage: x + y
Return x
+ y
Usage: x + y
Return x
+ y
Usage: x - y
Return x
- y
Usage: x - y
Return x
- y
Usage: x - y
Return x
- y
Usage: x - y
Return x
- y
Usage: - x
Return negative x
Usage: - x
Return negative x
Usage: - x
Return negative x
Usage: - x
Return negative x
Usage: x / y
Return result of floating point division x
/ y
Usage: x / y
Return result of floating point division x
/ y
Usage: x ^ y
Return \({\bf x} ^ {{\bf y}}\)
Usage: x ^ y
Return \({\bf x} ^ {{\bf y}}\)
Usage: x ^ y
Return \({\bf x} ^ {{\bf y}}\)
Usage: x ^ y
Return \({\bf x} ^ {{\bf y}}\)
Usage: x div y
Return result of integer division x
/ y
Usage: x div y
Return result of integer division x
/ y
Usage: x mod y
Return remainder of integer division x
% y
Usage: x mod y
Return remainder of integer division x
% y
Return absolute value of x
Return absolute value of x
Return absolute value of x
Return absolute value of x
Returns the index of the maximum value in the array x
.
When breaking ties the least index is returned.
Returns the index of the maximum value in the array x
.
When breaking ties the least index is returned.
Returns the index of the minimum value in the array x
.
When breaking ties the least index is returned.
Returns the index of the minimum value in the array x
.
When breaking ties the least index is returned.
Return number of true elments in array x
Return number of true elments in array x
Return maximum of x
and y
Return maximum of elements in array x
Return maximum of elements in set x
Return maximum of x
and y
Return maximum of elements in array x
Return maximum of x
and y
Return maximum of elements in array x
Return minimum of x
and y
Return minimum of elements in array x
Return minimum of elements in set x
Return minimum of x
and y
Return minimum of elements in array x
Return minimum of x
and y
Return minimum of elements in array x
Return \({\bf x} ^ {{\bf y}}\)
Return \({\bf x} ^ {{\bf y}}\)
Return \({\bf x} ^ {{\bf y}}\)
Return \({\bf x} ^ {{\bf y}}\)
Return product of elements in array x
Return product of elements in array x
Return product of elements in array x
Return product of elements in array x
Return \(\sqrt{{\bf x}}\)
Return \(\sqrt{{\bf x}}\)
Return sum of elements in array x
Return sum of elements in array x
Return sum of elements in array x
Return sum of elements in array x
Return sum of elements in array x
Return sum of elements in array x
4.2.5.3. Exponential and logarithmic builtins¶
These builtins implement exponential and logarithmic functions.
Return \(e ^ {{\bf x}}\)
Return \(e ^ {{\bf x}}\)
Return \(\ln {\bf x}\)
Return \(\ln {\bf x}\)
Return \(\log_{{\bf x}} {\bf y}\)
Return \(\log_{10} {\bf x}\)
Return \(\log_{10} {\bf x}\)
Return \(\log_{2} {\bf x}\)
Return \(\log_{2} {\bf x}\)
4.2.5.4. Trigonometric functions¶
These builtins implement the standard trigonometric functions.
Return \(\mbox{acos}\ {\bf x}\)
Return \(\mbox{acos}\ {\bf x}\)
Return \(\mbox{acosh}\ {\bf x}\)
Return \(\mbox{acosh}\ {\bf x}\)
Return \(\mbox{asin}\ {\bf x}\)
Return \(\mbox{asin}\ {\bf x}\)
Return \(\mbox{asinh}\ {\bf x}\)
Return \(\mbox{asinh}\ {\bf x}\)
Return \(\mbox{atan}\ {\bf x}\)
Return \(\mbox{atan}\ {\bf x}\)
Return \(\mbox{atanh}\ {\bf x}\)
Return \(\mbox{atanh}\ {\bf x}\)
Return \(\cos {\bf x}\)
Return \(\cos {\bf x}\)
Return \(\cosh {\bf x}\)
Return \(\cosh {\bf x}\)
Return \(\sin {\bf x}\)
Return \(\sin {\bf x}\)
Return \(\sinh {\bf x}\)
Return \(\sinh {\bf x}\)
Return \(\tan {\bf x}\)
Return \(\tan {\bf x}\)
Return \(\tanh {\bf x}\)
Return \(\tanh {\bf x}\)
4.2.5.5. Logical operations¶
Logical operations are the standard operators of Boolean logic.
Usage: x -> y
Return truth value of x
implies y
Usage: x -> y
Return truth value of x
implies y
Usage: x /\ y
Return truth value of x
∧ y
Usage: x /\ y
Return truth value of x
∧ y
Usage: x <- y
Return truth value of y
implies x
Usage: x <- y
Return truth value of y
implies x
Usage: x <-> y
Return truth value of x
if-and-only-if y
Usage: x <-> y
Return truth value of x
if-and-only-if y
Usage: x \/ y
Return truth value of x
∨ y
Usage: x \/ y
Return truth value of x
∨ y
Usage: not x
Return truth value of the negation of x
Usage: not x
Return truth value of the negation of x
Usage: x xor y
Return truth value of x
xor y
Usage: x xor y
Return truth value of x
xor y
Return truth value of \((\bigvee_i {\bf x}[i]) \lor (\bigvee_j \lnot {\bf y}[j])\)
Return truth value of \((\bigvee_i {\bf x}[i]) \lor (\bigvee_j \lnot {\bf y}[j])\)
Return truth value of \(\bigvee_i {\bf x}[i]\)
Return truth value of \(\bigvee_i {\bf x}[i]\)
Return truth value of \(\bigwedge_i {\bf x}[i]\)
Return truth value of \(\bigwedge_i {\bf x}[i]\)
Return truth value of \(\text{true}\oplus (\oplus_i {\bf x}[i])\)
Return truth value of \(\text{true}\oplus (\oplus_i {\bf x}[i])\)
Return truth value of \(\oplus_i {\bf x}[i]\)
Return truth value of \(\oplus_i {\bf x}[i]\)
4.2.5.6. Set operations¶
These functions implement the basic operations on sets.
Usage: a .. b
Return the set \(\{{\bf a},\ldots,{\bf b}\}\)
Usage: a .. b
Return the set \(\{{\bf a},\ldots,{\bf b}\}\)
Usage: a .. b
Return the set \(\{{\bf a},\ldots,{\bf b}\}\)
Usage: x diff y
Return the set difference of sets \({\bf x} \setminus {\bf y}\)
Usage: x diff y
Return the set difference of sets \({\bf x} \setminus {\bf y}\)
Usage: x in y
Test if x
is an element of the set y
Usage: x in y
x
is an element of the set y
Usage: x in y
Test if x
is an element of the set y
Usage: x in y
Test if x
is an element of the set y
Usage: x intersect y
Return the intersection of sets x
and y
Usage: x intersect y
Return the intersection of sets x
and y
Usage: x subset y
Test if x
is a subset of y
Usage: x subset y
x
is a subset of y
Usage: x superset y
Test if x
is a superset of y
Usage: x superset y
x
is a superset of y
Usage: x symdiff y
Return the symmetric set difference of sets x
and y
Usage: x symdiff y
Return the symmetric set difference of sets x
and y
Usage: x union y
Return the union of sets x
and y
Usage: x union y
Return the union of sets x
and y
Return the intersection of the sets in array x
Return the intersection of the sets in array x
Return the union of the sets in array x
Return the union of the sets in array x
Return the cardinality of the set x
Return the cardinality of the set x
Return the maximum of the set s
Return the minimum of the set s
Return a sorted list of the non-overlapping ranges in S
Return a sorted list of the non-overlapping ranges in S
Return a sorted list of the non-overlapping ranges in S
4.2.5.7. Conditionals¶
These functions implement conditional (if-then-else-endif) constraints.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional constraint \(\{{\bf c}[i]\land\not\exists {\bf c}[1..i-1]\ \rightarrow\ y=x[i] \}\)
This constraint is generated by the compiler for if-then-else expressions.
The last entry in the c
array is always the constant true, corresponding
to the else case.
Conditional partiality constraint
This constraint is generated by the compiler for if-then-else expressions
with potentially undefined cases.
The last entry in the c
array is always the constant true, corresponding
to the else case.
The d
[i] variable represents whether case
i
is defined. Constrains that if b is defined, then the selected case must be defined, and
if the selected case is undefined, then b
must be undefined.
4.2.5.8. Array operations¶
These functions implement the basic operations on arrays.
Usage: x ++ y
Return the concatenation of arrays x
and y
Usage: x ++ y
Return the concatenation of arrays x
and y
Usage: x ++ y
Return the concatenation of arrays x
and y
Usage: x ++ y
Return the concatenation of arrays x
and y
Return array x
coerced to index set 1..length( x
).
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to index set 1..length( x
).
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to index set 1..length( x
).
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to index set 1..length( x
).
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to one-dimensional array with index set S
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to one-dimensional array with index set S
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to one-dimensional array with index set S
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to one-dimensional array with index set S
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to two-dimensional array with index sets S1
and S2
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to two-dimensional array with index sets S1
and S2
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to two-dimensional array with index sets S1
and S2
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to two-dimensional array with index sets S1
and S2
.
Coercions are performed by considering the array x
in row-major order.
Return the set containing the elements of x
Return the set containing the elements of x
Return the set containing the elements of x
Return the set containing the elements of x
Return array x
coerced to three-dimensional array with
index sets S1
, S2
and S3
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to three-dimensional array with
index sets S1
, S2
and S3
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to three-dimensional array with
index sets S1
, S2
and S3
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to three-dimensional array with
index sets S1
, S2
and S3
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to 4-dimensional array with
index sets S1
, S2
, S3
and S4
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to 4-dimensional array with
index sets S1
, S2
, S3
and S4
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to 4-dimensional array with
index sets S1
, S2
, S3
and S4
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to 4-dimensional array with
index sets S1
, S2
, S3
and S4
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to 5-dimensional array with
index sets S1
, S2
, S3
, S4
and S5
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to 5-dimensional array with
index sets S1
, S2
, S3
, S4
and S5
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to 5-dimensional array with
index sets S1
, S2
, S3
, S4
and S5
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to 5-dimensional array with
index sets S1
, S2
, S3
, S4
and S5
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to 6-dimensional array with
index sets S1
, S2
, S3
, S4
, S5
and S6
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to 6-dimensional array with
index sets S1
, S2
, S3
, S4
, S5
and S6
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to 6-dimensional array with
index sets S1
, S2
, S3
, S4
, S5
and S6
.
Coercions are performed by considering the array x
in row-major order.
Return array x
coerced to 6-dimensional array with
index sets S1
, S2
, S3
, S4
, S5
and S6
.
Coercions are performed by considering the array x
in row-major order.
Return array y
coerced to array with same number of
dimensions and same index sets as array x
.
Coercions are performed by considering the array y
in row-major order.
Return array y
coerced to array with same number of
dimensions and same index sets as array x
.
Coercions are performed by considering the array y
in row-major order.
Return array y
coerced to array with same number of
dimensions and same index sets as array x
.
Coercions are performed by considering the array y
in row-major order.
Return array y
coerced to array with same number of
dimensions and same index sets as array x
.
Coercions are performed by considering the array y
in row-major order.
Return column c
of array x
Return column c
of array x
Return column c
of array x
Return column c
of array x
Test if e
is an element of array x
Test if e
is an element of array x
Test if e
is an element of array x
Test if i
is in the index set of x
Return index set of one-dimensional array x
Return index set of first dimension of two-dimensional array x
Return index set of first dimension of 3-dimensional array x
Return index set of first dimension of 4-dimensional array x
Return index set of first dimension of 5-dimensional array x
Return index set of first dimension of 6-dimensional array x
Return index set of second dimension of two-dimensional array x
Return index set of second dimension of 3-dimensional array x
Return index set of second dimension of 4-dimensional array x
Return index set of second dimension of 5-dimensional array x
Return index set of second dimension of 6-dimensional array x
Return index set of third dimension of 3-dimensional array x
Return index set of third dimension of 4-dimensional array x
Return index set of third dimension of 5-dimensional array x
Return index set of third dimension of 6-dimensional array x
Return index set of fourth dimension of 4-dimensional array x
Return index set of fourth dimension of 5-dimensional array x
Return index set of fourth dimension of 6-dimensional array x
Return index set of fifth dimension of 5-dimensional array x
Return index set of fifth dimension of 6-dimensional array x
Return index set of sixth dimension of 6-dimensional array x
Test if x
and y
have the same index sets
Return the length of array x
Note that the length is defined as the number of elements in the array, regardless of its dimensionality.
Return the array x
in reverse order
The resulting array has the same index set as x
.
Return the array x
in reverse order
The resulting array has the same index set as x
.
Return the array x
in reverse order
The resulting array has the same index set as x
.
Return the array x
in reverse order
The resulting array has the same index set as x
.
Return row r
of array x
Return row r
of array x
Return row r
of array x
Return row r
of array x
Return slice of array x
specified by sets s
, coerced to new 1d array with index set dims1
Return slice of array x
specified by sets s
, coerced to new 1d array with index set dims1
Return slice of array x
specified by sets s
, coerced to new 1d array with index set dims1
Return slice of array x
specified by sets s
, coerced to new 1d array with index set dims1
Return slice of array x
specified by sets s
, coerced to new 2d array with index sets dims1
and dims2
Return slice of array x
specified by sets s
, coerced to new 2d array with index sets dims1
and dims2
Return slice of array x
specified by sets s
, coerced to new 2d array with index sets dims1
and dims2
Return slice of array x
specified by sets s
, coerced to new 2d array with index sets dims1
and dims2
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
and dims3
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
and dims3
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
and dims3
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
and dims3
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
, dims3
, dims4
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
, dims3
, dims4
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
, dims3
, dims4
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
, dims3
, dims4
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
, dims3
, dims4
, dims5
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
, dims3
, dims4
, dims5
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
, dims3
, dims4
, dims5
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
, dims3
, dims4
, dims5
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
, dims3
, dims4
, dims5
, dims6
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
, dims3
, dims4
, dims5
, dims6
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
, dims3
, dims4
, dims5
, dims6
Return slice of array x
specified by sets s
, coerced to new 3d array with index sets dims1
, dims2
, dims3
, dims4
, dims5
, dims6
4.2.5.9. Array sorting operations¶
Returns the permutation p
which causes x
to be in sorted order hence
x
[ p
[ i
]] <= x
[ p
[ i
+1]].
The permutation is the stable sort hence x
[ p
[ i
]] = x
[ p
[ i
+1]] \(\rightarrow\) p
[ i
] < p
[ i
+1].
Returns the permutation p
which causes x
to be in sorted order hence
x
[ p
[ i
]] <= x
[ p
[ i
+1]].
The permutation is the stable sort hence x
[ p
[ i
]] = x
[ p
[ i
+1]] \(\rightarrow\) p
[ i
] < p
[ i
+1].
Return values from array x
sorted in non-decreasing order
Return values from array x
sorted in non-decreasing order
Return values from array x
sorted in non-decreasing order
Return array x
sorted by the values in y
in non-decreasing order
The sort is stable, i.e. if y
[ i
] = y
[ j
] with i
< j
, then
x
[ i
] will appear in the output before x
[ j
].
Return array x
sorted by the values in y
in non-decreasing order
The sort is stable, i.e. if y
[ i
] = y
[ j
] with i
< j
, then
x
[ i
] will appear in the output before x
[ j
].
Return array x
sorted by the values in y
in non-decreasing order
The sort is stable, i.e. if y
[ i
] = y
[ j
] with i
< j
, then
x
[ i
] will appear in the output before x
[ j
].
Return array x
sorted by the values in y
in non-decreasing order
The sort is stable, i.e. if y
[ i
] = y
[ j
] with i
< j
, then
x
[ i
] will appear in the output before x
[ j
].
Return array x
sorted by the values in y
in non-decreasing order
The sort is stable, i.e. if y
[ i
] = y
[ j
] with i
< j
, then
x
[ i
] will appear in the output before x
[ j
].
Return array x
sorted by the values in y
in non-decreasing order
The sort is stable, i.e. if y
[ i
] = y
[ j
] with i
< j
, then
x
[ i
] will appear in the output before x
[ j
].
4.2.5.10. Coercions¶
These functions implement coercions, or channeling, between different types.
Return Boolean b
coerced to a float
Return array of Booleans x
coerced to an array of floats
Return array of Booleans x
coerced to an array of floats
Return Boolean b
coerced to a float
Return array of Booleans x
coerced to an array of floats
Return Boolean b
coerced to an integer
Return Boolean b
coerced to an integer
Return array of Booleans b
coerced to an array of integers
Return array of Booleans x
coerced to an array of integers
Return array of sets of Booleans x
coerced to an array of sets of integers
Return array of Booleans x
coerced to an array of integers
Return array of Booleans x
coerced to an array of integers
Return \(\lceil{ {\bf x}} \rceil\)
Return \(\lfloor{ {\bf x}} \rfloor\)
Return integer x
coerced to a float
Return integer x
coerced to a float
Return array of integers x
coerced to an array of floats
Return array of integers x
coerced to an array of floats
Return array of optional integers x
coerced to an array of optional floats
Return x
rounded to nearest integer
Return a set of integers x
coerced to an array of integers
4.2.5.11. String operations¶
These functions implement operations on strings.
Usage: s1 ++ s2
Return concatenation of s1
and s2
Return concatenation of strings in array s
Return path of file where this function is called
Convert x
into a string
Convert x
into a string
Convert x
into a string
Formatted to-string conversion
Converts the value x
into a string right
justified by the number of characters given by w
, or left
justified if w
is negative.
The maximum length of the string representation of x
is given by
p
, or the maximum number of digits after the decimal point for floating
point numbers. It is a run-time error for p
to be negative.
Formatted to-string conversion
Converts the value x
into a string right
justified by the number of characters given by w
, or left
justified if w
is negative.
The maximum length of the string representation of x
is given by
p
. It is a run-time error for p
to be negative.
Formatted to-string conversion
Converts the value x
into a string right
justified by the number of characters given by w
, or left
justified if w
is negative.
The maximum length of the string representation of x
is given by
p
. It is a run-time error for p
to be negative.
Formatted to-string conversion
Converts the value x
into a string right
justified by the number of characters given by w
, or left
justified if w
is negative.
Formatted to-string conversion
Converts the value x
into a string right
justified by the number of characters given by w
, or left
justified if w
is negative.
Formatted to-string conversion
Converts the value x
into a string right
justified by the number of characters given by w
, or left
justified if w
is negative.
String justification
Returns the string x
right
justified by the number of characters given by w
, or left
justified if w
is negative.
Join string in array s
using delimiter d
Return array for output of all variables in JSON format
Return array for output of all variables in JSON format,
including objective if b
is true
Return array for output of all parameters in JSON format
Convert x
into a string
Convert x
into a string
Convert x
into a string
Convert two-dimensional array x
into a string
Convert three-dimensional array x
into a string
Convert x
into JSON string
Convert x
into JSON string
Formatted to-string conversion for floats.
Converts the float x
into a string right justified
by the number of characters given by w
, or left justified if
w
is negative. The number of digits to appear after the decimal
point is given by p
. It is a run-time error for p
to be negative.
Formatted to-string conversion for integers
Converts the integer x
into a string right
justified by the number of characters given by w
, or left
justified if w
is negative.
Return length of s
4.2.5.12. Reflection operations¶
These functions return information about declared or inferred variable bounds and domains.
Return domain of x
Return union of all domains of the elements in array x
Return approximation of union of all domains of the elements in array x
Return cardinality of the domain of x
Check if the value of x
is fixed at this point
in evaluation. If it is fixed, return its value, otherwise abort.
Check if the value of every element of the array x
is fixed
at this point in evaluation. If all are fixed, return an array of their values, otherwise abort.
Test if variable x
has declared, finite bounds
Test if variable x
has declared, finite bounds
Test if variable x
has a declared, finite upper bound
Test if x
is fixed
Test if x
is fixed
Test if x
is fixed
Test if every element of array x
is fixed
Return lower bound of x
Return lower bound of x
Return lower bound of x
Return lower bound of x
Return lower bound of x
Return array of lower bounds of the elements in array x
Return array of lower bounds of the elements in array x
Return array of lower bounds of the elements in array x
Return minimum of all lower bounds of the elements in array x
Return minimum of all lower bounds of the elements in array x
Return intersection of all lower bounds of the elements in array x
Return upper bound of x
Return upper bound of x
Return upper bound of x
Return upper bound of x
Return upper bound of x
Return array of upper bounds of the elements in array x
Return array of upper bounds of the elements in array x
Return array of upper bounds of the elements in array x
Return maximum of all upper bounds of the elements in array x
Return maximum of all upper bounds of the elements in array x
Return union of all upper bounds of the elements in array x
4.2.5.13. Assertions and debugging functions¶
These functions help debug models and check that input data conforms to the expectations.
Abort evaluation and print message msg
.
If b
is true, return x
, otherwise abort with message msg
.
If b
is true, return x
, otherwise abort with message msg
.
If b
is true, return x
, otherwise abort with message msg
.
If b
is true, return x
, otherwise abort with message msg
.
If b
is true, return x
, otherwise abort with message msg
.
If b
is true, return x
, otherwise abort with message msg
.
If b
is true, return true, otherwise abort with message msg
.
Return x
, and print message msg
.
Return x
, and print message msg
.
Return x
, and print message msg
.
Return true, and print message msg
.
Return x
, and print message msg
.
Return x
, and print message msg
.
Return x
, and print message msg
.
Return true, and print message msg
.
4.2.5.14. Functions for enums¶
Return next greater enum value of x
in enum e
Return next greater enum value of x
in enum e
Return next smaller enum value of x
in enum e
Return next smaller enum value of x
in enum e
Convert x
to enum type X
Convert x
to enum type X
Convert x
to enum type X
Convert x
to enum type X
Convert x
to enum type X
4.2.5.15. Random Number Generator builtins¶
These functions implement random number generators from different probability distributions.
Return a boolean sample from the Bernoulli distribution defined by probability \({\bf p}\)
Return a sample from the binomial distribution defined by sample number t
and probability p
Return a sample from the cauchy distribution defined by \({\bf mean}, {\bf scale}\)
Return a sample from the cauchy distribution defined by \({\bf mean}, {\bf scale}\)
Return a sample from the chi-squared distribution defined by the degree of freedom \({\bf n}\)
Return a sample from the chi-squared distribution defined by the degree of freedom \({\bf n}\)
Return a sample from the discrete distribution defined by the array of weights \({\bf weights}\) that assigns a weight to each integer starting from zero
Return a sample from the exponential distribution defined by \({\bf lambda}\)
Return a sample from the exponential distribution defined by \({\bf lambda}\)
Return a sample from the Fisher-Snedecor F-distribution defined by the degrees of freedom \({\bf d1}, {\bf d2}\)
Return a sample from the Fisher-Snedecor F-distribution defined by the degrees of freedom \({\bf d1}, {\bf d2}\)
Return a sample from the gamma distribution defined by \({\bf alpha}, {\bf beta}\)
Return a sample from the gamma distribution defined by \({\bf alpha}, {\bf beta}\)
Return a sample from the lognormal distribution defined by \({\bf mean}, {\bf std}\)
Return a sample from the lognormal distribution defined by \({\bf mean}, {\bf std}\)
Return a sample from the normal distribution defined by \({\bf mean}, {\bf std}\)
Return a sample from the normal distribution defined by \({\bf mean}, {\bf std}\)
Return a sample from the poisson distribution defined by mean
Return a sample from the poisson distribution defined by an integer mean
Return a sample from the student’s t-distribution defined by the sample size \({\bf n}\)
Return a sample from the student’s t-distribution defined by the sample size \({\bf n}\)
Return a sample from the uniform distribution defined by \({\bf lowerbound}, {\bf upperbound}\)
Return a sample from the uniform distribution defined by \({\bf lowerbound}, {\bf upperbound}\)
Return a sample from the Weibull distribution defined by \({\bf shape}, {\bf scale}\)
Return a sample from the Weibull distribution defined by \({\bf shape}, {\bf scale}\)
4.2.5.16. Special constraints¶
These predicates allow users to mark constraints as e.g. symmetry breaking or redundant, so that solvers can choose to implement them differently.
We cannot easily use annotations for this purpose, since annotations are propagated to all constraints in a decomposition, which may be incorrect for redundant or symmetry breaking constraints in the presence of common subexpression elimination (CSE).
Mark b
as an implied constraint (synonym for redundant_constraint)
Mark b
as a redundant constraint
Mark b
as a symmetry breaking constraint
4.2.5.17. Language information¶
These functions return information about the MiniZinc system.
Return MiniZinc version encoded as an integer (major*10000+minor*1000+patch).
Return string representation of v
given an integer major*10000+minor*1000+patch