Generated on Fri Jan 10 2020 11:38:25 for Gecode by doxygen 1.8.16
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  * This file is part of Gecode, the generic constraint
12  * development environment:
13  * http://www.gecode.org
14  *
15  * Permission is hereby granted, free of charge, to any person obtaining
16  * a copy of this software and associated documentation files (the
17  * "Software"), to deal in the Software without restriction, including
18  * without limitation the rights to use, copy, modify, merge, publish,
19  * distribute, sublicense, and/or sell copies of the Software, and to
20  * permit persons to whom the Software is furnished to do so, subject to
21  * the following conditions:
22  *
23  * The above copyright notice and this permission notice shall be
24  * included in all copies or substantial portions of the Software.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33  *
34  */
35 
37 
38 namespace Gecode {
39 
40  void
41  abs(Home home, FloatVar x0, FloatVar x1) {
42  using namespace Float;
45  }
46 
47 
48  void
49  max(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
50  using namespace Float;
53  }
54 
55  void
56  max(Home home, const FloatVarArgs& x, FloatVar y) {
57  using namespace Float;
58  if (x.size() == 0)
59  throw TooFewArguments("Float::max");
61  ViewArray<FloatView> xv(home,x);
63  }
64 
65 
66  void
67  min(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
68  using namespace Float;
71  }
72 
73  void
74  min(Home home, const FloatVarArgs& x, FloatVar y) {
75  using namespace Float;
76  if (x.size() == 0)
77  throw TooFewArguments("Float::min");
79  ViewArray<MinusView> m(home,x.size());
80  for (int i=x.size(); i--; )
81  m[i] = MinusView(x[i]);
82  MinusView my(y);
84  }
85 
86 
87  void
88  mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
89  using namespace Float;
92  }
93 
94  void
95  sqr(Home home, FloatVar x0, FloatVar x1) {
96  using namespace Float;
99  }
100 
101  void
102  sqrt(Home home, FloatVar x0, FloatVar x1) {
103  using namespace Float;
104  GECODE_POST;
106  }
107 
108  void
109  pow(Home home, FloatVar x0, int n, FloatVar x1) {
110  using namespace Float;
111  if (n < 0)
112  throw OutOfLimits("pow");
113  GECODE_POST;
115  }
116 
117  void
118  nroot(Home home, FloatVar x0, int n, FloatVar x1) {
119  using namespace Float;
120  if (n < 0)
121  throw OutOfLimits("nroot");
122  GECODE_POST;
124  }
125 
126  void
127  div(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
128  using namespace Float;
129  GECODE_POST;
132  }
133 
134 }
135 
136 // STATISTICS: float-post
Passing float variables.
Definition: float.hh:979
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
Definition: arithmetic.cpp:109
Post propagator for SetVar x
Definition: set.hh:767
static ExecStatus post(Home home, A x0, B x1, int n)
Post propagator for .
Definition: pow-nroot.hpp:49
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:767
#define GECODE_ES_FAIL(es)
Check whether execution status es is failed, and fail space home.
Definition: macros.hpp:103
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:49
Minus integer view.
Definition: view.hpp:282
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:95
static ExecStatus post(Home home, View x0, View x1, View x2)
Post propagator .
Definition: mult.hpp:314
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:127
Gecode toplevel namespace
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n\geq 0$.
Definition: arithmetic.cpp:118
Home class for posting propagators
Definition: core.hpp:856
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:102
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Definition: abs.hpp:47
static ExecStatus post(Home home, ViewArray< View > &x, View y)
Post propagator .
Definition: min-max.hpp:155
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:88
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:41
static ExecStatus post(Home home, A x0, B x1, C x2)
Post propagator for .
Definition: div.hpp:60
Float variables.
Definition: float.hh:870
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Definition: sqr-sqrt.hpp:170
static ExecStatus post(Home home, A x0, B x1, C x2)
Post propagator for .
Definition: min-max.hpp:68
#define GECODE_POST
Check for failure in a constraint post function.
Definition: macros.hpp:40
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:67
Exception: Value out of limits
Definition: exception.hpp:44
View arrays.
Definition: array.hpp:253
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
static ExecStatus post(Home home, A x0, B x1, C x2)
Post propagator for .
Definition: min-max.hpp:120
static ExecStatus post(Home home, View x0, View x1)
Post propagator for .
Definition: sqr-sqrt.hpp:105
Gecode::IntArgs i({1, 2, 3, 4})
Exception: Too few arguments available in argument array
Definition: exception.hpp:66
static ExecStatus post(Home home, A x0, B x1, int n)
Post propagator for .
Definition: pow-nroot.hpp:134