Generated on Tue Jan 28 2020 00:00:00 for Gecode by doxygen 1.8.17
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: 2017-03-10 10:15:56 +0100 (Fri, 10 Mar 2017) $ by $Author: schulte $
17  * $Revision: 15566 $
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 x0, View1 x1);
73  public:
75  virtual Actor* copy(Space& home, bool share);
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 x0, View1 x1);
99  public:
101  virtual Actor* copy(Space& home, bool share);
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, class CtrlView, ReifyMode rm>
115  class ReSubset : public Propagator {
116  protected:
118  View0 x0;
120  View1 x1;
122  CtrlView b;
124  ReSubset(Space& home, bool share, ReSubset& p);
126  ReSubset(Home home, View0 x0, View1 x1, CtrlView b);
127  public:
129  virtual Actor* copy(Space& home, bool share);
131  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
133  virtual void reschedule(Space& home);
135  virtual size_t dispose(Space& home);
137  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
139  static ExecStatus post(Home home, View0 x, View1 y,
140  CtrlView b);
141  };
142 
149  template<class View0, class View1>
150  class Eq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
151  protected:
155  Eq(Space& home, bool share, Eq& p);
157  Eq(Home home, View0 x0, View1 x1);
158  public:
160  virtual Actor* copy(Space& home, bool share);
162  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
164  static ExecStatus post(Home home, View0 x, View1 y);
165  };
166 
173  template<class View0, class View1, class CtrlView, ReifyMode rm>
174  class ReEq : public Propagator {
175  protected:
176  View0 x0;
177  View1 x1;
178  CtrlView b;
180  ReEq(Space& home, bool share,ReEq&);
182  ReEq(Home home, View0 x0, View1 x1, CtrlView b);
183  public:
185  virtual Actor* copy(Space& home,bool);
187  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
189  virtual void reschedule(Space& home);
191  virtual size_t dispose(Space& home);
193  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
195  static ExecStatus post(Home home, View0 x, View1 y,
196  CtrlView b);
197  };
198 
207  template<class View0, class View1, bool strict=false>
208  class Lq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
209  protected:
213  Lq(Space& home, bool share, Lq& p);
215  Lq(Home home, View0 x0, View1 x1);
216  public:
218  virtual Actor* copy(Space& home,bool);
220  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
222  static ExecStatus post(Home home, View0 x, View1 y);
223  };
224 
233  template<class View0, class View1, ReifyMode rm, bool strict=false>
234  class ReLq : public Propagator {
235  protected:
236  View0 x0;
237  View1 x1;
240  ReLq(Space& home, bool share, ReLq& p);
242  ReLq(Home home, View0 x0, View1 x1, Gecode::Int::BoolView b);
243  public:
245  virtual Actor* copy(Space& home,bool);
247  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
249  virtual void reschedule(Space& home);
251  virtual size_t dispose(Space& home);
253  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
255  static ExecStatus post(Home home, View0 x, View1 y,
257  };
258 
266  template<class View0, class View1>
267  class Distinct :
268  public MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL> {
269  protected:
273  Distinct(Space& home, bool share, Distinct& p);
275  Distinct(Home home, View0 x0, View1 x1);
276  public:
278  virtual Actor* copy(Space& home,bool);
280  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
282  static ExecStatus post(Home home, View0 x, View1 y);
283  };
284 
295  template<class View0>
296  class DistinctDoit : public UnaryPropagator<View0,PC_SET_ANY> {
297  protected:
302  DistinctDoit(Space& home, bool share, DistinctDoit&);
304  DistinctDoit(Home home, View0 x0, ConstSetView y);
305  public:
307  virtual Actor* copy(Space& home, bool share);
309  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
311  static ExecStatus post(Home home, View0 x, ConstSetView y);
312  };
313 
314 }}}
315 
316 #include <gecode/set/rel/common.hpp>
317 #include <gecode/set/rel/subset.hpp>
320 #include <gecode/set/rel/eq.hpp>
321 #include <gecode/set/rel/re-eq.hpp>
322 #include <gecode/set/rel/nq.hpp>
323 #include <gecode/set/rel/lq.hpp>
324 #include <gecode/set/rel/re-lq.hpp>
325 
326 #endif
327 
328 // STATISTICS: set-prop
Post propagator for SetVar x
Definition: set.hh:784
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:784
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: nosubset.hpp:79
Constant view.
Definition: view.hpp:190
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: re-eq.hpp:104
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: eq.hpp:65
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: lq.hpp:344
View1 x1
Definition: rel.hh:177
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: re-subset.hpp:103
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: re-eq.hpp:80
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition: lq.hpp:329
View0 x0
View of type View0.
Definition: propagator.hpp:216
Propagator for set equality
Definition: rel.hh:150
CtrlView b
Definition: rel.hh:178
Computation spaces.
Definition: core.hpp:1748
Base-class for both propagators and branchers.
Definition: core.hpp:696
Propagator for the subset constraint
Definition: rel.hh:64
virtual void reschedule(Space &home)
Schedule function.
Definition: re-subset.hpp:71
Gecode::Int::BoolView b
Definition: rel.hh:238
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: subset.hpp:72
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition: nosubset.hpp:64
Distinct(Space &home, bool share, Distinct &p)
Constructor for cloning p.
Definition: nq.hpp:53
View1 x1
View of type View1.
Definition: propagator.hpp:218
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: re-lq.hpp:100
Boolean view for Boolean variables.
Definition: view.hpp:1315
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: re-subset.hpp:79
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: re-lq.hpp:94
Gecode toplevel namespace
Base-class for propagators.
Definition: core.hpp:1092
Mixed binary propagator.
Definition: propagator.hpp:213
NoSubset(Space &home, bool share, NoSubset &p)
Constructor for cloning p.
Definition: nosubset.hpp:57
ReEq(Space &home, bool share, ReEq &)
Constructor for cloning p.
Definition: re-eq.hpp:57
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: subset.hpp:66
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: nq.hpp:114
DistinctDoit(Space &home, bool share, DistinctDoit &)
Constructor for cloning p.
Definition: nq.hpp:152
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition: subset.hpp:59
Home class for posting propagators
Definition: core.hpp:922
virtual void reschedule(Space &home)
Schedule function.
Definition: re-eq.hpp:72
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: eq.hpp:71
ReLq(Space &home, bool share, ReLq &p)
Constructor for cloning p.
Definition: re-lq.hpp:52
static ExecStatus post(Home home, View0 x, View1 y, Gecode::Int::BoolView b)
Post propagator for .
Definition: re-lq.hpp:86
ConstSetView y
The view that is already assigned.
Definition: rel.hh:300
Reified equality propagator
Definition: rel.hh:174
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1103
View0 x0
Definition: rel.hh:236
View1 x1
Variable view.
Definition: rel.hh:120
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as ternary low)
Definition: re-subset.hpp:64
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: re-subset.hpp:97
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: nq.hpp:108
CtrlView b
Boolean control view.
Definition: rel.hh:122
View1 x1
Definition: rel.hh:237
Subset(Space &home, bool share, Subset &p)
Constructor for cloning p.
Definition: subset.hpp:54
Eq(Space &home, bool share, Eq &p)
Constructor for cloning p.
Definition: eq.hpp:53
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: nosubset.hpp:73
View0 x0
Definition: rel.hh:176
Propagation cost.
Definition: core.hpp:554
ReSubset(Space &home, bool share, ReSubset &p)
Constructor for cloning p.
Definition: re-subset.hpp:54
Propagator for negated equality
Definition: rel.hh:267
static ExecStatus post(Home home, View0 x, View1 y, CtrlView b)
Post propagator for .
Definition: re-eq.hpp:90
View0 x0
Variable view.
Definition: rel.hh:118
Propagator for negated equality
Definition: rel.hh:296
Reified propagator for set less than or equal
Definition: rel.hh:234
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: lq.hpp:338
virtual void reschedule(Space &home)
Schedule function.
Definition: re-lq.hpp:68
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition: nq.hpp:59
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: nq.hpp:78
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: re-eq.hpp:98
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: nq.hpp:84
Unary propagator.
Definition: propagator.hpp:59
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: re-lq.hpp:76
Lq(Space &home, bool share, Lq &p)
Constructor for cloning p.
Definition: lq.hpp:324
Propagator for set less than or equal
Definition: rel.hh:208
Propagator for the negated subset constraint
Definition: rel.hh:90
Reified subset propagator
Definition: rel.hh:115
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_TERNARY_LO)
Definition: re-eq.hpp:66
static ExecStatus post(Home home, View0 x, View1 y, CtrlView b)
Post propagator for .
Definition: re-subset.hpp:89
int ModEventDelta
Modification event deltas.
Definition: core.hpp:169
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition: eq.hpp:58
View0 x0
Single view.
Definition: propagator.hpp:62
static ExecStatus post(Home home, View0 x, ConstSetView y)
Post propagator .
Definition: nq.hpp:101
ExecStatus
Definition: core.hpp:540
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_TERNARY_LO)
Definition: re-lq.hpp:61