Generated on Tue Apr 18 10:22:17 2017 for Gecode by doxygen 1.6.3

test_fzn_logic.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  *  Last modified:
00010  *     $Date: 2014-11-04 13:28:32 +0100 (Tue, 04 Nov 2014) $ by $Author: schulte $
00011  *     $Revision: 14287 $
00012  *
00013  *  This file is part of Gecode, the generic constraint
00014  *  development environment:
00015  *     http://www.gecode.org
00016  *
00017  *  Permission is hereby granted, free of charge, to any person obtaining
00018  *  a copy of this software and associated documentation files (the
00019  *  "Software"), to deal in the Software without restriction, including
00020  *  without limitation the rights to use, copy, modify, merge, publish,
00021  *  distribute, sublicense, and/or sell copies of the Software, and to
00022  *  permit persons to whom the Software is furnished to do so, subject to
00023  *  the following conditions:
00024  *
00025  *  The above copyright notice and this permission notice shall be
00026  *  included in all copies or substantial portions of the Software.
00027  *
00028  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00029  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00030  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00031  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00032  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00033  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00034  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00035  *
00036  */
00037 
00038 #include "test/flatzinc.hh"
00039 
00040 namespace Test { namespace FlatZinc {
00041 
00042   namespace {
00044     class Create {
00045     public:
00046 
00048       Create(void) {
00049         (void) new FlatZincTest("fzn_logic",
00050 "var bool: b1 :: output_var;\n\
00051 var bool: b2 :: output_var;\n\
00052 var bool: b3 :: output_var;\n\
00053 var bool: b4 :: output_var;\n\
00054 var bool: b5 :: output_var;\n\
00055 var bool: b6 :: output_var;\n\
00056 array [1..3] of var bool: ab1 :: output_array([1..3]);\n\
00057 array [1..3] of var bool: ab2 :: output_array([1..3]);\n\
00058 \n\
00059 constraint bool_eq(true, true);\n\
00060 constraint bool_eq(false, false);\n\
00061 \n\
00062 constraint bool_not(true, false);\n\
00063 constraint bool_not(false, true);\n\
00064 \n\
00065 constraint bool_and(false, true,  false);\n\
00066 constraint bool_and(false, false, false);\n\
00067 constraint bool_and(true,  false, false);\n\
00068 constraint bool_and(true,  true,  true);\n\
00069 constraint bool_and(b1,    true, true);\n\
00070 \n\
00071 constraint bool_or(false, true,  true);\n\
00072 constraint bool_or(false, false, false);\n\
00073 constraint bool_or(true,  false, true);\n\
00074 constraint bool_or(true,  true,  true);\n\
00075 constraint bool_or(b2,    false, true);\n\
00076 \n\
00077 constraint bool_xor(false, true,  true);\n\
00078 constraint bool_xor(false, false, false);\n\
00079 constraint bool_xor(true,  false, true);\n\
00080 constraint bool_xor(true,  true,  false);\n\
00081 constraint bool_xor(b3,    false, true);\n\
00082 \n\
00083 constraint bool_le_reif(false, true,  true);\n\
00084 constraint bool_le_reif(false, false, true);\n\
00085 constraint bool_le_reif(true,  false, false);\n\
00086 constraint bool_le_reif(true,  true,  true);\n\
00087 constraint bool_le_reif(true,  b4,    true);\n\
00088 \n\
00089 constraint bool_le_reif(false, true, true);\n\
00090 constraint bool_le_reif(false, false, true);\n\
00091 constraint bool_le_reif(true,  false,  false);\n\
00092 constraint bool_le_reif(true,  true,  true);\n\
00093 constraint bool_le_reif(true,  b5,  true);\n\
00094 \n\
00095 constraint bool_not(false, true);\n\
00096 constraint bool_not(true, false);\n\
00097 constraint bool_not(b6, false);\n\
00098 \n\
00099 constraint array_bool_and([false], false);\n\
00100 constraint array_bool_and([true], true);\n\
00101 constraint array_bool_and([false, true],  false);\n\
00102 constraint array_bool_and([false, false], false);\n\
00103 constraint array_bool_and([true,  false], false);\n\
00104 constraint array_bool_and([true,  true],  true);\n\
00105 constraint array_bool_and(ab1, true);\n\
00106 \n\
00107 constraint array_bool_or([false], false);\n\
00108 constraint array_bool_or([true], true);\n\
00109 constraint array_bool_or([false, true],  true);\n\
00110 constraint array_bool_or([false, false], false);\n\
00111 constraint array_bool_or([true,  false], true);\n\
00112 constraint array_bool_or([true,  true],  true);\n\
00113 constraint array_bool_or(ab2, true);\n\
00114 \n\
00115 solve satisfy;\n\
00116 ",
00117 "ab1 = array1d(1..3, [true, true, true]);\n\
00118 ab2 = array1d(1..3, [true, false, false]);\n\
00119 b1 = true;\n\
00120 b2 = true;\n\
00121 b3 = true;\n\
00122 b4 = true;\n\
00123 b5 = true;\n\
00124 b6 = true;\n\
00125 ----------\n\
00126 ");
00127       }
00128     };
00129 
00130     Create c;
00131   }
00132 
00133 }}
00134 
00135 // STATISTICS: test-flatzinc