git-subtree-dir: software/minizinc git-subtree-split: 4f10c82056ffcb1041d7ffef29d77a7eef92cf76
124 lines
6.2 KiB
MiniZinc
124 lines
6.2 KiB
MiniZinc
/***
|
|
@groupdef stdlib.ifthenelse Conditionals
|
|
|
|
These functions implement conditional (if-then-else-endif) constraints.
|
|
*/
|
|
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of int: x, var int: y) =
|
|
fzn_if_then_else_int(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of var int: x, var int: y) =
|
|
fzn_if_then_else_var_int(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of opt int: x, var opt int: y) =
|
|
fzn_if_then_else_opt_int(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of var opt int: x, var opt int: y) =
|
|
fzn_if_then_else_var_opt_int(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of bool: x, var bool: y) =
|
|
fzn_if_then_else_bool(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of var bool: x, var bool: y) =
|
|
fzn_if_then_else_var_bool(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of opt bool: x, var opt bool: y) =
|
|
fzn_if_then_else_opt_bool(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of var opt bool: x, var opt bool: y) =
|
|
fzn_if_then_else_var_opt_bool(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of float: x, var float: y) =
|
|
fzn_if_then_else_float(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of var float: x, var float: y) =
|
|
fzn_if_then_else_var_float(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of opt float: x, var opt float: y) =
|
|
fzn_if_then_else_opt_float(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of set of int: x, var set of int: y) =
|
|
fzn_if_then_else_set(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional constraint \(\{\a c[i]\land\not\exists \a 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 \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
*/
|
|
predicate if_then_else(array[int] of var bool: c, array[int] of var set of int: x, var set of int: y) =
|
|
fzn_if_then_else_var_set(c, x, y);
|
|
/** @group stdlib.ifthenelse Conditional partiality constraint
|
|
|
|
This constraint is generated by the compiler for if-then-else expressions
|
|
with potentially undefined cases.
|
|
The last entry in the \a c array is always the constant true, corresponding
|
|
to the else case.
|
|
The \a d[i] variable represents whether case
|
|
\p i is defined. Constrains that if \b is defined, then the selected case must be defined, and
|
|
if the selected case is undefined, then \a b must be undefined.
|
|
*/
|
|
predicate if_then_else_partiality(array[int] of var bool: c, array[int] of var bool: d, var bool: b) =
|
|
fzn_if_then_else_partiality(c, d, b);
|
|
|