1
0
This repository has been archived on 2025-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
Jip J. Dekker fad1b07018 Squashed 'software/minizinc/' content from commit 4f10c8205
git-subtree-dir: software/minizinc
git-subtree-split: 4f10c82056ffcb1041d7ffef29d77a7eef92cf76
2021-06-16 14:06:46 +10:00

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);