Generated on Fri Jan 10 2020 11:38:25 for Gecode by doxygen 1.8.16
bugfix_r7854.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  *
6  * Copyright:
7  * Guido Tack, 2014
8  *
9  * This file is part of Gecode, the generic constraint
10  * development environment:
11  * http://www.gecode.org
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining
14  * a copy of this software and associated documentation files (the
15  * "Software"), to deal in the Software without restriction, including
16  * without limitation the rights to use, copy, modify, merge, publish,
17  * distribute, sublicense, and/or sell copies of the Software, and to
18  * permit persons to whom the Software is furnished to do so, subject to
19  * the following conditions:
20  *
21  * The above copyright notice and this permission notice shall be
22  * included in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31  *
32  */
33 
34 #include "test/flatzinc.hh"
35 
36 namespace Test { namespace FlatZinc {
37 
38  namespace {
40  class Create {
41  public:
42 
44  Create(void) {
45  (void) new FlatZincTest("bugfix_r7854","\
46 array[1 .. 9] of var 0 .. 8: pos__253 :: output_array([1..9]);\
47 array[1 .. 17] of var 0 .. 1: y__967::var_is_introduced;\
48 array[1 .. 17] of var bool: ful;\
49 array[1 .. 34] of int: prefs__250 = \
50  [ 0, 2, 0, 4, 0, 7, 1, 4, 1, 8, 2, 3, 2, 4, 3, 0, 3, 4, 4, 5, 4, 0, 5, 0, \
51  5, 8, 6, 2, 6, 7, 7, 8, 7, 6 ];\
52 var 0 .. 8: sat :: output_var;\
53 var bool: b__268::var_is_introduced;\
54 var bool: b__275::var_is_introduced;\
55 var bool: b__292::var_is_introduced;\
56 var bool: b__299::var_is_introduced;\
57 var bool: b__316::var_is_introduced;\
58 var bool: b__323::var_is_introduced;\
59 var bool: b__340::var_is_introduced;\
60 var bool: b__347::var_is_introduced;\
61 var bool: b__364::var_is_introduced;\
62 var bool: b__371::var_is_introduced;\
63 var bool: b__388::var_is_introduced;\
64 var bool: b__395::var_is_introduced;\
65 var bool: b__412::var_is_introduced;\
66 var bool: b__419::var_is_introduced;\
67 var bool: b__436::var_is_introduced;\
68 var bool: b__443::var_is_introduced;\
69 var bool: b__460::var_is_introduced;\
70 var bool: b__467::var_is_introduced;\
71 var bool: b__484::var_is_introduced;\
72 var bool: b__491::var_is_introduced;\
73 var bool: b__508::var_is_introduced;\
74 var bool: b__515::var_is_introduced;\
75 var bool: b__532::var_is_introduced;\
76 var bool: b__539::var_is_introduced;\
77 var bool: b__556::var_is_introduced;\
78 var bool: b__563::var_is_introduced;\
79 var bool: b__580::var_is_introduced;\
80 var bool: b__587::var_is_introduced;\
81 var bool: b__604::var_is_introduced;\
82 var bool: b__611::var_is_introduced;\
83 var bool: b__628::var_is_introduced;\
84 var bool: b__635::var_is_introduced;\
85 var bool: b__652::var_is_introduced;\
86 var bool: b__659::var_is_introduced;\
87 constraint bool_xor(b__652, b__659, ful[17]);\
88 constraint bool_xor(b__628, b__635, ful[16]);\
89 constraint bool_xor(b__604, b__611, ful[15]);\
90 constraint bool_xor(b__580, b__587, ful[14]);\
91 constraint bool_xor(b__556, b__563, ful[13]);\
92 constraint bool_xor(b__532, b__539, ful[12]);\
93 constraint bool_xor(b__508, b__515, ful[11]);\
94 constraint bool_xor(b__484, b__491, ful[10]);\
95 constraint bool_xor(b__460, b__467, ful[9]);\
96 constraint bool_xor(b__436, b__443, ful[8]);\
97 constraint bool_xor(b__412, b__419, ful[7]);\
98 constraint bool_xor(b__388, b__395, ful[6]);\
99 constraint bool_xor(b__364, b__371, ful[5]);\
100 constraint bool_xor(b__340, b__347, ful[4]);\
101 constraint bool_xor(b__316, b__323, ful[3]);\
102 constraint bool_xor(b__292, b__299, ful[2]);\
103 constraint bool_xor(b__268, b__275, ful[1]);\
104 constraint \
105  int_lin_eq(\
106  [ -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], \
107  [ sat, y__967[17], y__967[16], y__967[15], y__967[14], y__967[13], \
108  y__967[12], y__967[11], y__967[10], y__967[9], y__967[8], y__967[7], \
109  y__967[6], y__967[5], y__967[4], y__967[3], y__967[2], y__967[1] ], 0);\
110 constraint bool2int(ful[17], y__967[17]);\
111 constraint bool2int(ful[16], y__967[16]);\
112 constraint bool2int(ful[15], y__967[15]);\
113 constraint bool2int(ful[14], y__967[14]);\
114 constraint bool2int(ful[13], y__967[13]);\
115 constraint bool2int(ful[12], y__967[12]);\
116 constraint bool2int(ful[11], y__967[11]);\
117 constraint bool2int(ful[10], y__967[10]);\
118 constraint bool2int(ful[9], y__967[9]);\
119 constraint bool2int(ful[8], y__967[8]);\
120 constraint bool2int(ful[7], y__967[7]);\
121 constraint bool2int(ful[6], y__967[6]);\
122 constraint bool2int(ful[5], y__967[5]);\
123 constraint bool2int(ful[4], y__967[4]);\
124 constraint bool2int(ful[3], y__967[3]);\
125 constraint bool2int(ful[2], y__967[2]);\
126 constraint bool2int(ful[1], y__967[1]);\
127 constraint int_lt(pos__253[1], pos__253[2]);\
128 constraint \
129  int_lin_eq_reif([ 1, -1 ], [ pos__253[9], pos__253[8] ], -1, b__635);\
130 constraint \
131  int_lin_eq_reif([ 1, -1 ], [ pos__253[9], pos__253[6] ], -1, b__563);\
132 constraint \
133  int_lin_eq_reif([ 1, -1 ], [ pos__253[9], pos__253[2] ], -1, b__371);\
134 constraint \
135  int_lin_eq_reif([ 1, -1 ], [ pos__253[8], pos__253[9] ], -1, b__628);\
136 constraint \
137  int_lin_eq_reif([ 1, -1 ], [ pos__253[8], pos__253[7] ], -1, b__652);\
138 constraint \
139  int_lin_eq_reif([ 1, -1 ], [ pos__253[8], pos__253[7] ], -1, b__611);\
140 constraint \
141  int_lin_eq_reif([ 1, -1 ], [ pos__253[8], pos__253[1] ], -1, b__323);\
142 constraint \
143  int_lin_eq_reif([ 1, -1 ], [ pos__253[7], pos__253[8] ], -1, b__659);\
144 constraint \
145  int_lin_eq_reif([ 1, -1 ], [ pos__253[7], pos__253[8] ], -1, b__604);\
146 constraint \
147  int_lin_eq_reif([ 1, -1 ], [ pos__253[7], pos__253[3] ], -1, b__580);\
148 constraint \
149  int_lin_eq_reif([ 1, -1 ], [ pos__253[6], pos__253[9] ], -1, b__556);\
150 constraint \
151  int_lin_eq_reif([ 1, -1 ], [ pos__253[6], pos__253[5] ], -1, b__491);\
152 constraint \
153  int_lin_eq_reif([ 1, -1 ], [ pos__253[6], pos__253[1] ], -1, b__532);\
154 constraint \
155  int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[6] ], -1, b__484);\
156 constraint \
157  int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[4] ], -1, b__467);\
158 constraint \
159  int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[3] ], -1, b__419);\
160 constraint \
161  int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[2] ], -1, b__347);\
162 constraint \
163  int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[1] ], -1, b__508);\
164 constraint \
165  int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[1] ], -1, b__299);\
166 constraint \
167  int_lin_eq_reif([ 1, -1 ], [ pos__253[4], pos__253[5] ], -1, b__460);\
168 constraint \
169  int_lin_eq_reif([ 1, -1 ], [ pos__253[4], pos__253[3] ], -1, b__395);\
170 constraint \
171  int_lin_eq_reif([ 1, -1 ], [ pos__253[4], pos__253[1] ], -1, b__436);\
172 constraint \
173  int_lin_eq_reif([ 1, -1 ], [ pos__253[3], pos__253[7] ], -1, b__587);\
174 constraint \
175  int_lin_eq_reif([ 1, -1 ], [ pos__253[3], pos__253[5] ], -1, b__412);\
176 constraint \
177  int_lin_eq_reif([ 1, -1 ], [ pos__253[3], pos__253[4] ], -1, b__388);\
178 constraint \
179  int_lin_eq_reif([ 1, -1 ], [ pos__253[3], pos__253[1] ], -1, b__275);\
180 constraint \
181  int_lin_eq_reif([ 1, -1 ], [ pos__253[2], pos__253[9] ], -1, b__364);\
182 constraint \
183  int_lin_eq_reif([ 1, -1 ], [ pos__253[2], pos__253[5] ], -1, b__340);\
184 constraint \
185  int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[8] ], -1, b__316);\
186 constraint \
187  int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[6] ], -1, b__539);\
188 constraint \
189  int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[5] ], -1, b__515);\
190 constraint \
191  int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[5] ], -1, b__292);\
192 constraint \
193  int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[4] ], -1, b__443);\
194 constraint \
195  int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[3] ], -1, b__268);\
196 constraint int_ne(pos__253[1], pos__253[2]);\
197 constraint int_ne(pos__253[1], pos__253[3]);\
198 constraint int_ne(pos__253[1], pos__253[4]);\
199 constraint int_ne(pos__253[1], pos__253[5]);\
200 constraint int_ne(pos__253[1], pos__253[6]);\
201 constraint int_ne(pos__253[1], pos__253[7]);\
202 constraint int_ne(pos__253[1], pos__253[8]);\
203 constraint int_ne(pos__253[1], pos__253[9]);\
204 constraint int_ne(pos__253[2], pos__253[3]);\
205 constraint int_ne(pos__253[2], pos__253[4]);\
206 constraint int_ne(pos__253[2], pos__253[5]);\
207 constraint int_ne(pos__253[2], pos__253[6]);\
208 constraint int_ne(pos__253[2], pos__253[7]);\
209 constraint int_ne(pos__253[2], pos__253[8]);\
210 constraint int_ne(pos__253[2], pos__253[9]);\
211 constraint int_ne(pos__253[3], pos__253[4]);\
212 constraint int_ne(pos__253[3], pos__253[5]);\
213 constraint int_ne(pos__253[3], pos__253[6]);\
214 constraint int_ne(pos__253[3], pos__253[7]);\
215 constraint int_ne(pos__253[3], pos__253[8]);\
216 constraint int_ne(pos__253[3], pos__253[9]);\
217 constraint int_ne(pos__253[4], pos__253[5]);\
218 constraint int_ne(pos__253[4], pos__253[6]);\
219 constraint int_ne(pos__253[4], pos__253[7]);\
220 constraint int_ne(pos__253[4], pos__253[8]);\
221 constraint int_ne(pos__253[4], pos__253[9]);\
222 constraint int_ne(pos__253[5], pos__253[6]);\
223 constraint int_ne(pos__253[5], pos__253[7]);\
224 constraint int_ne(pos__253[5], pos__253[8]);\
225 constraint int_ne(pos__253[5], pos__253[9]);\
226 constraint int_ne(pos__253[6], pos__253[7]);\
227 constraint int_ne(pos__253[6], pos__253[8]);\
228 constraint int_ne(pos__253[6], pos__253[9]);\
229 constraint int_ne(pos__253[7], pos__253[8]);\
230 constraint int_ne(pos__253[7], pos__253[9]);\
231 constraint int_ne(pos__253[8], pos__253[9]);\
232 solve \
233  ::int_search(pos__253, first_fail, indomain, complete) maximize sat;\
234 ", "\
235 pos__253 = array1d(1..9, [0, 1, 4, 3, 2, 8, 5, 6, 7]);\n\
236 sat = 8;\n\
237 ----------\n\
238 ==========\n\
239 ");
240  }
241  };
242 
243  Create c;
244  }
245 
246 }}
247 
248 // STATISTICS: test-flatzinc
General test support.
Definition: afc.cpp:39
Gecode::FloatVal c(-8, 8)