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  * Guido Tack <tack@gecode.org>
5  * Christian Schulte <schulte@gecode.org>
6  *
7  * Contributing authors:
8  * Gabor Szokoli <szokoli@gecode.org>
9  *
10  * Copyright:
11  * Guido Tack, 2004
12  * Christian Schulte, 2004
13  * Gabor Szokoli, 2004
14  *
15  * Last modified:
16  * $Date: 2012-10-22 01:13:28 +0200 (Mon, 22 Oct 2012) $ by $Author: tack $
17  * $Revision: 13161 $
18  *
19  * This file is part of Gecode, the generic constraint
20  * development environment:
21  * http://www.gecode.org
22  *
23  * Permission is hereby granted, free of charge, to any person obtaining
24  * a copy of this software and associated documentation files (the
25  * "Software"), to deal in the Software without restriction, including
26  * without limitation the rights to use, copy, modify, merge, publish,
27  * distribute, sublicense, and/or sell copies of the Software, and to
28  * permit persons to whom the Software is furnished to do so, subject to
29  * the following conditions:
30  *
31  * The above copyright notice and this permission notice shall be
32  * included in all copies or substantial portions of the Software.
33  *
34  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
38  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
39  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
40  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41  *
42  */
43 
44 #ifndef __GECODE_SET_REL_HH__
45 #define __GECODE_SET_REL_HH__
46 
47 #include <gecode/set.hh>
48 
49 namespace Gecode { namespace Set { namespace Rel {
50 
63  template<class View0, class View1>
64  class Subset :
65  public MixBinaryPropagator<View0,PC_SET_CGLB,View1,PC_SET_CLUB> {
66  protected:
70  Subset(Space& home, bool share,Subset& p);
72  Subset(Home home,View0, View1);
73  public:
75  virtual Actor* copy(Space& home,bool);
77  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
79  static ExecStatus post(Home home,View0 x,View1 y);
80  };
81 
89  template<class View0, class View1>
90  class NoSubset :
91  public MixBinaryPropagator<View0,PC_SET_CLUB,View1,PC_SET_CGLB> {
92  protected:
96  NoSubset(Space& home, bool share,NoSubset& p);
98  NoSubset(Home home,View0,View1);
99  public:
101  virtual Actor* copy(Space& home,bool);
103  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
105  static ExecStatus post(Home home,View0 x,View1 y);
106  };
107 
114  template<class View0, class View1, ReifyMode rm>
115  class ReSubset : public Propagator {
116  protected:
117  View0 x0;
118  View1 x1;
120 
122  ReSubset(Space& home, bool share,ReSubset&);
124  ReSubset(Home home,View0, View1, Gecode::Int::BoolView);
125  public:
127  virtual Actor* copy(Space& home,bool);
129  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
131  virtual size_t dispose(Space& home);
133  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
135  static ExecStatus post(Home home,View0 x, View1 y,
137  };
138 
145  template<class View0, class View1>
146  class Eq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
147  protected:
151  Eq(Space& home, bool share,Eq& p);
153  Eq(Home home,View0, View1);
154  public:
156  virtual Actor* copy(Space& home,bool);
158  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
160  static ExecStatus post(Home home,View0,View1);
161  };
162 
169  template<class View0, class View1, class CtrlView, ReifyMode rm>
170  class ReEq : public Propagator {
171  protected:
172  View0 x0;
173  View1 x1;
174  CtrlView b;
175 
177  ReEq(Space& home, bool share,ReEq&);
179  ReEq(Home home,View0, View1, CtrlView);
180  public:
182  virtual Actor* copy(Space& home,bool);
184  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
186  virtual size_t dispose(Space& home);
188  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
190  static ExecStatus post(Home home,View0 x, View1 y,
191  CtrlView b);
192  };
193 
202  template<class View0, class View1, bool strict=false>
203  class Lq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
204  protected:
208  Lq(Space& home, bool share,Lq& p);
210  Lq(Home home,View0, View1);
211  public:
213  virtual Actor* copy(Space& home,bool);
215  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
217  static ExecStatus post(Home home,View0,View1);
218  };
219 
228  template<class View0, class View1, ReifyMode rm, bool strict=false>
229  class ReLq : public Propagator {
230  protected:
231  View0 x0;
232  View1 x1;
234 
236  ReLq(Space& home, bool share,ReLq&);
238  ReLq(Home home,View0, View1, Gecode::Int::BoolView);
239  public:
241  virtual Actor* copy(Space& home,bool);
243  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
245  virtual size_t dispose(Space& home);
247  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
249  static ExecStatus post(Home home,View0 x, View1 y,
251  };
252 
260  template<class View0, class View1>
261  class Distinct :
262  public MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL> {
263  protected:
267  Distinct(Space& home, bool share,Distinct& p);
269  Distinct(Home home,View0,View1);
270  public:
272  virtual Actor* copy(Space& home,bool);
274  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
276  static ExecStatus post(Home home,View0,View1);
277  };
278 
289  template<class View0>
290  class DistinctDoit : public UnaryPropagator<View0,PC_SET_ANY> {
291  protected:
296  DistinctDoit(Space& home, bool share,DistinctDoit&);
298  DistinctDoit(Home home, View0, ConstSetView);
299  public:
301  virtual Actor* copy(Space& home, bool);
303  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
305  static ExecStatus post(Home home, View0, ConstSetView);
306  };
307 
308 }}}
309 
310 #include <gecode/set/rel/common.hpp>
311 #include <gecode/set/rel/subset.hpp>
314 #include <gecode/set/rel/eq.hpp>
315 #include <gecode/set/rel/re-eq.hpp>
316 #include <gecode/set/rel/nq.hpp>
317 #include <gecode/set/rel/lq.hpp>
318 #include <gecode/set/rel/re-lq.hpp>
319 
320 #endif
321 
322 // STATISTICS: set-prop
Propagator for negated equality
Definition: rel.hh:261
static ExecStatus post(Home home, View0 x, View1 y, CtrlView b)
Post propagator for .
Definition: re-eq.hpp:82
ReEq(Space &home, bool share, ReEq &)
Constructor for cloning p.
Definition: re-eq.hpp:57
Unary propagator.
Definition: propagator.hpp:59
Propagator for the subset constraint
Definition: rel.hh:64
static ExecStatus post(Home home, View0 x, View1 y, Gecode::Int::BoolView b)
Post propagator for .
Definition: re-lq.hpp:78
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: nq.hpp:114
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: lq.hpp:265
ReLq(Space &home, bool share, ReLq &)
Constructor for cloning p.
Definition: re-lq.hpp:52
Base-class for propagators.
Definition: core.hpp:755
Propagator for set less than or equal
Definition: rel.hh:203
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: eq.hpp:65
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_TERNARY_LO)
Definition: re-eq.hpp:66
Computation spaces.
Definition: core.hpp:1362
Base-class for both propagators and branchers.
Definition: core.hpp:666
NoSubset(Space &home, bool share, NoSubset &p)
Constructor for cloning p.
Definition: nosubset.hpp:57
DistinctDoit(Space &home, bool share, DistinctDoit &)
Constructor for cloning p.
Definition: nq.hpp:152
Distinct(Space &home, bool share, Distinct &p)
Constructor for cloning p.
Definition: nq.hpp:53
static ExecStatus post(Home home, View0, View1)
Post propagator .
Definition: lq.hpp:250
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: re-subset.hpp:87
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition: nosubset.hpp:64
Reified equality propagator
Definition: rel.hh:170
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition: subset.hpp:59
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
Gecode::Int::BoolView b
Definition: rel.hh:119
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: re-lq.hpp:68
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: subset.hpp:72
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: re-eq.hpp:90
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:764
Lq(Space &home, bool share, Lq &p)
Constructor for cloning p.
Definition: lq.hpp:245
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: lq.hpp:259
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_TERNARY_LO)
Definition: re-subset.hpp:63
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: eq.hpp:71
Reified propagator for set less than or equal
Definition: rel.hh:229
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: nosubset.hpp:73
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: re-subset.hpp:93
ReSubset(Space &home, bool share, ReSubset &)
Constructor for cloning p.
Definition: re-subset.hpp:54
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: nq.hpp:108
Constant view.
Definition: view.hpp:190
Reified subset propagator
Definition: rel.hh:115
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
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: re-eq.hpp:72
ExecStatus
Definition: core.hpp:523
static ExecStatus post(Home home, View0, ConstSetView)
Post propagator .
Definition: nq.hpp:101
ConstSetView y
The view that is already assigned.
Definition: rel.hh:294
Gecode::Int::BoolView b
Definition: rel.hh:233
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: re-eq.hpp:96
Propagator for set equality
Definition: rel.hh:146
Propagator for negated equality
Definition: rel.hh:290
Subset(Space &home, bool share, Subset &p)
Constructor for cloning p.
Definition: subset.hpp:54
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: nq.hpp:78
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: re-lq.hpp:92
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: nq.hpp:84
Propagator for the negated subset constraint
Definition: rel.hh:90
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: nosubset.hpp:79
Gecode toplevel namespace
static ExecStatus post(Home home, View0, View1)
Post propagator .
Definition: nq.hpp:59
Eq(Space &home, bool share, Eq &p)
Constructor for cloning p.
Definition: eq.hpp:53
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_TERNARY_LO)
Definition: re-lq.hpp:61
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
Home class for posting propagators
Definition: core.hpp:717
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: re-lq.hpp:86
static ExecStatus post(Home home, View0 x, View1 y, Gecode::Int::BoolView b)
Post propagator for .
Definition: re-subset.hpp:79
static ExecStatus post(Home home, View0, View1)
Post propagator .
Definition: eq.hpp:58
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: subset.hpp:66
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: re-subset.hpp:69
Boolean view for Boolean variables.
Definition: view.hpp:1315