Generated on Tue Jan 19 2021 06:15:49 for Gecode by doxygen 1.8.13
rel.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  * Contributing authors:
9  * Gabor Szokoli <szokoli@gecode.org>
10  *
11  * Copyright:
12  * Christian Schulte, 2002
13  * Guido Tack, 2004
14  * Gabor Szokoli, 2003
15  * Vincent Barichard, 2012
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_REL_HH__
43 #define __GECODE_FLOAT_REL_HH__
44 
45 #include <gecode/int.hh>
46 #include <gecode/float.hh>
47 
52 namespace Gecode { namespace Float { namespace Rel {
53 
54  /*
55  * Equality propagators
56  *
57  */
58 
65  template<class View0, class View1>
66  class Eq :
67  public MixBinaryPropagator<View0,PC_FLOAT_BND,View1,PC_FLOAT_BND> {
68  protected:
71 
73  Eq(Space& home, Eq<View0,View1>& p);
74  public:
76  Eq(Home home, View0 x0, View1 x1);
78  Eq(Space& home, Propagator& p, View0 x0, View1 x1);
80  virtual Actor* copy(Space& home);
82  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
84  static ExecStatus post(Home home, View0 x0, View1 x1);
85  };
86 
93  template<class View>
94  class NaryEq : public NaryPropagator<View,PC_FLOAT_BND> {
95  protected:
97 
99  NaryEq(Space& home, NaryEq<View>& p);
101  NaryEq(Home home, ViewArray<View>&);
102  public:
104  virtual Actor* copy(Space& home);
111  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
113  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
115  static ExecStatus post(Home home, ViewArray<View>& x);
116  };
117 
124  template<class View, class CtrlView, ReifyMode rm>
125  class ReEq : public Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView> {
126  protected:
130 
132  ReEq(Space& home, ReEq& p);
134  ReEq(Home home, View x0, View x1, CtrlView b);
135  public:
137  virtual Actor* copy(Space& home);
139  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
141  static ExecStatus post(Home home, View x0, View x1, CtrlView b);
142  };
143 
150  template<class View, class CtrlView, ReifyMode rm>
151  class ReEqFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
152  protected:
155 
159  ReEqFloat(Space& home, ReEqFloat& p);
161  ReEqFloat(Home home, View x, FloatVal c, CtrlView b);
162  public:
164  virtual Actor* copy(Space& home);
166  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
168  static ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
169  };
170 
171 
178  template<class View0, class View1>
179  class Nq :
180  public MixBinaryPropagator<View0,PC_FLOAT_VAL,View1,PC_FLOAT_VAL> {
181  protected:
184 
186  Nq(Space& home, Nq<View0,View1>& p);
187  public:
189  Nq(Home home, View0 x0, View1 x1);
191  Nq(Space& home, Propagator& p, View0 x0, View1 x1);
193  virtual Actor* copy(Space& home);
195  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
197  static ExecStatus post(Home home, View0 x0, View1 x1);
198  };
199 
206  template<class View>
207  class NqFloat :
208  public UnaryPropagator<View,PC_FLOAT_VAL> {
209  protected:
211 
215  NqFloat(Space& home, NqFloat<View>& p);
216  public:
218  NqFloat(Home home, View x, FloatVal c);
220  virtual Actor* copy(Space& home);
222  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
224  static ExecStatus post(Home home, View x0, FloatVal c);
225  };
226 
227 
228  /*
229  * Order propagators
230  *
231  */
232 
240  template<class View>
241  class Lq : public BinaryPropagator<View,PC_FLOAT_BND> {
242  protected:
245 
247  Lq(Space& home, Lq& p);
249  Lq(Home home, View x0, View x1);
250  public:
252  virtual Actor* copy(Space& home);
254  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
256  static ExecStatus post(Home home, View x0, View x1);
257  };
258 
266  template<class View>
267  class Le : public BinaryPropagator<View,PC_FLOAT_BND> {
268  protected:
271 
273  Le(Space& home, Le& p);
275  Le(Home home, View x0, View x1);
276  public:
278  virtual Actor* copy(Space& home);
280  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
282  static ExecStatus post(Home home, View x0, View x1);
283  };
284 
285  /*
286  * Reified order propagators
287  *
288  */
289 
297  template<class View, class CtrlView, ReifyMode rm>
298  class ReLqFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
299  protected:
302 
306  ReLqFloat(Space& home, ReLqFloat& p);
308  ReLqFloat(Home home, View x, FloatVal c, CtrlView b);
309  public:
311  virtual Actor* copy(Space& home);
313  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
315  static ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
316  };
317 
325  template<class View, class CtrlView, ReifyMode rm>
326  class ReLeFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
327  protected:
330 
334  ReLeFloat(Space& home, ReLeFloat& p);
336  ReLeFloat(Home home, View x, FloatVal c, CtrlView b);
337  public:
339  virtual Actor* copy(Space& home);
341  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
343  static ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
344  };
345 
353  template<class View, class CtrlView, ReifyMode rm>
354  class ReLq : public Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView> {
355  protected:
359 
361  ReLq(Space& home, ReLq& p);
363  ReLq(Home home, View x0, View x1, CtrlView b);
364  public:
366  virtual Actor* copy(Space& home);
368  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
370  static ExecStatus post(Home home, View x0, View x1, CtrlView b);
371  };
372 
373 }}}
374 
375 #include <gecode/float/rel/eq.hpp>
376 #include <gecode/float/rel/nq.hpp>
378 
379 #endif
380 
381 
382 // STATISTICS: float-prop
383 
Reified binary bounds consistent equality propagator.
Definition: rel.hh:125
Reified less or equal propagator.
Definition: rel.hh:354
Reified unary propagator.
Definition: propagator.hpp:54
Unary propagator.
Definition: pattern.hpp:55
Reified binary propagator.
Definition: propagator.hpp:87
Binary bounds consistent equality propagator.
Definition: rel.hh:66
Eq(Space &home, Eq< View0, View1 > &p)
Constructor for cloning p.
Definition: eq.hpp:67
Base-class for propagators.
Definition: core.hpp:1023
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: eq.hpp:79
Computation spaces.
Definition: core.hpp:1701
Base-class for both propagators and branchers.
Definition: core.hpp:627
Reified bounds consistent equality with float propagator.
Definition: rel.hh:151
FloatVal c
Float constant to check.
Definition: rel.hh:332
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
Definition: eq.hpp:50
Binary bounds consistent disequality propagator.
Definition: rel.hh:179
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
Reified less or equal with float propagator.
Definition: rel.hh:298
FloatVal c
Float constant to check.
Definition: rel.hh:213
FloatVal c
Float constant to check.
Definition: rel.hh:304
Binary propagator.
Definition: pattern.hpp:84
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1034
struct Gecode::@593::NNF::@62::@63 b
For binary nodes (and, or, eqv)
n-ary propagator
Definition: pattern.hpp:142
View arrays.
Definition: array.hpp:235
Less or equal propagator.
Definition: rel.hh:241
Float value type.
Definition: float.hh:334
Mixed binary propagator.
Definition: pattern.hpp:204
Propagation cost.
Definition: core.hpp:485
ExecStatus
Definition: core.hpp:471
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low binary)
Definition: pattern.hpp:614
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: eq.hpp:85
Post propagator for SetVar x
Definition: set.hh:767
FloatVal c
Float constant to check.
Definition: rel.hh:157
Gecode toplevel namespace
n-ary bounds consistent equality propagator
Definition: rel.hh:94
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
Home class for posting propagators
Definition: core.hpp:853
Less propagator.
Definition: rel.hh:267
Binary bounds consistent disequality propagator with float value.
Definition: rel.hh:207
Reified less with float propagator.
Definition: rel.hh:326