Generated on Thu Apr 11 13:59:21 2019 for Gecode by doxygen 1.6.3

bugfix_r7854.cpp

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Guido Tack <tack@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Guido Tack, 2014
00008  *
00009  *  This file is part of Gecode, the generic constraint
00010  *  development environment:
00011  *     http://www.gecode.org
00012  *
00013  *  Permission is hereby granted, free of charge, to any person obtaining
00014  *  a copy of this software and associated documentation files (the
00015  *  "Software"), to deal in the Software without restriction, including
00016  *  without limitation the rights to use, copy, modify, merge, publish,
00017  *  distribute, sublicense, and/or sell copies of the Software, and to
00018  *  permit persons to whom the Software is furnished to do so, subject to
00019  *  the following conditions:
00020  *
00021  *  The above copyright notice and this permission notice shall be
00022  *  included in all copies or substantial portions of the Software.
00023  *
00024  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00026  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00028  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00029  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00030  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00031  *
00032  */
00033 
00034 #include "test/flatzinc.hh"
00035 
00036 namespace Test { namespace FlatZinc {
00037 
00038   namespace {
00040     class Create {
00041     public:
00042 
00044       Create(void) {
00045         (void) new FlatZincTest("bugfix_r7854","\
00046 array[1 .. 9] of var 0 .. 8: pos__253 :: output_array([1..9]);\
00047 array[1 .. 17] of var 0 .. 1: y__967::var_is_introduced;\
00048 array[1 .. 17] of var bool: ful;\
00049 array[1 .. 34] of int: prefs__250 = \
00050   [ 0, 2, 0, 4, 0, 7, 1, 4, 1, 8, 2, 3, 2, 4, 3, 0, 3, 4, 4, 5, 4, 0, 5, 0, \
00051     5, 8, 6, 2, 6, 7, 7, 8, 7, 6 ];\
00052 var 0 .. 8: sat :: output_var;\
00053 var bool: b__268::var_is_introduced;\
00054 var bool: b__275::var_is_introduced;\
00055 var bool: b__292::var_is_introduced;\
00056 var bool: b__299::var_is_introduced;\
00057 var bool: b__316::var_is_introduced;\
00058 var bool: b__323::var_is_introduced;\
00059 var bool: b__340::var_is_introduced;\
00060 var bool: b__347::var_is_introduced;\
00061 var bool: b__364::var_is_introduced;\
00062 var bool: b__371::var_is_introduced;\
00063 var bool: b__388::var_is_introduced;\
00064 var bool: b__395::var_is_introduced;\
00065 var bool: b__412::var_is_introduced;\
00066 var bool: b__419::var_is_introduced;\
00067 var bool: b__436::var_is_introduced;\
00068 var bool: b__443::var_is_introduced;\
00069 var bool: b__460::var_is_introduced;\
00070 var bool: b__467::var_is_introduced;\
00071 var bool: b__484::var_is_introduced;\
00072 var bool: b__491::var_is_introduced;\
00073 var bool: b__508::var_is_introduced;\
00074 var bool: b__515::var_is_introduced;\
00075 var bool: b__532::var_is_introduced;\
00076 var bool: b__539::var_is_introduced;\
00077 var bool: b__556::var_is_introduced;\
00078 var bool: b__563::var_is_introduced;\
00079 var bool: b__580::var_is_introduced;\
00080 var bool: b__587::var_is_introduced;\
00081 var bool: b__604::var_is_introduced;\
00082 var bool: b__611::var_is_introduced;\
00083 var bool: b__628::var_is_introduced;\
00084 var bool: b__635::var_is_introduced;\
00085 var bool: b__652::var_is_introduced;\
00086 var bool: b__659::var_is_introduced;\
00087 constraint bool_xor(b__652, b__659, ful[17]);\
00088 constraint bool_xor(b__628, b__635, ful[16]);\
00089 constraint bool_xor(b__604, b__611, ful[15]);\
00090 constraint bool_xor(b__580, b__587, ful[14]);\
00091 constraint bool_xor(b__556, b__563, ful[13]);\
00092 constraint bool_xor(b__532, b__539, ful[12]);\
00093 constraint bool_xor(b__508, b__515, ful[11]);\
00094 constraint bool_xor(b__484, b__491, ful[10]);\
00095 constraint bool_xor(b__460, b__467, ful[9]);\
00096 constraint bool_xor(b__436, b__443, ful[8]);\
00097 constraint bool_xor(b__412, b__419, ful[7]);\
00098 constraint bool_xor(b__388, b__395, ful[6]);\
00099 constraint bool_xor(b__364, b__371, ful[5]);\
00100 constraint bool_xor(b__340, b__347, ful[4]);\
00101 constraint bool_xor(b__316, b__323, ful[3]);\
00102 constraint bool_xor(b__292, b__299, ful[2]);\
00103 constraint bool_xor(b__268, b__275, ful[1]);\
00104 constraint \
00105   int_lin_eq(\
00106     [ -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], \
00107     [ sat, y__967[17], y__967[16], y__967[15], y__967[14], y__967[13], \
00108       y__967[12], y__967[11], y__967[10], y__967[9], y__967[8], y__967[7], \
00109       y__967[6], y__967[5], y__967[4], y__967[3], y__967[2], y__967[1] ], 0);\
00110 constraint bool2int(ful[17], y__967[17]);\
00111 constraint bool2int(ful[16], y__967[16]);\
00112 constraint bool2int(ful[15], y__967[15]);\
00113 constraint bool2int(ful[14], y__967[14]);\
00114 constraint bool2int(ful[13], y__967[13]);\
00115 constraint bool2int(ful[12], y__967[12]);\
00116 constraint bool2int(ful[11], y__967[11]);\
00117 constraint bool2int(ful[10], y__967[10]);\
00118 constraint bool2int(ful[9], y__967[9]);\
00119 constraint bool2int(ful[8], y__967[8]);\
00120 constraint bool2int(ful[7], y__967[7]);\
00121 constraint bool2int(ful[6], y__967[6]);\
00122 constraint bool2int(ful[5], y__967[5]);\
00123 constraint bool2int(ful[4], y__967[4]);\
00124 constraint bool2int(ful[3], y__967[3]);\
00125 constraint bool2int(ful[2], y__967[2]);\
00126 constraint bool2int(ful[1], y__967[1]);\
00127 constraint int_lt(pos__253[1], pos__253[2]);\
00128 constraint \
00129   int_lin_eq_reif([ 1, -1 ], [ pos__253[9], pos__253[8] ], -1, b__635);\
00130 constraint \
00131   int_lin_eq_reif([ 1, -1 ], [ pos__253[9], pos__253[6] ], -1, b__563);\
00132 constraint \
00133   int_lin_eq_reif([ 1, -1 ], [ pos__253[9], pos__253[2] ], -1, b__371);\
00134 constraint \
00135   int_lin_eq_reif([ 1, -1 ], [ pos__253[8], pos__253[9] ], -1, b__628);\
00136 constraint \
00137   int_lin_eq_reif([ 1, -1 ], [ pos__253[8], pos__253[7] ], -1, b__652);\
00138 constraint \
00139   int_lin_eq_reif([ 1, -1 ], [ pos__253[8], pos__253[7] ], -1, b__611);\
00140 constraint \
00141   int_lin_eq_reif([ 1, -1 ], [ pos__253[8], pos__253[1] ], -1, b__323);\
00142 constraint \
00143   int_lin_eq_reif([ 1, -1 ], [ pos__253[7], pos__253[8] ], -1, b__659);\
00144 constraint \
00145   int_lin_eq_reif([ 1, -1 ], [ pos__253[7], pos__253[8] ], -1, b__604);\
00146 constraint \
00147   int_lin_eq_reif([ 1, -1 ], [ pos__253[7], pos__253[3] ], -1, b__580);\
00148 constraint \
00149   int_lin_eq_reif([ 1, -1 ], [ pos__253[6], pos__253[9] ], -1, b__556);\
00150 constraint \
00151   int_lin_eq_reif([ 1, -1 ], [ pos__253[6], pos__253[5] ], -1, b__491);\
00152 constraint \
00153   int_lin_eq_reif([ 1, -1 ], [ pos__253[6], pos__253[1] ], -1, b__532);\
00154 constraint \
00155   int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[6] ], -1, b__484);\
00156 constraint \
00157   int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[4] ], -1, b__467);\
00158 constraint \
00159   int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[3] ], -1, b__419);\
00160 constraint \
00161   int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[2] ], -1, b__347);\
00162 constraint \
00163   int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[1] ], -1, b__508);\
00164 constraint \
00165   int_lin_eq_reif([ 1, -1 ], [ pos__253[5], pos__253[1] ], -1, b__299);\
00166 constraint \
00167   int_lin_eq_reif([ 1, -1 ], [ pos__253[4], pos__253[5] ], -1, b__460);\
00168 constraint \
00169   int_lin_eq_reif([ 1, -1 ], [ pos__253[4], pos__253[3] ], -1, b__395);\
00170 constraint \
00171   int_lin_eq_reif([ 1, -1 ], [ pos__253[4], pos__253[1] ], -1, b__436);\
00172 constraint \
00173   int_lin_eq_reif([ 1, -1 ], [ pos__253[3], pos__253[7] ], -1, b__587);\
00174 constraint \
00175   int_lin_eq_reif([ 1, -1 ], [ pos__253[3], pos__253[5] ], -1, b__412);\
00176 constraint \
00177   int_lin_eq_reif([ 1, -1 ], [ pos__253[3], pos__253[4] ], -1, b__388);\
00178 constraint \
00179   int_lin_eq_reif([ 1, -1 ], [ pos__253[3], pos__253[1] ], -1, b__275);\
00180 constraint \
00181   int_lin_eq_reif([ 1, -1 ], [ pos__253[2], pos__253[9] ], -1, b__364);\
00182 constraint \
00183   int_lin_eq_reif([ 1, -1 ], [ pos__253[2], pos__253[5] ], -1, b__340);\
00184 constraint \
00185   int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[8] ], -1, b__316);\
00186 constraint \
00187   int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[6] ], -1, b__539);\
00188 constraint \
00189   int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[5] ], -1, b__515);\
00190 constraint \
00191   int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[5] ], -1, b__292);\
00192 constraint \
00193   int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[4] ], -1, b__443);\
00194 constraint \
00195   int_lin_eq_reif([ 1, -1 ], [ pos__253[1], pos__253[3] ], -1, b__268);\
00196 constraint int_ne(pos__253[1], pos__253[2]);\
00197 constraint int_ne(pos__253[1], pos__253[3]);\
00198 constraint int_ne(pos__253[1], pos__253[4]);\
00199 constraint int_ne(pos__253[1], pos__253[5]);\
00200 constraint int_ne(pos__253[1], pos__253[6]);\
00201 constraint int_ne(pos__253[1], pos__253[7]);\
00202 constraint int_ne(pos__253[1], pos__253[8]);\
00203 constraint int_ne(pos__253[1], pos__253[9]);\
00204 constraint int_ne(pos__253[2], pos__253[3]);\
00205 constraint int_ne(pos__253[2], pos__253[4]);\
00206 constraint int_ne(pos__253[2], pos__253[5]);\
00207 constraint int_ne(pos__253[2], pos__253[6]);\
00208 constraint int_ne(pos__253[2], pos__253[7]);\
00209 constraint int_ne(pos__253[2], pos__253[8]);\
00210 constraint int_ne(pos__253[2], pos__253[9]);\
00211 constraint int_ne(pos__253[3], pos__253[4]);\
00212 constraint int_ne(pos__253[3], pos__253[5]);\
00213 constraint int_ne(pos__253[3], pos__253[6]);\
00214 constraint int_ne(pos__253[3], pos__253[7]);\
00215 constraint int_ne(pos__253[3], pos__253[8]);\
00216 constraint int_ne(pos__253[3], pos__253[9]);\
00217 constraint int_ne(pos__253[4], pos__253[5]);\
00218 constraint int_ne(pos__253[4], pos__253[6]);\
00219 constraint int_ne(pos__253[4], pos__253[7]);\
00220 constraint int_ne(pos__253[4], pos__253[8]);\
00221 constraint int_ne(pos__253[4], pos__253[9]);\
00222 constraint int_ne(pos__253[5], pos__253[6]);\
00223 constraint int_ne(pos__253[5], pos__253[7]);\
00224 constraint int_ne(pos__253[5], pos__253[8]);\
00225 constraint int_ne(pos__253[5], pos__253[9]);\
00226 constraint int_ne(pos__253[6], pos__253[7]);\
00227 constraint int_ne(pos__253[6], pos__253[8]);\
00228 constraint int_ne(pos__253[6], pos__253[9]);\
00229 constraint int_ne(pos__253[7], pos__253[8]);\
00230 constraint int_ne(pos__253[7], pos__253[9]);\
00231 constraint int_ne(pos__253[8], pos__253[9]);\
00232 solve \
00233   ::int_search(pos__253, first_fail, indomain, complete) maximize sat;\
00234 ", "\
00235 pos__253 = array1d(1..9, [0, 1, 4, 3, 2, 8, 5, 6, 7]);\n\
00236 sat = 8;\n\
00237 ----------\n\
00238 ==========\n\
00239 ");
00240       }
00241     };
00242 
00243     Create c;
00244   }
00245 
00246 }}
00247 
00248 // STATISTICS: test-flatzinc