Generated on Tue Jan 19 2021 06:15:49 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  * 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 #ifndef __GECODE_FLOAT_ARITHMETIC_HH__
39 #define __GECODE_FLOAT_ARITHMETIC_HH__
40 
41 #include <gecode/int.hh>
42 #include <gecode/float.hh>
43 #include <gecode/float/rel.hh>
44 
50 namespace Gecode { namespace Float { namespace Arithmetic {
51 
57  template<class VA, class VB>
58  class SqrPlus : public MixBinaryPropagator<VA,PC_FLOAT_BND,VB,PC_FLOAT_BND> {
59  protected:
63  SqrPlus(Home home, VA x0, VB x1);
65  SqrPlus(Space& home, SqrPlus<VA,VB>& p);
66  public:
68  static ExecStatus post(Home home, VA x0, VB x1);
70  virtual Actor* copy(Space& home);
72  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
73  };
74 
81  template<class View>
82  class Sqr : public BinaryPropagator<View,PC_FLOAT_BND> {
83  protected:
86 
88  Sqr(Space& home, Sqr& p);
90  Sqr(Home home, View x0, View x1);
91  public:
93  virtual Actor* copy(Space& home);
95  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
97  static ExecStatus post(Home home, View x0, View x1);
98  };
99 
108  template<class A, class B>
109  class Sqrt : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> {
110  protected:
113 
115  Sqrt(Space& home, Sqrt& p);
117  Sqrt(Home home, A x0, B x1);
118  public:
120  virtual Actor* copy(Space& home);
122  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
124  static ExecStatus post(Home home, A x0, B x1);
125  };
126 
135  template<class A, class B>
136  class Abs : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> {
137  protected:
140 
142  Abs(Space& home, Abs& p);
144  Abs(Home home, A x0, B x1);
145  public:
147  Abs(Space& home, Propagator& p, A x0, B x1);
149  virtual Actor* copy(Space& home);
151  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
153  static ExecStatus post(Home home, A x0, B x1);
154  };
155 
164  template<class A, class B>
165  class Pow : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> {
166  protected:
169  int m_n;
170 
172  Pow(Space& home, Pow& p);
174  Pow(Home home, A x0, B x1, int n);
175  public:
177  virtual Actor* copy(Space& home);
179  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
181  static ExecStatus post(Home home, A x0, B x1, int n);
182  };
183 
192  template<class A, class B>
193  class NthRoot : public MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND> {
194  protected:
197  int m_n;
198 
200  NthRoot(Space& home, NthRoot& p);
202  NthRoot(Home home, A x0, B x1, int n);
203  public:
205  virtual Actor* copy(Space& home);
207  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
209  static ExecStatus post(Home home, A x0, B x1, int n);
210  };
211 
218  template<class View>
219  class MultZeroOne : public BinaryPropagator<View,PC_FLOAT_BND> {
220  protected:
223 
227  MultZeroOne(Home home, View x0, View x1);
228  public:
230  virtual Actor* copy(Space& home);
232  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
234  static ExecStatus post(Home home, View x0, View x1);
235  };
236 
237 
243  template<class VA, class VB, class VC>
244  class MultPlus :
245  public MixTernaryPropagator<VA,PC_FLOAT_BND,VB,PC_FLOAT_BND,VC,PC_FLOAT_BND> {
246  protected:
250  public:
252  MultPlus(Home home, VA x0, VB x1, VC x2);
256  static ExecStatus post(Home home, VA x0, VB x1, VC x2);
258  virtual Actor* copy(Space& home);
260  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
261  };
262 
270  template<class View>
271  class Mult : public TernaryPropagator<View,PC_FLOAT_BND> {
272  protected:
276 
278  Mult(Space& home, Mult<View>& p);
279  public:
281  Mult(Home home, View x0, View x1, View x2);
283  static ExecStatus post(Home home, View x0, View x1, View x2);
285  virtual Actor* copy(Space& home);
287  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
288  };
289 
290 
299  template<class A, class B, class C>
300  class Div : public MixTernaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND,C,PC_FLOAT_BND> {
301  protected:
306  Div(Space& home, Div& p);
308  Div(Home home, A x0, B x1, C x2);
309  public:
311  virtual Actor* copy(Space& home);
313  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
315  static ExecStatus post(Home home, A x0, B x1, C x2);
316  };
317 
326  template<class A, class B, class C>
327  class Min : public MixTernaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND,C,PC_FLOAT_BND> {
328  protected:
333  Min(Space& home, Min& p);
335  Min(Home home, A x0, B x1, C x2);
336  public:
338  Min(Space& home, Propagator& p, A x0, B x1, C x2);
340  virtual Actor* copy(Space& home);
342  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
344  static ExecStatus post(Home home, A x0, B x1, C x2);
345  };
346 
355  template<class A, class B, class C>
356  class Max : public MixTernaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND,C,PC_FLOAT_BND> {
357  protected:
362  Max(Space& home, Max& p);
364  Max(Home home, A x0, B x1, C x2);
365  public:
367  Max(Space& home, Propagator& p, A x0, B x1, C x2);
369  virtual Actor* copy(Space& home);
371  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
373  static ExecStatus post(Home home, A x0, B x1, C x2);
374  };
375 
382  template<class View>
383  class NaryMax : public NaryOnePropagator<View,PC_FLOAT_BND> {
384  protected:
387 
389  NaryMax(Space& home, NaryMax& p);
391  NaryMax(Home home, ViewArray<View>& x, View y);
392  public:
394  virtual Actor* copy(Space& home);
396  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
398  static ExecStatus post(Home home, ViewArray<View>& x, View y);
399  };
400 
401 }}}
402 
409 
410 #endif
411 
412 // STATISTICS: float-prop
Propagator for bounds consistent max operator
Definition: arithmetic.hh:356
Base-class for propagators.
Definition: core.hpp:1023
Bounds consistent positive multiplication propagator.
Definition: arithmetic.hh:244
Computation spaces.
Definition: core.hpp:1701
Base-class for both propagators and branchers.
Definition: core.hpp:627
static ExecStatus post(Home home, VA x0, VB x1)
Post propagator .
Definition: sqr-sqrt.hpp:51
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
Bounds consistent positive square propagator.
Definition: arithmetic.hh:58
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
Propagator for bounds consistent square operator
Definition: arithmetic.hh:82
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: sqr-sqrt.hpp:77
Propagator for bounds consistent pow operator
Definition: arithmetic.hh:165
Binary propagator.
Definition: pattern.hpp:84
Mixed ternary propagator.
Definition: pattern.hpp:237
Bounds or domain consistent propagator for .
Definition: arithmetic.hh:219
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1034
Propagator for bounds consistent square root operator
Definition: arithmetic.hh:109
Ternary propagator.
Definition: pattern.hpp:113
(n+1)-ary propagator
Definition: pattern.hpp:172
Bounds consistent multiplication propagator.
Definition: arithmetic.hh:271
Propagator for bounds consistent absolute operator
Definition: arithmetic.hh:136
View arrays.
Definition: array.hpp:235
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:767
Mixed binary propagator.
Definition: pattern.hpp:204
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: sqr-sqrt.hpp:71
ExecStatus
Definition: core.hpp:471
Post propagator for SetVar x
Definition: set.hh:767
Gecode toplevel namespace
Propagator for bounds division operator
Definition: arithmetic.hh:300
Bounds consistent n-ary maximum propagator.
Definition: arithmetic.hh:383
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
Home class for posting propagators
Definition: core.hpp:853
Propagator for bounds consistent min operator
Definition: arithmetic.hh:327
Propagator for bounds consistent nth root operator
Definition: arithmetic.hh:193
SqrPlus(Home home, VA x0, VB x1)
Constructor for posting.
Definition: sqr-sqrt.hpp:46