Debian Codegraph @

tests/spec/unit/regression/bizarre.mzn

raw
1 /***
2 !Test
3 expected:
4 - !Result
5 solution: !Solution
6 allsym: [P, L, E, A, S, E, ' ', S, O, L, V, E, P, U, Z, Z, L, E, '?', '?', '?', '?', '?', '?']
7 num_symbols2: 11
8 sym2: [A, ' ', S, O, V, P, U, Z, L, E, '?']
9 x: 0
10 - !Result
11 solution: !Solution
12 allsym: [P, L, E, A, S, E, ' ', S, O, L, V, E, P, U, Z, Z, L, E, '?', '?', '?', '?', '?', '?']
13 num_symbols2: 11
14 sym2: [A, ' ', S, O, V, P, U, Z, L, E, '?']
15 x: 1
16 ***/
17
18 % Regression test for a flattening problem reported by pjs in version 1.1.5
19 % of MiniZinc.
20
21 int: size_codex;
22 array[1..size_codex] of 0..9: codex;
23 array[1..size_codex] of string: fixed;
24
25 int: num_symbols;
26 array[1..num_symbols] of string: symbols;
27
28 int: rows;
29 int: cols;
30 array[1..rows,1..cols] of string: puzzle;
31
32 array[1..rows*cols] of string: allsym :: add_to_output =
33 [ puzzle[i,j] | i in 1..rows, j in 1..cols ];
34 int: num_symbols2 :: add_to_output = length( [ allsym[i] | i in 1..rows*cols
35 where not exists(j in i+1..rows*cols)(
36 allsym[i] == allsym[j]) ]);
37 array[1..num_symbols] of string: sym2 :: add_to_output = [ allsym[i] | i in 1..rows*cols
38 where not exists(j in i+1..rows*cols)(
39 allsym[i] == allsym[j]) ];
40
41 var 0..1:x :: add_to_output;
42
43 solve satisfy;
44
45 output [show(x),"\n"]
46 ++ [show(num_symbols2),"\n"]
47 ++ [show(allsym),"\n"]
48 ++ [show(sym2),"\n"]
49 ;
50
51 size_codex = 10;
52 codex = [0, 1, 2, 3, 5, 6, 7, 7, 8, 9];
53 fixed = [" "," "," "," "," "," ","Z","?"," "," "];
54
55 num_symbols = 11;
56 symbols = ["P","L","E","A","S","O","V","U","Z","?"," "];
57
58 rows = 4;
59 cols = 6;
60 puzzle = [| "P", "L", "E", "A", "S", "E"
61 | " ", "S", "O", "L", "V", "E"
62 | "P", "U", "Z", "Z", "L", "E"
63 | "?", "?", "?", "?", "?", "?" |];