Generated on Thu Apr 5 2018 19:44:19 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$ by $Author$
13  * $Revision$
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 
42 namespace Gecode {
43 
44  void
45  abs(Home home, FloatVar x0, FloatVar x1) {
46  using namespace Float;
49  }
50 
51 
52  void
53  max(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
54  using namespace Float;
57  }
58 
59  void
60  max(Home home, const FloatVarArgs& x, FloatVar y) {
61  using namespace Float;
62  if (x.size() == 0)
63  throw TooFewArguments("Float::max");
65  ViewArray<FloatView> xv(home,x);
67  }
68 
69 
70  void
71  min(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
72  using namespace Float;
75  }
76 
77  void
78  min(Home home, const FloatVarArgs& x, FloatVar y) {
79  using namespace Float;
80  if (x.size() == 0)
81  throw TooFewArguments("Float::min");
83  ViewArray<MinusView> m(home,x.size());
84  for (int i=x.size(); i--; )
85  m[i] = MinusView(x[i]);
86  MinusView my(y);
88  }
89 
90 
91  void
92  mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
93  using namespace Float;
96  }
97 
98  void
99  sqr(Home home, FloatVar x0, FloatVar x1) {
100  using namespace Float;
101  GECODE_POST;
103  }
104 
105  void
106  sqrt(Home home, FloatVar x0, FloatVar x1) {
107  using namespace Float;
108  GECODE_POST;
110  }
111 
112  void
113  pow(Home home, FloatVar x0, int n, FloatVar x1) {
114  using namespace Float;
115  if (n < 0)
116  throw OutOfLimits("nroot");
117  GECODE_POST;
119  }
120 
121  void
122  nroot(Home home, FloatVar x0, int n, FloatVar x1) {
123  using namespace Float;
124  if (n < 0)
125  throw OutOfLimits("nroot");
126  GECODE_POST;
128  }
129 
130  void
131  div(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
132  using namespace Float;
133  GECODE_POST;
136  }
137 
138 }
139 
140 // STATISTICS: float-post
static ExecStatus post(Home home, ViewArray< View > &x, View y)
Post propagator .
Definition: min-max.hpp:153
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Definition: abs.hpp:51
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:92
Exception: Value out of limits
Definition: exception.hpp:48
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:1657
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:53
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:45
Passing float variables.
Definition: float.hh:981
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
Definition: arithmetic.cpp:122
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
Definition: arithmetic.cpp:113
Exception: Too few arguments available in argument array
Definition: exception.hpp:70
static ExecStatus post(Home home, View x0, View x1)
Post propagator for .
Definition: sqr-sqrt.hpp:109
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:99
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:106
static ExecStatus post(Home home, A x0, B x1, int n)
Post propagator for .
Definition: pow-nroot.hpp:53
View arrays.
Definition: array.hpp:228
static ExecStatus post(Home home, A x0, B x1, C x2)
Post propagator for .
Definition: min-max.hpp:72
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:71
static ExecStatus post(Home home, A x0, B x1, C x2)
Post propagator for .
Definition: min-max.hpp:121
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:769
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:131
Minus integer view.
Definition: view.hpp:278
static ExecStatus post(Home home, A x0, B x1)
Post propagator for .
Definition: sqr-sqrt.hpp:174
Post propagator for SetVar x
Definition: set.hh:769
static ExecStatus post(Home home, A x0, B x1, C x2)
Post propagator for .
Definition: div.hpp:64
Float variables.
Definition: float.hh:874
static ExecStatus post(Home home, View x0, View x1, View x2)
Post propagator .
Definition: mult.hpp:318
Gecode toplevel namespace
#define GECODE_POST
Check for failure in a constraint post function.
Definition: macros.hpp:44
Home class for posting propagators
Definition: core.hpp:846
#define GECODE_ES_FAIL(es)
Check whether execution status es is failed, and fail space home.
Definition: macros.hpp:107