Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
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
36namespace Test { namespace FlatZinc {
37
38 namespace {
40 class Create {
41 public:
42
44 Create(void) {
45 (void) new FlatZincTest("bugfix_r7854","\
46array[1 .. 9] of var 0 .. 8: pos__253 :: output_array([1..9]);\
47array[1 .. 17] of var 0 .. 1: y__967::var_is_introduced;\
48array[1 .. 17] of var bool: ful;\
49array[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 ];\
52var 0 .. 8: sat :: output_var;\
53var bool: b__268::var_is_introduced;\
54var bool: b__275::var_is_introduced;\
55var bool: b__292::var_is_introduced;\
56var bool: b__299::var_is_introduced;\
57var bool: b__316::var_is_introduced;\
58var bool: b__323::var_is_introduced;\
59var bool: b__340::var_is_introduced;\
60var bool: b__347::var_is_introduced;\
61var bool: b__364::var_is_introduced;\
62var bool: b__371::var_is_introduced;\
63var bool: b__388::var_is_introduced;\
64var bool: b__395::var_is_introduced;\
65var bool: b__412::var_is_introduced;\
66var bool: b__419::var_is_introduced;\
67var bool: b__436::var_is_introduced;\
68var bool: b__443::var_is_introduced;\
69var bool: b__460::var_is_introduced;\
70var bool: b__467::var_is_introduced;\
71var bool: b__484::var_is_introduced;\
72var bool: b__491::var_is_introduced;\
73var bool: b__508::var_is_introduced;\
74var bool: b__515::var_is_introduced;\
75var bool: b__532::var_is_introduced;\
76var bool: b__539::var_is_introduced;\
77var bool: b__556::var_is_introduced;\
78var bool: b__563::var_is_introduced;\
79var bool: b__580::var_is_introduced;\
80var bool: b__587::var_is_introduced;\
81var bool: b__604::var_is_introduced;\
82var bool: b__611::var_is_introduced;\
83var bool: b__628::var_is_introduced;\
84var bool: b__635::var_is_introduced;\
85var bool: b__652::var_is_introduced;\
86var bool: b__659::var_is_introduced;\
87constraint bool_xor(b__652, b__659, ful[17]);\
88constraint bool_xor(b__628, b__635, ful[16]);\
89constraint bool_xor(b__604, b__611, ful[15]);\
90constraint bool_xor(b__580, b__587, ful[14]);\
91constraint bool_xor(b__556, b__563, ful[13]);\
92constraint bool_xor(b__532, b__539, ful[12]);\
93constraint bool_xor(b__508, b__515, ful[11]);\
94constraint bool_xor(b__484, b__491, ful[10]);\
95constraint bool_xor(b__460, b__467, ful[9]);\
96constraint bool_xor(b__436, b__443, ful[8]);\
97constraint bool_xor(b__412, b__419, ful[7]);\
98constraint bool_xor(b__388, b__395, ful[6]);\
99constraint bool_xor(b__364, b__371, ful[5]);\
100constraint bool_xor(b__340, b__347, ful[4]);\
101constraint bool_xor(b__316, b__323, ful[3]);\
102constraint bool_xor(b__292, b__299, ful[2]);\
103constraint bool_xor(b__268, b__275, ful[1]);\
104constraint \
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);\
110constraint bool2int(ful[17], y__967[17]);\
111constraint bool2int(ful[16], y__967[16]);\
112constraint bool2int(ful[15], y__967[15]);\
113constraint bool2int(ful[14], y__967[14]);\
114constraint bool2int(ful[13], y__967[13]);\
115constraint bool2int(ful[12], y__967[12]);\
116constraint bool2int(ful[11], y__967[11]);\
117constraint bool2int(ful[10], y__967[10]);\
118constraint bool2int(ful[9], y__967[9]);\
119constraint bool2int(ful[8], y__967[8]);\
120constraint bool2int(ful[7], y__967[7]);\
121constraint bool2int(ful[6], y__967[6]);\
122constraint bool2int(ful[5], y__967[5]);\
123constraint bool2int(ful[4], y__967[4]);\
124constraint bool2int(ful[3], y__967[3]);\
125constraint bool2int(ful[2], y__967[2]);\
126constraint bool2int(ful[1], y__967[1]);\
127constraint int_lt(pos__253[1], pos__253[2]);\
128constraint \
129 int_lin_eq_reif([ 1, -1 ], [ pos__253[9], pos__253[8] ], -1, b__635);\
130constraint \
131 int_lin_eq_reif([ 1, -1 ], [ pos__253[9], pos__253[6] ], -1, b__563);\
132constraint \
133 int_lin_eq_reif([ 1, -1 ], [ pos__253[9], pos__253[2] ], -1, b__371);\
134constraint \
135 int_lin_eq_reif([ 1, -1 ], [ pos__253[8], pos__253[9] ], -1, b__628);\
136constraint \
137 int_lin_eq_reif([ 1, -1 ], [ pos__253[8], pos__253[7] ], -1, b__652);\
138constraint \
139 int_lin_eq_reif([ 1, -1 ], [ pos__253[8], pos__253[7] ], -1, b__611);\
140constraint \
141 int_lin_eq_reif([ 1, -1 ], [ pos__253[8], pos__253[1] ], -1, b__323);\
142constraint \
143 int_lin_eq_reif([ 1, -1 ], [ pos__253[7], pos__253[8] ], -1, b__659);\
144constraint \
145 int_lin_eq_reif([ 1, -1 ], [ pos__253[7], pos__253[8] ], -1, b__604);\
146constraint \
147 int_lin_eq_reif([ 1, -1 ], [ pos__253[7], pos__253[3] ], -1, b__580);\
148constraint \
149 int_lin_eq_reif([ 1, -1 ], [ pos__253[6], pos__253[9] ], -1, b__556);\
150constraint \
151 int_lin_eq_reif([ 1, -1 ], [ pos__253[6], pos__253[5] ], -1, b__491);\
152constraint \
153 int_lin_eq_reif([ 1, -1 ], [ pos__253[6], pos__253[1] ], -1, b__532);\
154constraint \
155 int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[6] ], -1, b__484);\
156constraint \
157 int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[4] ], -1, b__467);\
158constraint \
159 int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[3] ], -1, b__419);\
160constraint \
161 int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[2] ], -1, b__347);\
162constraint \
163 int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[1] ], -1, b__508);\
164constraint \
165 int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[1] ], -1, b__299);\
166constraint \
167 int_lin_eq_reif([ 1, -1 ], [ pos__253[4], pos__253[5] ], -1, b__460);\
168constraint \
169 int_lin_eq_reif([ 1, -1 ], [ pos__253[4], pos__253[3] ], -1, b__395);\
170constraint \
171 int_lin_eq_reif([ 1, -1 ], [ pos__253[4], pos__253[1] ], -1, b__436);\
172constraint \
173 int_lin_eq_reif([ 1, -1 ], [ pos__253[3], pos__253[7] ], -1, b__587);\
174constraint \
175 int_lin_eq_reif([ 1, -1 ], [ pos__253[3], pos__253[5] ], -1, b__412);\
176constraint \
177 int_lin_eq_reif([ 1, -1 ], [ pos__253[3], pos__253[4] ], -1, b__388);\
178constraint \
179 int_lin_eq_reif([ 1, -1 ], [ pos__253[3], pos__253[1] ], -1, b__275);\
180constraint \
181 int_lin_eq_reif([ 1, -1 ], [ pos__253[2], pos__253[9] ], -1, b__364);\
182constraint \
183 int_lin_eq_reif([ 1, -1 ], [ pos__253[2], pos__253[5] ], -1, b__340);\
184constraint \
185 int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[8] ], -1, b__316);\
186constraint \
187 int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[6] ], -1, b__539);\
188constraint \
189 int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[5] ], -1, b__515);\
190constraint \
191 int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[5] ], -1, b__292);\
192constraint \
193 int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[4] ], -1, b__443);\
194constraint \
195 int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[3] ], -1, b__268);\
196constraint int_ne(pos__253[1], pos__253[2]);\
197constraint int_ne(pos__253[1], pos__253[3]);\
198constraint int_ne(pos__253[1], pos__253[4]);\
199constraint int_ne(pos__253[1], pos__253[5]);\
200constraint int_ne(pos__253[1], pos__253[6]);\
201constraint int_ne(pos__253[1], pos__253[7]);\
202constraint int_ne(pos__253[1], pos__253[8]);\
203constraint int_ne(pos__253[1], pos__253[9]);\
204constraint int_ne(pos__253[2], pos__253[3]);\
205constraint int_ne(pos__253[2], pos__253[4]);\
206constraint int_ne(pos__253[2], pos__253[5]);\
207constraint int_ne(pos__253[2], pos__253[6]);\
208constraint int_ne(pos__253[2], pos__253[7]);\
209constraint int_ne(pos__253[2], pos__253[8]);\
210constraint int_ne(pos__253[2], pos__253[9]);\
211constraint int_ne(pos__253[3], pos__253[4]);\
212constraint int_ne(pos__253[3], pos__253[5]);\
213constraint int_ne(pos__253[3], pos__253[6]);\
214constraint int_ne(pos__253[3], pos__253[7]);\
215constraint int_ne(pos__253[3], pos__253[8]);\
216constraint int_ne(pos__253[3], pos__253[9]);\
217constraint int_ne(pos__253[4], pos__253[5]);\
218constraint int_ne(pos__253[4], pos__253[6]);\
219constraint int_ne(pos__253[4], pos__253[7]);\
220constraint int_ne(pos__253[4], pos__253[8]);\
221constraint int_ne(pos__253[4], pos__253[9]);\
222constraint int_ne(pos__253[5], pos__253[6]);\
223constraint int_ne(pos__253[5], pos__253[7]);\
224constraint int_ne(pos__253[5], pos__253[8]);\
225constraint int_ne(pos__253[5], pos__253[9]);\
226constraint int_ne(pos__253[6], pos__253[7]);\
227constraint int_ne(pos__253[6], pos__253[8]);\
228constraint int_ne(pos__253[6], pos__253[9]);\
229constraint int_ne(pos__253[7], pos__253[8]);\
230constraint int_ne(pos__253[7], pos__253[9]);\
231constraint int_ne(pos__253[8], pos__253[9]);\
232solve \
233 ::int_search(pos__253, first_fail, indomain, complete) maximize sat;\
234", "\
235pos__253 = array1d(1..9, [0, 1, 4, 3, 2, 8, 5, 6, 7]);\n\
236sat = 8;\n\
237----------\n\
238==========\n\
239");
240 }
241 };
242
243 Create c;
244 }
245
246}}
247
248// STATISTICS: test-flatzinc
Tests for FlatZinc.
Definition flatzinc.cpp:36
Gecode::FloatVal c(-8, 8)
General test support.
Definition afc.cpp:39