-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.fzn
169 lines (124 loc) · 8.88 KB
/
test.fzn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
% # Special parameter declarations only allowed in predicate declarations
predicate bool_01(bool:a); % OK - bool
predicate int_01(int:a); % OK - int
predicate int_02(1..3:a); % OK - int
predicate int_03({1,2,3,4}:b); % OK - int
predicate float_01(float:c); % OK - float
predicate float_02(1.1..3.3:c); % OK - float
predicate float_03({1.1,3.3}:c); % OK - float
predicate set_of_int_01(set of int:d); % OK - set of int
predicate set_of_int_02(set of 1..3:e); % OK - set of int
predicate set_of_int_03(set of {1,2,3}:f); % OK - set of int
% predicate set_of_float_01(set of float:f); % ?? - set of float not in the specs but minizinc produces it
% predicate set_of_float_02(set of {1.1,2.1,3.1}:f); % OK - not allowed - only set of int
% constraint set_of_float_02({}); % not allowed
% constraint set_of_float_02({1.1}); % segfaults minizinc
% predicate set_of_float_03(set of 1.1..3.1:f); % OK - not allowed
% constraint set_of_float_03({}); % not allowed
% constraint set_of_float_03({1.1}); % segfaults minizinc
predicate array_of_int_01(array [int] of var int : g); % OK - array of int
predicate array_of_int_02(array [int] of 1..3:g); % OK - array of int
predicate array_of_int_03(array [int] of {1,2,3}:h); % OK - array of int
predicate array_of_float_01(array [int] of 1.0..3.0:i); % OK - array of float
predicate array_of_set_01(array [int] of set of int:j); % OK - array of set of int
predicate array_of_set_02(array [int] of set of 1..3:j); % OK - array of set of int
predicate array_of_set_03(array [int] of set of {1,2,3}:k); % OK - array of set of int
predicate array_of_set_04(array [int] of var set of int:k); % OK - array of set of int
% predicate bla_12(array [int] of set of float:j); % OK - array of set of float ?? - set of float not in the specs but minizinc produces it
% predicate bla_13(array [int] of set of {1.2,1.3,1.4}:j); % OK - not allowed - only set of int
% constraint bla_13([{}]); % not allowed
% constraint bla_13([{1}]); % segfaults minizinc
% constraint bla_13([{1.2}]); % causes minizinc internal error
% predicate bla_14(array [int] of set of 1.2..1.4:j); % OK - not allowed - only set of int
% constraint bla_14([{}]); % not allowed
% constraint bla_14([{1}]); % segfaults minizinc
% constraint bla_14([{1.2}]); % causes minizinc internal error
% # Parameter declarations
bool : b1 = true; % OK - bool
% bool : b2 = b1; % OK - not allowed
int : i1 = 1; % OK - int
% int : i2 = i1; % OK - not allowed
% 1..3 : i2 = 2; % OK - only allowed in predicate
% {1,2,3} : i3 = 3; % OK - only allowed in predicate
float : f1 = 1.1; % OK - float
% 1.1..3.3 : f2 = 2.2; % OK - only allowed in predicate
% {1.1,2.2,3.3} : f3 = 3.3; % OK - only allowed in predicate
set of int : si1 = {1}; % OK - set of int
set of int : si2 = 1..3; % OK - set of int
set of int : si3 = {1,2,3}; % OK - set of int
% set of 1..4 : si4 = {2}; % OK - only allowed in predicate
% set of {1,3,4} : si4 = {3}; % OK - only allowed in predicate
% set of float : sf1 = {}; % OK - only allowed in predicate
% set of 1.1..3.3 : sf2 = {1.2}; % OK - only allowed in predicate
% set of {1.1,2.2,3.3} : sf3 = {2.2,3.3}; % OK - only allowed in predicate
array [1..2] of bool : ab1 = [true,false]; % OK - array of bool
% array [1..2] of bool : ab2 = ab1; % OK - not allowed
% array [1..2] of bool : ab3 = [b1,false]; % OK - not allowed
array [1..2] of int : ai1 = [1,2]; % OK - array of int
% array [1..2] of int : ai2 = ai1; % OK - not allowed
% array [1..2] of int : ai2 = [i1,2]; % OK - not allowed
% array [1..2] of {1,2} : ai2 = [1,2]; % OK - only allowed in predicate
% array [1..2] of 1..3 : ai2 = [1,2]; % OK - only allowed in predicate
array [1..3] of float : af1 = [1.0,2.2,4.4]; % OK - array of float
% array [1..3] of float : af2 = af1; % OK - not allowed
% array [1..3] of float : af3 = [1.0,2.2,f1]; % OK - not allowed
array [1..3] of set of int : as1 = [{1},{2},{3}]; % OK - array of set
% array [1..3] of set of int : as2 = as1; % OK - not allowed
% array [1..3] of set of int : as3 = [si1,{2},{3}]; % OK - not allowed
array [1..3] of set of int : xxx = [{1,2},1..3,{}];
% # Variable declarations
var bool : vb1 = true; % OK - bool
var bool : vb2 = vb1; % OK - bool
var int : vi1; % OK - int
var 1..3 : vi2 = vi1; % OK - int
var {1,3,4} : vi3 = 1; % OK - int
var float : vf1; % OK - float
var float : vf2 = vf1; % OK - float
var 1.1..2.3 : vf3 = 2.2; % OK - float
% var set of int : vsi; % OK - only allowed in predicate decaration
var set of 1..3 : vsi1 = {i1,vi1}; % OK - set
var set of {1,2,3} : vsi2 = vsi1; % OK - set
var set of {1,2,3} : vsi3 = 1..3; % OK - set
% var set of float : vsf; % OK - not allowed
% var set of 1.0..2.3 : vsf; % OK - not allowed
% var set of {1.0,2.1,3.3} : vsf; % OK - not allowed
array [1..2] of var bool : vab1; % OK - array of bool
array [1..2] of var bool : vab2 = vab1; % OK - array of bool
array [1..2] of var bool : vab3 = [b1,vb1]; % OK - array of bool
array [1..4] of var int : vai; % OK - array of int
array [1..4] of var 1..3 : vai1 = vai; % OK - array of int
array [1..4] of var {1,2,3} : vai2 = [1,2,i1,vi1]; % OK - array of int
array [1..4] of var float : vaf1; % OK - array of float
array [1..4] of var 1.0..3.0 : vaf2 = vaf1; % OK - array of float
array [1..2] of var 1.0..3.0 : vaf3 = [f1,vf1]; % OK - array of float
% array [1..4] of var set of int : vas; % OK - only allowed in predicate declarations
array [1..3] of var set of 1..3 : vas1; % OK - array of set
array [1..3] of var set of {1,2,3} : vas2 = vas1; % OK - array of set
array [1..3] of var set of {1,2,3} : vas3 = [{1},vsi1,si1]; % OK - array of set
array [1..3] of var set of {1,2,3} : vas4 = [{1,2},1..3,{}]; % OK - array of set
% # Constraints
constraint bool_01(b1); % bool
% constraint bool_01(b2);
constraint int_01(i1); % int
% constraint int_02(i2);
% constraint int_03(i3);
constraint float_01(f1);
constraint float_02(f1);
constraint float_03(f1);
constraint set_of_int_01(si1);
constraint set_of_int_02(si2);
constraint set_of_int_03(si3);
constraint set_of_int_03(1..3);
% constraint set_of_float_01(sf1);
% constraint set_of_float_01(sf2);
% constraint set_of_float_01(sf3);
constraint array_of_int_01(ai1);
constraint array_of_int_02([1,2]);
constraint array_of_int_03([1,2]);
constraint array_of_float_01([1.1,2.0]);
constraint array_of_set_01([{}]);
constraint array_of_set_03([{1,2},1..2,si1]);
constraint array_of_set_04(vas4);
% constraint bla_12([{1.2}]);
% solve statement
solve satisfy;