Generated on Wed Jan 24 2018 21:22:26 for Gecode by doxygen 1.8.13
arithmetic.hh
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  * Guido Tack <tack@gecode.org>
6  * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
7  *
8  * Copyright:
9  * Christian Schulte, 2002
10  * Guido Tack, 2004
11  * Vincent Barichard, 2012
12  *
13  * Last modified:
14  * $Date: 2017-04-10 13:21:37 +0200 (Mon, 10 Apr 2017) $ by $Author: schulte $
15  * $Revision: 15631 $
16  *
17  * This file is part of Gecode, the generic constraint
18  * development environment:
19  * http://www.gecode.org
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining
22  * a copy of this software and associated documentation files (the
23  * "Software"), to deal in the Software without restriction, including
24  * without limitation the rights to use, copy, modify, merge, publish,
25  * distribute, sublicense, and/or sell copies of the Software, and to
26  * permit persons to whom the Software is furnished to do so, subject to
27  * the following conditions:
28  *
29  * The above copyright notice and this permission notice shall be
30  * included in all copies or substantial portions of the Software.
31  *
32  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39  *
40  */
41 
42 #ifndef __GECODE_FLOAT_ARITHMETIC_HH__
43 #define __GECODE_FLOAT_ARITHMETIC_HH__
44 
45 #include <gecode/int.hh>
46 #include <gecode/float.hh>
47 #include <gecode/float/rel.hh>
48 
54 namespace Gecode { namespace Float { namespace Arithmetic {
55 
61  template<class VA, class VB>
62  class SqrPlus : public MixBinaryPropagator<VA,PC_FLOAT_BND,VB,PC_FLOAT_BND> {
63  protected:
67  SqrPlus(Home home, VA x0, VB x1);
69  SqrPlus(Space& home, bool share, SqrPlus<VA,VB>& p);
70  public:
72  static ExecStatus post(Home home, VA x0, VB x1);
74  virtual Actor* copy(Space& home, bool share);
76  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
77  };
78 
85  template<class View>
86  class Sqr : public BinaryPropagator<View,PC_FLOAT_BND> {
87  protected:
90 
92  Sqr(Space& home, bool share, Sqr& p);
94  Sqr(Home home, View x0, View x1);
95  public:
97  virtual Actor* copy(Space& home, bool share);
99  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
101  static ExecStatus post(Home home, View x0, View x1);
102  };
103 
112  template<class A, class B>
113  class Sqrt : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> {
114  protected:
117 
119  Sqrt(Space& home, bool share, Sqrt& p);
121  Sqrt(Home home, A x0, B x1);
122  public:
124  virtual Actor* copy(Space& home, bool share);
126  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
128  static ExecStatus post(Home home, A x0, B x1);
129  };
130 
139  template<class A, class B>
140  class Abs : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> {
141  protected:
144 
146  Abs(Space& home, bool share, Abs& p);
148  Abs(Home home, A x0, B x1);
149  public:
151  Abs(Space& home, bool share, Propagator& p, A x0, B x1);
153  virtual Actor* copy(Space& home, bool share);
155  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
157  static ExecStatus post(Home home, A x0, B x1);
158  };
159 
168  template<class A, class B>
169  class Pow : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> {
170  protected:
173  int m_n;
174 
176  Pow(Space& home, bool share, Pow& p);
178  Pow(Home home, A x0, B x1, int n);
179  public:
181  virtual Actor* copy(Space& home, bool share);
183  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
185  static ExecStatus post(Home home, A x0, B x1, int n);
186  };
187 
196  template<class A, class B>
197  class NthRoot : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> {
198  protected:
201  int m_n;
202 
204  NthRoot(Space& home, bool share, NthRoot& p);
206  NthRoot(Home home, A x0, B x1, int n);
207  public:
209  virtual Actor* copy(Space& home, bool share);
211  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
213  static ExecStatus post(Home home, A x0, B x1, int n);
214  };
215 
222  template<class View>
223  class MultZeroOne : public BinaryPropagator<View,PC_FLOAT_BND> {
224  protected:
227 
229  MultZeroOne(Space& home, bool share, MultZeroOne<View>& p);
231  MultZeroOne(Home home, View x0, View x1);
232  public:
234  virtual Actor* copy(Space& home, bool share);
236  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
238  static ExecStatus post(Home home, View x0, View x1);
239  };
240 
241 
247  template<class VA, class VB, class VC>
248  class MultPlus :
249  public MixTernaryPropagator<VA,PC_FLOAT_BND,VB,PC_FLOAT_BND,VC,PC_FLOAT_BND> {
250  protected:
254  public:
256  MultPlus(Home home, VA x0, VB x1, VC x2);
258  MultPlus(Space& home, bool share, MultPlus<VA,VB,VC>& p);
260  static ExecStatus post(Home home, VA x0, VB x1, VC x2);
262  virtual Actor* copy(Space& home, bool share);
264  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
265  };
266 
274  template<class View>
275  class Mult : public TernaryPropagator<View,PC_FLOAT_BND> {
276  protected:
280 
282  Mult(Space& home, bool share, Mult<View>& p);
283  public:
285  Mult(Home home, View x0, View x1, View x2);
287  static ExecStatus post(Home home, View x0, View x1, View x2);
289  virtual Actor* copy(Space& home, bool share);
291  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
292  };
293 
294 
303  template<class A, class B, class C>
304  class Div : public MixTernaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND,C,PC_FLOAT_BND> {
305  protected:
310  Div(Space& home, bool share, Div& p);
312  Div(Home home, A x0, B x1, C x2);
313  public:
315  virtual Actor* copy(Space& home, bool share);
317  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
319  static ExecStatus post(Home home, A x0, B x1, C x2);
320  };
321 
330  template<class A, class B, class C>
331  class Min : public MixTernaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND,C,PC_FLOAT_BND> {
332  protected:
337  Min(Space& home, bool share, Min& p);
339  Min(Home home, A x0, B x1, C x2);
340  public:
342  Min(Space& home, bool share, Propagator& p, A x0, B x1, C x2);
344  virtual Actor* copy(Space& home, bool share);
346  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
348  static ExecStatus post(Home home, A x0, B x1, C x2);
349  };
350 
359  template<class A, class B, class C>
360  class Max : public MixTernaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND,C,PC_FLOAT_BND> {
361  protected:
366  Max(Space& home, bool share, Max& p);
368  Max(Home home, A x0, B x1, C x2);
369  public:
371  Max(Space& home, bool share, Propagator& p, A x0, B x1, C x2);
373  virtual Actor* copy(Space& home, bool share);
375  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
377  static ExecStatus post(Home home, A x0, B x1, C x2);
378  };
379 
386  template<class View>
387  class NaryMax : public NaryOnePropagator<View,PC_FLOAT_BND> {
388  protected:
391 
393  NaryMax(Space& home, bool share, NaryMax& p);
395  NaryMax(Home home, ViewArray<View>& x, View y);
396  public:
398  virtual Actor* copy(Space& home, bool share);
400  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
402  static ExecStatus post(Home home, ViewArray<View>& x, View y);
403  };
404 
405 }}}
406 
413 
414 #endif
415 
416 // STATISTICS: float-prop
Propagator for bounds consistent max operator
Definition: arithmetic.hh:360
Base-class for propagators.
Definition: core.hpp:1092
Bounds consistent positive multiplication propagator.
Definition: arithmetic.hh:248
Computation spaces.
Definition: core.hpp:1748
Base-class for both propagators and branchers.
Definition: core.hpp:696
static ExecStatus post(Home home, VA x0, VB x1)
Post propagator .
Definition: sqr-sqrt.hpp:55
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
Bounds consistent positive square propagator.
Definition: arithmetic.hh:62
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
Propagator for bounds consistent square operator
Definition: arithmetic.hh:86
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: sqr-sqrt.hpp:81
Propagator for bounds consistent pow operator
Definition: arithmetic.hh:169
Binary propagator.
Definition: propagator.hpp:89
Mixed ternary propagator.
Definition: propagator.hpp:247
Bounds or domain consistent propagator for .
Definition: arithmetic.hh:223
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1103
Propagator for bounds consistent square root operator
Definition: arithmetic.hh:113
Ternary propagator.
Definition: propagator.hpp:119
(n+1)-ary propagator
Definition: propagator.hpp:180
Bounds consistent multiplication propagator.
Definition: arithmetic.hh:275
Propagator for bounds consistent absolute operator
Definition: arithmetic.hh:140
View arrays.
Definition: array.hpp:234
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:784
Mixed binary propagator.
Definition: propagator.hpp:213
ExecStatus
Definition: core.hpp:540
Post propagator for SetVar x
Definition: set.hh:784
Gecode toplevel namespace
Propagator for bounds division operator
Definition: arithmetic.hh:304
Bounds consistent n-ary maximum propagator.
Definition: arithmetic.hh:387
int ModEventDelta
Modification event deltas.
Definition: core.hpp:169
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: sqr-sqrt.hpp:75
Home class for posting propagators
Definition: core.hpp:922
Propagator for bounds consistent min operator
Definition: arithmetic.hh:331
Propagator for bounds consistent nth root operator
Definition: arithmetic.hh:197
SqrPlus(Home home, VA x0, VB x1)
Constructor for posting.
Definition: sqr-sqrt.hpp:50