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 MiniZinc bug #109. 7% mzn2fzn 1.1 was incorrectly flattening predicate arguments in a reifying 8% context. Thiw as leading to the generated model instance being 9% inconsistent. 10 11% Smullyan Knights and Knaves problems in MiniZinc. 12% 13% 14% These are the problems 26 to 35 from Raymond Smullyan's wonderful book 15% "What is the name of this book? - The riddle of dracula and 16% other logical puzzles". 17% 18% 19% Model created by Hakan Kjellerstrand, hakank@bonetmail.com 20% See also my MiniZinc page: http://www.hakank.org/minizinc 21 22int: knight = 1; % alway tells the truth 23int: knave = 2; % always lies 24 25array[1..3] of var {knight, knave}: p; 26 27% a knight always speaks the truth 28% a knave always lies 29% 30% says(kind of person, what the person say) 31% 32predicate says(var int: kind, var bool: says) = 33 (kind = knight /\ says = true ) 34 \/ 35 (kind = knave /\ says = false ) 36; 37 38constraint 39 %% Problem 27 40 %% B: A said that there are exactly 1 knights 41 %% C: B is a knave 42 %% What are B and C 43 %% Solution: B: knave, C: knight 44 says(p[2], says(p[1], 1 = sum(i in 1..3) (bool2int(p[i] = 1)))) 45 /\ 46 says(p[3], p[2] = knave); 47 48solve satisfy; 49 50output ["p = ", show(p), ";\n"];