4.2.6. FlatZinc builtins¶
These are the standard constraints that need to be supported by FlatZinc solvers (or redefined in the redefinitions.mzn file).
4.2.6.1. Integer FlatZinc builtins¶
Constrains as
[ b
] = c
Constrains m
to be the maximum value of the (non-empty)
array x
Constrains m
to be the minimum value of the (non-empty)
array x
Constrains as
[ b
] = c
Constrains b
to be the absolute value of a
Constrains a
/ b
= c
Constrains a
to be equal to b
Constrains ( a
= b
) \(\leftrightarrow\) r
Constrains a
to be less than or equal to b
Constrains ( a
≤ b
) \(\leftrightarrow\) r
Constrains \({\bf c} = \sum_i {\bf as}[i]*{\bf bs}[i]\)
Constrains \({\bf r} \leftrightarrow ({\bf c} = \sum_i {\bf as}[i]*{\bf bs}[i])\)
Constrains \(\sum\) as
[ i
]* bs
[ i
] ≤ c
Constrains r
\(\leftrightarrow\) (\(\sum\) as
[ i
]* bs
[ i
] ≤ c
)
Constrains \({\bf c} \neq \sum_i {\bf as}[i]*{\bf bs}[i]\)
Constrains \({\bf r} \leftrightarrow ({\bf c} \neq \sum_i {\bf as}[i]*{\bf bs}[i])\)
Constrains a
< b
Constrains r
\(\leftrightarrow\) ( a
< b
)
Constrains max( a
, b
) = c
Constrains min( a
, b
) = c
Constrains a
% b
= c
Constrains a
≠ b
r
\(\leftrightarrow\) ( a
≠ b
)
Constrains a
+ b
= c
Constrains z
= \({\bf x} ^ {{\bf y}}\)
Constrains z
= \({\bf x} ^ {{\bf y}}\)
Constrains a
* b
= c
4.2.6.2. Bool FlatZinc builtins¶
Constrains \({\bf r} \leftrightarrow \bigwedge_i {\bf as}[i]\)
Constrains as
[ b
] = c
Constrains \({\bf r} \leftrightarrow \bigvee_i {\bf as}[i]\)
Constrains \(\oplus_i\ {\bf as}[i]\)
Constrains as
[ b
] = c
Constrains \({\bf b} \in \{0,1\}\) and \({\bf a} \leftrightarrow {\bf b}=1\)
Constrains \({\bf r} \leftrightarrow {\bf a} \land {\bf b}\)
Constrains \(\bigvee_i {\bf as}[i] \lor \bigvee_j \lnot {\bf bs}[j]\)
Constrains a
= b
Constrains r
\(\leftrightarrow\) ( a
= b
)
Constrains a
≤ b
Constrains r
\(\leftrightarrow\) ( a
≤ b
)
Constrains \({\bf c} = \sum_i {\bf as}[i]*{\bf bs}[i]\)
Constrains \({\bf c} \leq \sum_i {\bf as}[i]*{\bf bs}[i]\)
Constrains a
< b
Constrains r
\(\leftrightarrow\) ( a
< b
)
Constrains a
≠ b
Constrains \({\bf r} \leftrightarrow {\bf a} \lor {\bf b}\)
Constrains \({\bf r} \leftrightarrow {\bf a} \oplus {\bf b}\)
Constrains a
\(\oplus\) b
4.2.6.3. Set FlatZinc builtins¶
Constrains as
[ b
] = c
Constrains as
[ b
] = c
Constrains x
= | S
|
Constrains r
= x
\(\setminus\) y
Constrains x
= y
Constrains r
\(\leftrightarrow\) ( x
= y
)
Constrains x
\(\in\) S
Constrains x
\(\in\) S
Constrains \({\bf r} \leftrightarrow ({\bf x} \in {\bf S})\)
Constrains \({\bf r} \leftrightarrow ({\bf x} \in {\bf S})\)
Constrains r
= x
\(\cap\) y
Constrains x
≤ y
(lexicographic order of the sorted lists of elements)
Constrains \({\bf r} \leftrightarrow ({\bf x} \leq {\bf y})\) (lexicographic order of the sorted lists of elements)
Constrains x
< y
(lexicographic order of the sorted lists of elements)
Constrains \({\bf r} \leftrightarrow ({\bf x} < {\bf y})\) (lexicographic order of the sorted lists of elements)
Constrains x
≠ y
Constrains r
\(\leftrightarrow\) ( x
≠ y
)
Constrains x
\(\subseteq\) y
Constrains \({\bf r} \leftrightarrow ({\bf x} \subseteq {\bf y})\)
Constrains x
\(\supseteq\) y
Constrains r
to be the symmetric difference of x
and y
Constrains r
= x
\(\cup\) y
4.2.6.4. Float FlatZinc builtins¶
Constrains as
[ b
] = c
Constrains m
to be the maximum value of the (non-empty)
array x
Constrains m
to be the minimum value of the (non-empty)
array x
Constrains as
[ b
] = c
Constrains b
to be the absolute value of a
Constrains b
= acos( a
)
Constrains b
= acosh( a
)
Constrains b
= asin( a
)
Constrains b
= asinh( a
)
Constrains b
= atan( a
)
Constrains b
= atanh( a
)
Constrains b
= cos( a
)
Constrains b
= cosh( a
)
Constrains a
/ b
= c
Constrains the domain of x
using the values in as
, using each
pair of values as
[2* i
-1].. as
[2* i
] for i
in 1.. n
/2 as a possible range
Constrains a
= b
Constrains r
\(\leftrightarrow\) ( a
= b
)
Constrains b
= exp( a
)
Constrains \({\bf a} \in\ [ {\bf b}, {\bf c} ]\)
Constrains r
\(\leftrightarrow\) \({\bf a} \in\ [ {\bf b}, {\bf c} ]\)
Constrains a
≤ b
Constrains r
\(\leftrightarrow\) ( a
≤ b
)
Constrains \({\bf c} = \sum_i {\bf as}[i]*{\bf bs}[i]\)
Constrains \({\bf r} \leftrightarrow ({\bf c} = \sum_i {\bf as}[i]*{\bf bs}[i])\)
Constrains \({\bf c} \leq \sum_i {\bf as}[i]*{\bf bs}[i]\)
Constrains \({\bf r} \leftrightarrow ({\bf c} \leq \sum_i {\bf as}[i]*{\bf bs}[i])\)
Constrains \({\bf c} < \sum_i {\bf as}[i]*{\bf bs}[i]\)
Constrains \({\bf r} \leftrightarrow ({\bf c} < \sum_i {\bf as}[i]*{\bf bs}[i])\)
Constrains \({\bf c} \neq \sum_i {\bf as}[i]*{\bf bs}[i]\)
Constrains \({\bf r} \leftrightarrow ({\bf c} \neq \sum_i {\bf as}[i]*{\bf bs}[i])\)
Constrains b
= ln( a
)
Constrains b
= log<sub>10</sub>( a
)
Constrains b
= log<sub>2</sub>( a
)
Constrains a
< b
Constrains r
\(\leftrightarrow\) ( a
< b
)
Constrains max( a
, b
) = c
Constrains min( a
, b
) = c
Constrains a
≠ b
Constrains r
\(\leftrightarrow\) ( a
≠ b
)
Constrains a
+ b
= c
Constrains z
= \({\bf x} ^ {{\bf y}}\)
Constrains b
= sin( a
)
Constrains b
= sinh( a
)
Constrains \({\bf b} = \sqrt{{\bf a}}\)
Constrains b
= tan( a
)
Constrains b
= tanh( a
)
Constrains a
* b
= c
Constrains y
= x
4.2.6.5. FlatZinc builtins added in MiniZinc 2.0.0.¶
These functions and predicates define built-in operations of the MiniZinc language that have been added in MiniZinc 2.0.0. Solvers that support these natively need to include a file called redefinitions-2.0.mzn in their solver library that redefines these predicates as builtins.
Constrains m
to be the maximum value in array x
.
Constrains m
to be the minimum value in array x
.
Constrains m
to be the maximum value in array x
.
Constrains m
to be the minimum value in array x
.
Reified clause constraint. Constrains \({\bf b} \leftrightarrow \bigvee_i {\bf as}[i] \lor \bigvee_j \lnot {\bf bs}[j]\)
4.2.6.6. FlatZinc builtins added in MiniZinc 2.0.2.¶
These functions and predicates define built-in operations of the MiniZinc language that have been added in MiniZinc 2.0.2. Solvers that support these natively need to include a file called redefinitions-2.0.2.mzn in their solver library that redefines these predicates as builtins.
Element constraint on array with MiniZinc index set, constrains x
[ idx
] = c
This can be overridden in a solver that can perform the index calculation more efficiently than using
a MiniZinc decomposition.
Element constraint on array with MiniZinc index set, constrains x
[ idx
] = c
This can be overridden in a solver that can perform the index calculation more efficiently than using
a MiniZinc decomposition.
Element constraint on array with MiniZinc index set, constrains x
[ idx
] = c
This can be overridden in a solver that can perform the index calculation more efficiently than using
a MiniZinc decomposition.
Element constraint on array with MiniZinc index set, constrains x
[ idx
] = c
This can be overridden in a solver that can perform the index calculation more efficiently than using
a MiniZinc decomposition.
4.2.6.7. FlatZinc builtins added in MiniZinc 2.1.0.¶
These functions and predicates define built-in operations of the MiniZinc language that have been added in MiniZinc 2.1.0. Solvers that support these natively need to include a file called redefinitions-2.1.0.mzn in their solver library that redefines these predicates as builtins.
Constrains x
to take one of the values in as
Constrains a
≤ x
≤ b
4.2.6.8. FlatZinc builtins added in MiniZinc 2.1.1.¶
These functions and predicates define built-in operations of the MiniZinc language that have been added in MiniZinc 2.1.1. Solvers that support these natively need to include a file called redefinitions-2.1.1.mzn in their solver library that redefines these predicates as builtins.
Returns variable constrained to be equal to the maximum of the set s
.
An alternative implementation can be found in the comments of the source code.
Returns variable constrained to be equal to the minimum of the set s
.
An alternative implementation can be found in the comments of the source code.