Generated on Sat Feb 7 2015 02:01:16 for Gecode by doxygen 1.8.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  * Last modified:
18  * $Date: 2012-12-13 16:02:59 +0100 (Thu, 13 Dec 2012) $ by $Author: vbarichard $
19  * $Revision: 13202 $
20  *
21  * This file is part of Gecode, the generic constraint
22  * development environment:
23  * http://www.gecode.org
24  *
25  * Permission is hereby granted, free of charge, to any person obtaining
26  * a copy of this software and associated documentation files (the
27  * "Software"), to deal in the Software without restriction, including
28  * without limitation the rights to use, copy, modify, merge, publish,
29  * distribute, sublicense, and/or sell copies of the Software, and to
30  * permit persons to whom the Software is furnished to do so, subject to
31  * the following conditions:
32  *
33  * The above copyright notice and this permission notice shall be
34  * included in all copies or substantial portions of the Software.
35  *
36  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
38  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
39  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
40  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
41  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
42  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43  *
44  */
45 
46 #ifndef __GECODE_FLOAT_REL_HH__
47 #define __GECODE_FLOAT_REL_HH__
48 
49 #include <gecode/int.hh>
50 #include <gecode/float.hh>
51 
56 namespace Gecode { namespace Float { namespace Rel {
57 
58  /*
59  * Equality propagators
60  *
61  */
62 
69  template<class View0, class View1>
70  class Eq :
71  public MixBinaryPropagator<View0,PC_FLOAT_BND,View1,PC_FLOAT_BND> {
72  protected:
75 
77  Eq(Space& home, bool share, Eq<View0,View1>& p);
78  public:
80  Eq(Home home, View0 x0, View1 x1);
82  Eq(Space& home, bool share, Propagator& p, View0 x0, View1 x1);
84  virtual Actor* copy(Space& home, bool share);
86  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
88  static ExecStatus post(Home home, View0 x0, View1 x1);
89  };
90 
97  template<class View>
98  class NaryEq : public NaryPropagator<View,PC_FLOAT_BND> {
99  protected:
101 
103  NaryEq(Space& home, bool share, NaryEq<View>& p);
105  NaryEq(Home home, ViewArray<View>&);
106  public:
108  virtual Actor* copy(Space& home, bool share);
115  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
117  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
119  static ExecStatus post(Home home, ViewArray<View>& x);
120  };
121 
128  template<class View, class CtrlView, ReifyMode rm>
129  class ReEq : public Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView> {
130  protected:
134 
136  ReEq(Space& home, bool share, ReEq& p);
138  ReEq(Home home, View x0, View x1, CtrlView b);
139  public:
141  virtual Actor* copy(Space& home, bool share);
143  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
145  static ExecStatus post(Home home, View x0, View x1, CtrlView b);
146  };
147 
154  template<class View, class CtrlView, ReifyMode rm>
155  class ReEqFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
156  protected:
159 
163  ReEqFloat(Space& home, bool share, ReEqFloat& p);
165  ReEqFloat(Home home, View x, FloatVal c, CtrlView b);
166  public:
168  virtual Actor* copy(Space& home, bool share);
170  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
172  static ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
173  };
174 
175 
182  template<class View0, class View1>
183  class Nq :
184  public MixBinaryPropagator<View0,PC_FLOAT_VAL,View1,PC_FLOAT_VAL> {
185  protected:
188 
190  Nq(Space& home, bool share, Nq<View0,View1>& p);
191  public:
193  Nq(Home home, View0 x0, View1 x1);
195  Nq(Space& home, bool share, Propagator& p, View0 x0, View1 x1);
197  virtual Actor* copy(Space& home, bool share);
199  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
201  static ExecStatus post(Home home, View0 x0, View1 x1);
202  };
203 
210  template<class View>
211  class NqFloat :
212  public UnaryPropagator<View,PC_FLOAT_VAL> {
213  protected:
215 
219  NqFloat(Space& home, bool share, NqFloat<View>& p);
220  public:
222  NqFloat(Home home, View x, FloatVal c);
224  virtual Actor* copy(Space& home, bool share);
226  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
228  static ExecStatus post(Home home, View x0, FloatVal c);
229  };
230 
231 
232  /*
233  * Order propagators
234  *
235  */
236 
244  template<class View>
245  class Lq : public BinaryPropagator<View,PC_FLOAT_BND> {
246  protected:
249 
251  Lq(Space& home, bool share, Lq& p);
253  Lq(Home home, View x0, View x1);
254  public:
256  virtual Actor* copy(Space& home, bool share);
258  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
260  static ExecStatus post(Home home, View x0, View x1);
261  };
262 
270  template<class View>
271  class Le : public BinaryPropagator<View,PC_FLOAT_BND> {
272  protected:
275 
277  Le(Space& home, bool share, Le& p);
279  Le(Home home, View x0, View x1);
280  public:
282  virtual Actor* copy(Space& home, bool share);
284  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
286  static ExecStatus post(Home home, View x0, View x1);
287  };
288 
289  /*
290  * Reified order propagators
291  *
292  */
293 
301  template<class View, class CtrlView, ReifyMode rm>
302  class ReLqFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
303  protected:
306 
310  ReLqFloat(Space& home, bool share, ReLqFloat& p);
312  ReLqFloat(Home home, View x, FloatVal c, CtrlView b);
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, View x, FloatVal c, CtrlView b);
320  };
321 
329  template<class View, class CtrlView, ReifyMode rm>
330  class ReLeFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
331  protected:
334 
338  ReLeFloat(Space& home, bool share, ReLeFloat& p);
340  ReLeFloat(Home home, View x, FloatVal c, CtrlView b);
341  public:
343  virtual Actor* copy(Space& home, bool share);
345  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
347  static ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
348  };
349 
357  template<class View, class CtrlView, ReifyMode rm>
358  class ReLq : public Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView> {
359  protected:
363 
365  ReLq(Space& home, bool share, ReLq& p);
367  ReLq(Home home, View x0, View x1, CtrlView b);
368  public:
370  virtual Actor* copy(Space& home, bool share);
372  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
374  static ExecStatus post(Home home, View x0, View x1, CtrlView b);
375  };
376 
377 }}}
378 
379 #include <gecode/float/rel/eq.hpp>
380 #include <gecode/float/rel/nq.hpp>
382 
383 #endif
384 
385 
386 // STATISTICS: float-prop
387 
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b)
Post propagator for .
Definition: lq-le.hpp:238
Le(Space &home, bool share, Le &p)
Constructor for cloning p.
Definition: lq-le.hpp:110
Reified binary bounds consistent equality propagator.
Definition: rel.hh:129
Reified less or equal propagator.
Definition: rel.hh:358
NqFloat(Space &home, bool share, NqFloat< View > &p)
Constructor for cloning p.
Definition: nq.hpp:108
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: lq-le.hpp:77
Reified unary propagator.
Definition: propagator.hpp:58
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: lq-le.hpp:195
Unary propagator.
Definition: propagator.hpp:59
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b)
Post propagator for .
Definition: lq-le.hpp:325
Reified binary propagator.
Definition: propagator.hpp:89
Binary bounds consistent equality propagator.
Definition: rel.hh:70
ViewArray< View > x
Array of views.
Definition: propagator.hpp:146
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: nq.hpp:72
Base-class for propagators.
Definition: core.hpp:755
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: eq.hpp:242
static ExecStatus post(Home home, View x0, FloatVal c)
Post bounds consistent propagator .
Definition: nq.hpp:96
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: lq-le.hpp:282
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: eq.hpp:321
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: nq.hpp:78
Computation spaces.
Definition: core.hpp:1362
NaryEq(Space &home, bool share, NaryEq< View > &p)
Constructor for cloning p.
Definition: eq.hpp:145
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b)
Post bounds consistent propagator .
Definition: eq.hpp:289
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: lq-le.hpp:115
Base-class for both propagators and branchers.
Definition: core.hpp:666
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: eq.hpp:248
Reified bounds consistent equality with float propagator.
Definition: rel.hh:155
FloatVal c
Float constant to check.
Definition: rel.hh:336
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
Definition: eq.hpp:54
Binary bounds consistent disequality propagator.
Definition: rel.hh:183
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: lq-le.hpp:121
ReLeFloat(Space &home, bool share, ReLeFloat &p)
Constructor for cloning p.
Definition: lq-le.hpp:359
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
Reified less or equal with float propagator.
Definition: rel.hh:302
FloatVal c
Float constant to check.
Definition: rel.hh:217
Eq(Space &home, bool share, Eq< View0, View1 > &p)
Constructor for cloning p.
Definition: eq.hpp:71
FloatVal c
Float constant to check.
Definition: rel.hh:308
Binary propagator.
Definition: propagator.hpp:87
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:764
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: lq-le.hpp:276
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: eq.hpp:315
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: eq.hpp:150
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: lq-le.hpp:364
static ExecStatus post(Home home, View x0, View x1)
Post propagator .
Definition: lq-le.hpp:95
ReLqFloat(Space &home, bool share, ReLqFloat &p)
Constructor for cloning p.
Definition: lq-le.hpp:271
static ExecStatus post(Home home, View x0, View x1)
Post propagator .
Definition: lq-le.hpp:56
n-ary propagator
Definition: propagator.hpp:143
static ExecStatus post(Home home, ViewArray< View > &x)
Post bounds consistent propagator .
Definition: eq.hpp:123
View arrays.
Definition: array.hpp:234
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: nq.hpp:119
Less or equal propagator.
Definition: rel.hh:245
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: eq.hpp:83
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: lq-le.hpp:71
Float value type.
Definition: float.hh:321
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Mixed binary propagator.
Definition: propagator.hpp:203
Propagation cost.
Definition: core.hpp:537
static ExecStatus post(Home home, View x0, View x1, CtrlView b)
Post propagator for .
Definition: lq-le.hpp:145
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: eq.hpp:165
ExecStatus
Definition: core.hpp:523
static ExecStatus post(Home home, View x0, View x1, CtrlView b)
Post bounds consistent propagator .
Definition: eq.hpp:215
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
Definition: nq.hpp:53
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: eq.hpp:89
ReEqFloat(Space &home, bool share, ReEqFloat &p)
Constructor for cloning p.
Definition: eq.hpp:310
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: lq-le.hpp:189
FloatVal c
Float constant to check.
Definition: rel.hh:161
ReLq(Space &home, bool share, ReLq &p)
Constructor for cloning p.
Definition: lq-le.hpp:184
Gecode toplevel namespace
ReEq(Space &home, bool share, ReEq &p)
Constructor for cloning p.
Definition: eq.hpp:237
n-ary bounds consistent equality propagator
Definition: rel.hh:98
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: eq.hpp:156
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
Home class for posting propagators
Definition: core.hpp:717
Lq(Space &home, bool share, Lq &p)
Constructor for cloning p.
Definition: lq-le.hpp:66
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: lq-le.hpp:370
Less propagator.
Definition: rel.hh:271
Binary bounds consistent disequality propagator with float value.
Definition: rel.hh:211
Reified less with float propagator.
Definition: rel.hh:330
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: nq.hpp:113
Nq(Space &home, bool share, Nq< View0, View1 > &p)
Constructor for cloning p.
Definition: nq.hpp:67