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

85 lines
1.4 KiB
MiniZinc

/***
!Test
expected:
- !Result
solution: !Solution
x:
- 3
- 2
- 1
- !Result
solution: !Solution
x:
- 2
- 4
- 1
- !Result
solution: !Solution
x:
- 1
- 2
- 4
- !Result
solution: !Solution
x:
- 1
- 3
- 2
- !Result
solution: !Solution
x:
- 2
- 3
- 4
- !Result
solution: !Solution
x:
- 4
- 1
- 3
- !Result
solution: !Solution
x:
- 4
- 3
- 2
- !Result
solution: !Solution
x:
- 3
- 4
- 1
- !Result
solution: !Solution
x:
- 1
- 2
- 3
***/
% Regression test for bug #70: set2array coercions were not supported.
include "global_cardinality_low_up.mzn";
predicate my_global_cardinality_low_up(array[int] of var int: x,
array[int] of int: cover,
array[int] of int: lbound,
array[int] of int: ubound) =
forall(i in index_set(cover)) (
sum(j in index_set(x)) ( bool2int(x[j] = cover[i]) )
in lbound[i]..ubound[i]
);
predicate myall_different(array[int] of var int: x) =
global_cardinality_low_up(
x, set2array(dom_array(x)), [0 | i in dom_array(x)], [1 | i in dom_array(x)]);
array[1..3] of var 1..4: x;
constraint myall_different(x);
solve :: int_search(x, input_order, indomain_min, complete) satisfy;
output ["x = ", show(x), ";\n"];