this repo has no description
1% RUNS ON mzn20_fd 2% RUNS ON mzn-fzn_fd 3% RUNS ON mzn20_fd_linear 4% RUNS ON mzn20_mip 5 6% Regression test for a bug in mzn2fzn 1.2. The optimisation pass was leaving 7% dangling references to variables it had "eliminated". The symptom was the 8% following error from the FlatZinc interpreter: 9% 10% subsets_100.fzn:413: 11% symbol error: `INT____407' undeclared 12% 13% (This model is from the original bug report.) 14 15% Subsets 100 puzzle in MiniZinc. 16% 17% From rec.puzzle FAQ 18% http://brainyplanet.com/index.php/Subsets?PHPSESSID=051ae1e2b6df794a5a08fc7b5ecf8028 19% """ 20% Out of the set of integers 1,...,100 you are given ten different integers. 21% From this set, A, of ten integers you can always find two disjoint non-empty 22% subsets, S & T, such that the sum of elements in S equals the sum of elements 23% in T. Note: S union T need not be all ten elements of A. Prove this. 24% """ 25 26% 27% This MiniZinc model was created by Hakan Kjellerstrand, hakank@bonetmail.com 28% See also my MiniZinc page: http://www.hakank.org/minizinc 29% 30 31include "globals.mzn"; 32int: n = 100; 33int: m = 10; 34var set of 1..n: s; 35var set of 1..n: t; 36var int: s_total; 37var int: t_total; 38 39% 40% sums the integer in set ss 41% 42predicate sum_set(var set of int: ss, var int: total) = 43 let { 44 int: m = card(ub(ss)), 45 array[1..m] of var 0..1: tmp 46 } 47 in 48 forall(i in 1..m) ( 49 i in ss <-> tmp[i] = 1 50 ) 51 /\ 52 total = sum(i in 1..m) (i*tmp[i]) 53; 54 55 56solve :: set_search([s,t], 57 input_order, indomain_min, complete) satisfy; 58 59constraint 60 card(s union t) <= m 61 /\ 62 card(s union t) > 0 63 /\ 64 disjoint(s, t) 65 /\ 66 sum_set(s, s_total) 67 /\ 68 sum_set(t, t_total) 69 /\ 70 s_total = t_total 71 % /\ 72 % t_total = n 73; 74 75output [ 76 "s: ", show(s), "\n", 77 "t: ", show(t), "\n", 78 "s_total: ", show(s_total), "\n", 79 "t_total: ", show(t_total), "\n", 80];