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

46 lines
966 B
MiniZinc

/***
!Test
solvers: [chuffed] # Too slow on cbc
options:
all_solutions: true
expected: !Result
status: ALL_SOLUTIONS
solution:
- !Solution
sets:
- !Range 1..3
- !!set {1, 2, 4}
- !!set {1, 2, 5}
- !!set {1, 2, 6}
- !!set {1, 3, 4}
- !!set {1, 3, 5}
- !!set {1, 3, 6}
- !!set {1, 4, 5}
- !!set {1, 4, 6}
- !!set {1, 5, 6}
- !Range 2..4
- !!set {2, 3, 5}
- !!set {2, 3, 6}
- !!set {2, 4, 5}
- !!set {2, 4, 6}
- !!set {2, 5, 6}
- !Range 3..5
- !!set {3, 4, 6}
- !!set {3, 5, 6}
- !Range 4..6
***/
% Lexicographic order of 3-subsets of 1..6
set of int: elems = 1..6;
int: n = 3;
int: m = (product (i in card(elems)-n+1..card(elems)) (i)) div (product (i in 1..n) (i)); % choose n from elems
array [1..m] of var set of elems: sets;
constraint forall (i in 1..m) (card(sets[i]) = n);
constraint forall (i in 1..m-1) (sets[i] < sets[i+1]);
solve satisfy;
output [show(sets)];