Debian Codegraph @

tests/spec/unit/regression/linear_bool_elem_bug.mzn

raw
1 /***
2 !Test
3 expected:
4 - !Result
5 solution: !Solution
6 firstin: 1
7 lastin: 1
8 - !Result
9 solution: !Solution
10 firstin: 1
11 lastin: 2
12 - !Result
13 solution: !Solution
14 firstin: 2
15 lastin: 2
16 - !Result
17 solution: !Solution
18 firstin: 1
19 lastin: 3
20 - !Result
21 solution: !Solution
22 firstin: 2
23 lastin: 3
24 - !Result
25 solution: !Solution
26 firstin: 3
27 lastin: 3
28 ***/
29
30 % Regression test for a problem with the "linear" MiniZinc redefinitions.
31 % The signature of array_var_bool_element/3 in the redefintions was
32 % incorrect leading to an internal error in mzn2fzn.
33
34 int: n=3;
35 array[1..n] of var 1..n: succ;
36 array[1..n] of var bool: ins = [ succ[i] != i | i in 1..n];
37 var 1..n+1: firstin;
38 constraint firstin == min([ n+1 + bool2int(ins[i])*(i-n-1) | i in 1..n]);
39 var 1..n: lastin;
40
41 constraint ins[lastin];
42
43 solve satisfy;
44
45 output ["Ok\n"];