Generated on Tue May 22 09:40:18 2018 for Gecode by doxygen 1.6.3

test_fzn_arith.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("fzn_arith",
00046 "var 1.0..10.0: f1 :: output_var;\n\
00047 var 1.0..10.0: f2 :: output_var;\n\
00048 var 1.0..10.0: f3 :: output_var;\n\
00049 var 1.0..10.0: f4 :: output_var;\n\
00050 var 1.0..10.0: f5 :: output_var;\n\
00051 var 1.0..10.0: f6 :: output_var;\n\
00052 var 1.0..10.0: f7 :: output_var;\n\
00053 var 1.0..10.0: f8 :: output_var;\n\
00054 var 1.0..10.0: f9 :: output_var;\n\
00055 \n\
00056 var 1..10: i1 :: output_var;\n\
00057 var 1..10: i2 :: output_var;\n\
00058 var 1..10: i3 :: output_var;\n\
00059 var 1..10: i4 :: output_var;\n\
00060 var 1..10: i5 :: output_var;\n\
00061 var 1..10: i6 :: output_var;\n\
00062 var 1..10: i7 :: output_var;\n\
00063 var 1..10: i8 :: output_var;\n\
00064 var 1..10: i9 :: output_var;\n\
00065 \n\
00066 constraint float_plus(1.0, 1.0, 2.0);\n\
00067 constraint float_plus(f1, 1.0, 3.0);\n\
00068 \n\
00069 constraint float_plus(0.0, 1.0, 1.0);\n\
00070 constraint float_plus(2.0, 1.0, f2);\n\
00071 constraint float_plus(-1.0, 1.0, 0.0);\n\
00072 constraint float_plus(-5.0, f4, 0.0);\n\
00073 constraint int_plus(1, 1, 2);\n\
00074 constraint int_plus(i1, 1, 3);\n\
00075 \n\
00076 constraint int_plus(0, 1, 1);\n\
00077 constraint int_plus(2, 1, i2);\n\
00078 \n\
00079 constraint int_times(1, 1, 1);\n\
00080 constraint int_times(i3, 2, 8);\n\
00081 \n\
00082 constraint int_plus(-1, 1, 0);\n\
00083 constraint int_plus(-5, i4, 0);\n\
00084 \n\
00085 constraint int_div(1, 1, 1);\n\
00086 constraint int_div(i5, 3, 2);\n\
00087 \n\
00088 constraint int_mod(1, 2, 1);\n\
00089 constraint int_mod(i6, 6, 0);\n\
00090 \n\
00091 constraint int_min(1, 2, 1);\n\
00092 constraint int_min(i7, 9, 8);\n\
00093 \n\
00094 constraint int_max(1, 2, 2);\n\
00095 constraint int_max(i8, 7, 9);\n\
00096 \n\
00097 constraint int_abs(-1, 1);\n\
00098 constraint int_abs(-10, i9);\n\
00099 \n\
00100 solve satisfy;\n\
00101 ",
00102 "f1 = 2.0;\n\
00103 f2 = 3.0;\n\
00104 f3 = 1.0;\n\
00105 f4 = 5.0;\n\
00106 f5 = 1.0;\n\
00107 f6 = 1.0;\n\
00108 f7 = 1.0;\n\
00109 f8 = 1.0;\n\
00110 f9 = 1.0;\n\
00111 i1 = 2;\n\
00112 i2 = 3;\n\
00113 i3 = 4;\n\
00114 i4 = 5;\n\
00115 i5 = 6;\n\
00116 i6 = 6;\n\
00117 i7 = 8;\n\
00118 i8 = 9;\n\
00119 i9 = 10;\n\
00120 ----------\n\
00121 ");
00122       }
00123     };
00124 
00125     Create c;
00126   }
00127 
00128 }}
00129 
00130 // STATISTICS: test-flatzinc