Generated on Wed Jul 21 2021 00:00:00 for Gecode by doxygen 1.9.1
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 
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:249
Base-class for both propagators and branchers.
Definition: core.hpp:628
Binary propagator.
Definition: pattern.hpp:84
Float value type.
Definition: float.hh:334
Binary bounds consistent equality propagator.
Definition: rel.hh:67
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: eq.hpp:85
Eq(Space &home, Eq< View0, View1 > &p)
Constructor for cloning p.
Definition: eq.hpp:67
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: eq.hpp:79
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
Definition: eq.hpp:50
Less propagator.
Definition: rel.hh:267
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: lq-le.hpp:117
static ExecStatus post(Home home, View x0, View x1)
Post propagator .
Definition: lq-le.hpp:91
Le(Space &home, Le &p)
Constructor for cloning p.
Definition: lq-le.hpp:106
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: lq-le.hpp:111
Less or equal propagator.
Definition: rel.hh:241
Lq(Space &home, Lq &p)
Constructor for cloning p.
Definition: lq-le.hpp:62
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: lq-le.hpp:67
static ExecStatus post(Home home, View x0, View x1)
Post propagator .
Definition: lq-le.hpp:52
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: lq-le.hpp:73
n-ary bounds consistent equality propagator
Definition: rel.hh:94
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: eq.hpp:161
NaryEq(Space &home, NaryEq< View > &p)
Constructor for cloning p.
Definition: eq.hpp:141
static ExecStatus post(Home home, ViewArray< View > &x)
Post bounds consistent propagator .
Definition: eq.hpp:119
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: eq.hpp:146
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: eq.hpp:152
Binary bounds consistent disequality propagator with float value.
Definition: rel.hh:208
NqFloat(Space &home, NqFloat< View > &p)
Constructor for cloning p.
Definition: nq.hpp:104
FloatVal c
Float constant to check.
Definition: rel.hh:213
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: nq.hpp:115
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: nq.hpp:109
static ExecStatus post(Home home, View x0, FloatVal c)
Post bounds consistent propagator .
Definition: nq.hpp:92
Binary bounds consistent disequality propagator.
Definition: rel.hh:180
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: nq.hpp:74
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
Definition: nq.hpp:49
Nq(Space &home, Nq< View0, View1 > &p)
Constructor for cloning p.
Definition: nq.hpp:63
Nq(Space &home, Propagator &p, View0 x0, View1 x1)
Constructor for rewriting p during cloning.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: nq.hpp:68
Reified bounds consistent equality with float propagator.
Definition: rel.hh:151
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: eq.hpp:317
FloatVal c
Float constant to check.
Definition: rel.hh:157
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: eq.hpp:311
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b)
Post bounds consistent propagator .
Definition: eq.hpp:285
ReEqFloat(Space &home, ReEqFloat &p)
Constructor for cloning p.
Definition: eq.hpp:306
Reified binary bounds consistent equality propagator.
Definition: rel.hh:125
ReEq(Space &home, ReEq &p)
Constructor for cloning p.
Definition: eq.hpp:233
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: eq.hpp:238
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: eq.hpp:244
static ExecStatus post(Home home, View x0, View x1, CtrlView b)
Post bounds consistent propagator .
Definition: eq.hpp:211
Reified less with float propagator.
Definition: rel.hh:326
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b)
Post propagator for .
Definition: lq-le.hpp:321
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: lq-le.hpp:366
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: lq-le.hpp:360
ReLeFloat(Space &home, ReLeFloat &p)
Constructor for cloning p.
Definition: lq-le.hpp:355
FloatVal c
Float constant to check.
Definition: rel.hh:332
Reified less or equal with float propagator.
Definition: rel.hh:298
FloatVal c
Float constant to check.
Definition: rel.hh:304
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b)
Post propagator for .
Definition: lq-le.hpp:234
ReLqFloat(Space &home, ReLqFloat &p)
Constructor for cloning p.
Definition: lq-le.hpp:267
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: lq-le.hpp:278
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: lq-le.hpp:272
Reified less or equal propagator.
Definition: rel.hh:354
ReLq(Space &home, ReLq &p)
Constructor for cloning p.
Definition: lq-le.hpp:180
static ExecStatus post(Home home, View x0, View x1, CtrlView b)
Post propagator for .
Definition: lq-le.hpp:141
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: lq-le.hpp:191
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: lq-le.hpp:185
Home class for posting propagators
Definition: core.hpp:856
Reified binary propagator.
Definition: propagator.hpp:87
Reified unary propagator.
Definition: propagator.hpp:54
Mixed binary propagator.
Definition: pattern.hpp:204
n-ary propagator
Definition: pattern.hpp:142
ViewArray< View > x
Array of views.
Definition: pattern.hpp:145
Propagation cost.
Definition: core.hpp:486
Base-class for propagators.
Definition: core.hpp:1064
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1075
Computation spaces.
Definition: core.hpp:1742
Unary propagator.
Definition: pattern.hpp:55
View arrays.
Definition: array.hpp:253
ExecStatus
Definition: core.hpp:472
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89