Generated on Thu Mar 16 2017 03:24:14 for Gecode by doxygen 1.8.13
arithmetic.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
6  *
7  * Copyright:
8  * Christian Schulte, 2002
9  * Vincent Barichard, 2012
10  *
11  * Last modified:
12  * $Date: 2016-06-27 20:51:18 +0200 (Mon, 27 Jun 2016) $ by $Author: schulte $
13  * $Revision: 15132 $
14  *
15  * This file is part of Gecode, the generic constraint
16  * development environment:
17  * http://www.gecode.org
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining
20  * a copy of this software and associated documentation files (the
21  * "Software"), to deal in the Software without restriction, including
22  * without limitation the rights to use, copy, modify, merge, publish,
23  * distribute, sublicense, and/or sell copies of the Software, and to
24  * permit persons to whom the Software is furnished to do so, subject to
25  * the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  *
38  */
39 
41 #ifdef GECODE_HAS_MPFR
44 #endif
45 
46 namespace Gecode {
47 
48  void
49  abs(Home home, FloatVar x0, FloatVar x1) {
50  using namespace Float;
53  }
54 
55 
56  void
57  max(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
58  using namespace Float;
61  }
62 
63  void
64  max(Home home, const FloatVarArgs& x, FloatVar y) {
65  using namespace Float;
66  if (x.size() == 0)
67  throw TooFewArguments("Float::max");
69  ViewArray<FloatView> xv(home,x);
71  }
72 
73 
74  void
75  min(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
76  using namespace Float;
79  }
80 
81  void
82  min(Home home, const FloatVarArgs& x, FloatVar y) {
83  using namespace Float;
84  if (x.size() == 0)
85  throw TooFewArguments("Float::min");
87  ViewArray<MinusView> m(home,x.size());
88  for (int i=x.size(); i--; )
89  m[i] = MinusView(x[i]);
90  MinusView my(y);
92  }
93 
94 
95  void
96  mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
97  using namespace Float;
100  }
101 
102  void
103  sqr(Home home, FloatVar x0, FloatVar x1) {
104  using namespace Float;
105  GECODE_POST;
107  }
108 
109  void
110  sqrt(Home home, FloatVar x0, FloatVar x1) {
111  using namespace Float;
112  GECODE_POST;
114  }
115 
116  void
117  pow(Home home, FloatVar x0, int n, FloatVar x1) {
118  using namespace Float;
119  if (n < 0)
120  throw OutOfLimits("nroot");
121  GECODE_POST;
123  }
124 
125  void
126  nroot(Home home, FloatVar x0, int n, FloatVar x1) {
127  using namespace Float;
128  if (n < 0)
129  throw OutOfLimits("nroot");
130  GECODE_POST;
132  }
133 
134  void
135  div(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
136  using namespace Float;
137  GECODE_POST;
140  }
141 
142 #ifdef GECODE_HAS_MPFR
143  void
144  exp(Home home, FloatVar x0, FloatVar x1) {
145  using namespace Float;
146  GECODE_POST;
148  }
149 
150  void
151  log(Home home, FloatVar x0, FloatVar x1) {
152  using namespace Float;
153  GECODE_POST;
154  GECODE_ES_FAIL((Transcendental::Exp<FloatView,FloatView>
155  ::post(home,x1,x0)));
156  }
157 
158  void
160  using namespace Float;
161  GECODE_POST;
162  GECODE_ES_FAIL((Transcendental::Pow<FloatView,FloatView>
163  ::post(home,base,x1,x0)));
164  }
165 
166  void
168  using namespace Float;
169  GECODE_POST;
170  GECODE_ES_FAIL((Transcendental::Pow<FloatView,FloatView>
171  ::post(home,base,x0,x1)));
172  }
173 
174  void
175  asin(Home home, FloatVar x0, FloatVar x1) {
176  using namespace Float;
177  GECODE_POST;
179  }
180 
181  void
182  sin(Home home, FloatVar x0, FloatVar x1) {
183  using namespace Float;
184  GECODE_POST;
186  }
187 
188  void
189  acos(Home home, FloatVar x0, FloatVar x1) {
190  using namespace Float;
191  GECODE_POST;
193  }
194 
195  void
196  cos(Home home, FloatVar x0, FloatVar x1) {
197  using namespace Float;
198  GECODE_POST;
200  }
201 
202  void
203  atan(Home home, FloatVar x0, FloatVar x1) {
204  using namespace Float;
205  GECODE_POST;
207  }
208 
209  void
210  tan(Home home, FloatVar x0, FloatVar x1) {
211  using namespace Float;
212  GECODE_POST;
214  }
215 #endif
216 
217  void
218  channel(Home home, FloatVar x0, IntVar x1) {
219  using namespace Float;
220  using namespace Int;
221  GECODE_POST;
223  }
224 
225  void
226  channel(Home home, IntVar x0, FloatVar x1) {
227  using namespace Float;
228  using namespace Int;
229  GECODE_POST;
231  }
232 
233  void
234  channel(Home home, FloatVar x0, BoolVar x1) {
235  using namespace Float;
236  using namespace Int;
237  GECODE_POST;
239  }
240 
241  void
242  channel(Home home, BoolVar x0, FloatVar x1) {
243  using namespace Float;
244  using namespace Int;
245  GECODE_POST;
247  }
248 
249 }
250 
251 // STATISTICS: float-post
static ExecStatus post(Home home, ViewArray< View > &x, View y)
Post propagator .
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:96
Exception: Value out of limits
Definition: exception.hpp:48
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:1669
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Definition: tanatan.hpp:190
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:151
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition: arithmetic.cpp:218
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Definition: sincos.hpp:185
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:57
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:49
Passing float variables.
Definition: float.hh:979
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Definition: asinacos.hpp:97
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
Definition: arithmetic.cpp:126
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
Definition: arithmetic.cpp:117
Exception: Too few arguments available in argument array
Definition: exception.hpp:70
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Definition: sincos.hpp:129
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Definition: exp-log.hpp:52
static ExecStatus post(Home home, View x0, View x1)
Post propagator for .
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
static ExecStatus post(Home home, A x0, B x1, int n)
Post propagator for .
Definition: pow-nroot.hpp:138
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:103
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:110
static ExecStatus post(Home home, A x0, B x1, int n)
Post propagator for .
Definition: pow-nroot.hpp:53
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Definition: tanatan.hpp:102
View arrays.
Definition: array.hpp:234
void asin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:175
static ExecStatus post(Home home, A x0, B x1, C x2)
Post propagator for .
Boolean integer variables.
Definition: int.hh:492
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:75
void cos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:196
static ExecStatus post(Home home, A x0, B x1, C x2)
Post propagator for .
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:135
const double base
Base for geometric restart sequence.
Definition: search.hh:122
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
void tan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:210
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Definition: asinacos.hpp:52
Minus integer view.
Definition: view.hpp:276
Integer variables.
Definition: int.hh:351
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
static ExecStatus post(Home home, A x0, B x1, C x2)
Post propagator for .
Definition: div.hpp:64
Float variables.
Definition: float.hh:872
static ExecStatus post(Home home, View x0, View x1, View x2)
Post propagator .
Definition: mult.hpp:320
Gecode toplevel namespace
void sin(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:182
void acos(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:189
void exp(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:144
#define GECODE_POST
Check for failure in a constraint post function.
Definition: macros.hpp:44
Home class for posting propagators
Definition: core.hpp:905
#define GECODE_ES_FAIL(es)
Check whether execution status es is failed, and fail space home.
Definition: macros.hpp:107
double FloatNum
Floating point number base type.
Definition: float.hh:108
void atan(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:203
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.