this repo has no description
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 { 39 /// Helper class to create and register tests 40 class Create { 41 public: 42 43 /// Perform creation and registration 44 Create(void) { 45 (void) new FlatZincTest("queens::ip", 46"predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ 47predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ 48predicate bool_lin_lt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ 49predicate bool_lin_ne(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ 50array [1..64] of var 0..1: q :: output_array([0..7, 0..7]);\n\ 51constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[1], q[2], q[3], q[4], q[5], q[6], q[7], q[8]], 1);\n\ 52constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[1], q[9], q[17], q[25], q[33], q[41], q[49], q[57]], 1);\n\ 53constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[2], q[10], q[18], q[26], q[34], q[42], q[50], q[58]], 1);\n\ 54constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[3], q[11], q[19], q[27], q[35], q[43], q[51], q[59]], 1);\n\ 55constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[4], q[12], q[20], q[28], q[36], q[44], q[52], q[60]], 1);\n\ 56constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[5], q[13], q[21], q[29], q[37], q[45], q[53], q[61]], 1);\n\ 57constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[6], q[14], q[22], q[30], q[38], q[46], q[54], q[62]], 1);\n\ 58constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[7], q[15], q[23], q[31], q[39], q[47], q[55], q[63]], 1);\n\ 59constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[8], q[16], q[24], q[32], q[40], q[48], q[56], q[64]], 1);\n\ 60constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[9], q[10], q[11], q[12], q[13], q[14], q[15], q[16]], 1);\n\ 61constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[17], q[18], q[19], q[20], q[21], q[22], q[23], q[24]], 1);\n\ 62constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[25], q[26], q[27], q[28], q[29], q[30], q[31], q[32]], 1);\n\ 63constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[33], q[34], q[35], q[36], q[37], q[38], q[39], q[40]], 1);\n\ 64constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[41], q[42], q[43], q[44], q[45], q[46], q[47], q[48]], 1);\n\ 65constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[49], q[50], q[51], q[52], q[53], q[54], q[55], q[56]], 1);\n\ 66constraint int_lin_eq([1, 1, 1, 1, 1, 1, 1, 1], [q[57], q[58], q[59], q[60], q[61], q[62], q[63], q[64]], 1);\n\ 67constraint int_lin_le([1, 1], [q[2], q[9]], 1);\n\ 68constraint int_lin_le([1, 1], [q[7], q[16]], 1);\n\ 69constraint int_lin_le([1, 1], [q[49], q[58]], 1);\n\ 70constraint int_lin_le([1, 1], [q[56], q[63]], 1);\n\ 71constraint int_lin_le([1, 1, 1], [q[3], q[10], q[17]], 1);\n\ 72constraint int_lin_le([1, 1, 1], [q[6], q[15], q[24]], 1);\n\ 73constraint int_lin_le([1, 1, 1], [q[41], q[50], q[59]], 1);\n\ 74constraint int_lin_le([1, 1, 1], [q[48], q[55], q[62]], 1);\n\ 75constraint int_lin_le([1, 1, 1, 1], [q[4], q[11], q[18], q[25]], 1);\n\ 76constraint int_lin_le([1, 1, 1, 1], [q[5], q[14], q[23], q[32]], 1);\n\ 77constraint int_lin_le([1, 1, 1, 1], [q[33], q[42], q[51], q[60]], 1);\n\ 78constraint int_lin_le([1, 1, 1, 1], [q[40], q[47], q[54], q[61]], 1);\n\ 79constraint int_lin_le([1, 1, 1, 1, 1], [q[4], q[13], q[22], q[31], q[40]], 1);\n\ 80constraint int_lin_le([1, 1, 1, 1, 1], [q[5], q[12], q[19], q[26], q[33]], 1);\n\ 81constraint int_lin_le([1, 1, 1, 1, 1], [q[25], q[34], q[43], q[52], q[61]], 1);\n\ 82constraint int_lin_le([1, 1, 1, 1, 1], [q[32], q[39], q[46], q[53], q[60]], 1);\n\ 83constraint int_lin_le([1, 1, 1, 1, 1, 1], [q[3], q[12], q[21], q[30], q[39], q[48]], 1);\n\ 84constraint int_lin_le([1, 1, 1, 1, 1, 1], [q[6], q[13], q[20], q[27], q[34], q[41]], 1);\n\ 85constraint int_lin_le([1, 1, 1, 1, 1, 1], [q[17], q[26], q[35], q[44], q[53], q[62]], 1);\n\ 86constraint int_lin_le([1, 1, 1, 1, 1, 1], [q[24], q[31], q[38], q[45], q[52], q[59]], 1);\n\ 87constraint int_lin_le([1, 1, 1, 1, 1, 1, 1], [q[2], q[11], q[20], q[29], q[38], q[47], q[56]], 1);\n\ 88constraint int_lin_le([1, 1, 1, 1, 1, 1, 1], [q[7], q[14], q[21], q[28], q[35], q[42], q[49]], 1);\n\ 89constraint int_lin_le([1, 1, 1, 1, 1, 1, 1], [q[9], q[18], q[27], q[36], q[45], q[54], q[63]], 1);\n\ 90constraint int_lin_le([1, 1, 1, 1, 1, 1, 1], [q[16], q[23], q[30], q[37], q[44], q[51], q[58]], 1);\n\ 91constraint int_lin_le([1, 1, 1, 1, 1, 1, 1, 1], [q[1], q[10], q[19], q[28], q[37], q[46], q[55], q[64]], 1);\n\ 92constraint int_lin_le([1, 1, 1, 1, 1, 1, 1, 1], [q[8], q[15], q[22], q[29], q[36], q[43], q[50], q[57]], 1);\n\ 93solve :: int_search(q, first_fail, indomain_min, complete) satisfy;\n\ 94", "q = array2d(0..7, 0..7, [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0]);\n\ 95----------\n\ 96"); 97 } 98 }; 99 100 Create c; 101 } 102 103}} 104 105// STATISTICS: test-flatzinc