Generated on Sat Feb 7 2015 02:01:32 for Gecode by doxygen 1.8.9.1
test_fzn_arith.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  * Last modified:
10  * $Date: 2014-11-04 13:28:32 +0100 (Tue, 04 Nov 2014) $ by $Author: schulte $
11  * $Revision: 14287 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #include "test/flatzinc.hh"
39 
40 namespace Test { namespace FlatZinc {
41 
42  namespace {
44  class Create {
45  public:
46 
48  Create(void) {
49  (void) new FlatZincTest("fzn_arith",
50 "var 1.0..10.0: f1 :: output_var;\n\
51 var 1.0..10.0: f2 :: output_var;\n\
52 var 1.0..10.0: f3 :: output_var;\n\
53 var 1.0..10.0: f4 :: output_var;\n\
54 var 1.0..10.0: f5 :: output_var;\n\
55 var 1.0..10.0: f6 :: output_var;\n\
56 var 1.0..10.0: f7 :: output_var;\n\
57 var 1.0..10.0: f8 :: output_var;\n\
58 var 1.0..10.0: f9 :: output_var;\n\
59 \n\
60 var 1..10: i1 :: output_var;\n\
61 var 1..10: i2 :: output_var;\n\
62 var 1..10: i3 :: output_var;\n\
63 var 1..10: i4 :: output_var;\n\
64 var 1..10: i5 :: output_var;\n\
65 var 1..10: i6 :: output_var;\n\
66 var 1..10: i7 :: output_var;\n\
67 var 1..10: i8 :: output_var;\n\
68 var 1..10: i9 :: output_var;\n\
69 \n\
70 constraint float_plus(1.0, 1.0, 2.0);\n\
71 constraint float_plus(f1, 1.0, 3.0);\n\
72 \n\
73 constraint float_plus(0.0, 1.0, 1.0);\n\
74 constraint float_plus(2.0, 1.0, f2);\n\
75 constraint float_plus(-1.0, 1.0, 0.0);\n\
76 constraint float_plus(-5.0, f4, 0.0);\n\
77 constraint int_plus(1, 1, 2);\n\
78 constraint int_plus(i1, 1, 3);\n\
79 \n\
80 constraint int_plus(0, 1, 1);\n\
81 constraint int_plus(2, 1, i2);\n\
82 \n\
83 constraint int_times(1, 1, 1);\n\
84 constraint int_times(i3, 2, 8);\n\
85 \n\
86 constraint int_plus(-1, 1, 0);\n\
87 constraint int_plus(-5, i4, 0);\n\
88 \n\
89 constraint int_div(1, 1, 1);\n\
90 constraint int_div(i5, 3, 2);\n\
91 \n\
92 constraint int_mod(1, 2, 1);\n\
93 constraint int_mod(i6, 6, 0);\n\
94 \n\
95 constraint int_min(1, 2, 1);\n\
96 constraint int_min(i7, 9, 8);\n\
97 \n\
98 constraint int_max(1, 2, 2);\n\
99 constraint int_max(i8, 7, 9);\n\
100 \n\
101 constraint int_abs(-1, 1);\n\
102 constraint int_abs(-10, i9);\n\
103 \n\
104 solve satisfy;\n\
105 ",
106 "f1 = 2.0;\n\
107 f2 = 3.0;\n\
108 f3 = 1.0;\n\
109 f4 = 5.0;\n\
110 f5 = 1.0;\n\
111 f6 = 1.0;\n\
112 f7 = 1.0;\n\
113 f8 = 1.0;\n\
114 f9 = 1.0;\n\
115 i1 = 2;\n\
116 i2 = 3;\n\
117 i3 = 4;\n\
118 i4 = 5;\n\
119 i5 = 6;\n\
120 i6 = 6;\n\
121 i7 = 8;\n\
122 i8 = 9;\n\
123 i9 = 10;\n\
124 ----------\n\
125 ");
126  }
127  };
128 
129  Create c;
130  }
131 
132 }}
133 
134 // STATISTICS: test-flatzinc
Gecode::FloatVal c(-8, 8)
General test support.
Definition: afc.cpp:43