git-subtree-dir: software/minizinc git-subtree-split: 4f10c82056ffcb1041d7ffef29d77a7eef92cf76
13 lines
555 B
MiniZinc
13 lines
555 B
MiniZinc
include "distribute.mzn";
|
|
|
|
/** @group globals.counting
|
|
Returns an array of the number of occurrences of \a value[\p i] in
|
|
\a base. The values in \a value need not be distinct.
|
|
*/
|
|
function array[$X] of var int: distribute(array[$X] of var int: value,
|
|
array[$Y] of var int: base) :: promise_total =
|
|
let { array[int] of var int: value1d = array1d(value);
|
|
array[index_set(value1d)] of var 0..length(base): card;
|
|
constraint distribute(card, value1d, array1d(base)); }
|
|
in arrayXd(value,card);
|