Generated on Sun Aug 9 2020 05:34:08 for Gecode by doxygen 1.8.18
rel-op.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  * This file is part of Gecode, the generic constraint
16  * development environment:
17  * http://www.gecode.org
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining
20  * a copy of this software and associated documentation files (the
21  * "Software"), to deal in the Software without restriction, including
22  * without limitation the rights to use, copy, modify, merge, publish,
23  * distribute, sublicense, and/or sell copies of the Software, and to
24  * permit persons to whom the Software is furnished to do so, subject to
25  * the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  *
38  */
39 
40 #ifndef __GECODE_SET_RELOP_HH__
41 #define __GECODE_SET_RELOP_HH__
42 
43 #include <gecode/set.hh>
44 #include <gecode/set/rel.hh>
45 
46 namespace Gecode { namespace Set { namespace RelOp {
47 
60  template<class View0, class View1, class View2>
61  class SuperOfInter :
62  public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
63  View2,PC_SET_CLUB> {
64  protected:
65  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
66  View2,PC_SET_CLUB>::x0;
67  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
68  View2,PC_SET_CLUB>::x1;
69  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
70  View2,PC_SET_CLUB>::x2;
74  SuperOfInter(Home home, View0, View1, View2);
75  public:
77  virtual Actor* copy(Space& home);
79  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
81  static ExecStatus post(Home home, View0 x, View1 y, View2 z);
82  };
83 
90  template<class View0, class View1, class View2>
91  class SubOfUnion :
92  public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
93  View2,PC_SET_ANY> {
94  protected:
95  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
96  View2,PC_SET_ANY>::x0;
97  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
98  View2,PC_SET_ANY>::x1;
99  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
100  View2,PC_SET_ANY>::x2;
102  SubOfUnion(Space& home, SubOfUnion& p);
104  SubOfUnion(Home home, View0, View1, View2);
105  public:
107  virtual Actor* copy(Space& home);
109  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
111  static ExecStatus post(Home home,View0 x,View1 y,View2 z);
112  };
113 
114 
121  template<class View0, class View1, class View2>
123  public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
124  View2,PC_SET_ANY> {
125  protected:
126  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
127  View2,PC_SET_ANY>::x0;
128  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
129  View2,PC_SET_ANY>::x1;
130  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
131  View2,PC_SET_ANY>::x2;
133  Intersection(Space& home, Intersection& p);
135  Intersection(Home home,View0,View1,View2);
136  public:
138  virtual Actor* copy(Space& home);
140  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
142  static ExecStatus post(Home home,View0 x,View1 y,View2 z);
143  };
144 
151  template<class View0, class View1, class View2>
152  class Union:
153  public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
154  View2,PC_SET_ANY> {
155  protected:
156  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
157  View2,PC_SET_ANY>::x0;
158  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
159  View2,PC_SET_ANY>::x1;
160  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
161  View2,PC_SET_ANY>::x2;
163  Union(Space& home, Union& p);
165  Union(Home home, View0, View1, View2);
166  public:
168  virtual Actor* copy(Space& home);
170  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
172  static ExecStatus post(Home home,View0 x,View1 y,View2 z);
173  };
174 
181  template<class View0, class View1>
183  public MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
184  protected:
188  bool shared;
194  IntersectionN(Home home, ViewArray<View0>&, View1);
196  IntersectionN(Home home, ViewArray<View0>&, const IntSet&, View1);
197  public:
199  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
201  virtual Actor* copy(Space& home);
203  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
205  static ExecStatus post(Home home,ViewArray<View0>& y,View1 x);
207  static ExecStatus post(Home home,ViewArray<View0>& y,
208  const IntSet& z,View1 x);
209  };
210 
217  template<class View0, class View1>
218  class UnionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
219  View1,PC_SET_ANY> {
220  protected:
224  bool shared;
228  UnionN(Space& home, UnionN& p);
230  UnionN(Home home,ViewArray<View0>&,View1);
232  UnionN(Home home,ViewArray<View0>&,const IntSet&,View1);
233  public:
235  virtual Actor* copy(Space& home);
237  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
239  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
241  static ExecStatus post(Home home,ViewArray<View0>& y,View1 x);
243  static ExecStatus post(Home home,ViewArray<View0>& y,
244  const IntSet& z,View1 x);
245  };
246 
247 
254  template<class View0, class View1>
255  class PartitionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
256  View1,PC_SET_ANY> {
257  protected:
261  bool shared;
265  PartitionN(Space& home, PartitionN& p);
267  PartitionN(Home home, ViewArray<View0>&, View1);
269  PartitionN(Home home, ViewArray<View0>&, const IntSet&, View1);
270  public:
272  virtual Actor* copy(Space& home);
274  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
276  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
278  static ExecStatus post(Home home,ViewArray<View0>& y,View1 x);
280  static ExecStatus post(Home home,ViewArray<View0>& y,
281  const IntSet& z,View1 x);
282  };
283 
284 }}}
285 
293 
294 #endif
295 
296 // STATISTICS: set-prop
View1 y
Single view.
Definition: pattern.hpp:277
Propagator for nary intersection
Definition: rel-op.hh:183
Post propagator for SetVar x
Definition: set.hh:767
Propagator for ternary union
Definition: rel-op.hh:154
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:767
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: union.hpp:266
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: subofunion.hpp:44
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: inter.hpp:267
View1 x1
View of type View1.
Definition: pattern.hpp:242
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: union.hpp:229
static ExecStatus post(Home home, View0 x, View1 y, View2 z)
Post propagator .
Definition: inter.hpp:48
ViewArray< View0 > x
Array of views.
Definition: pattern.hpp:275
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition: set.hh:767
Propagator for the subset of union
Definition: rel-op.hh:93
View0 x0
View of type View0.
Definition: pattern.hpp:240
Computation spaces.
Definition: core.hpp:1742
Base-class for both propagators and branchers.
Definition: core.hpp:628
Union(Space &home, Union &p)
Constructor for cloning p.
Definition: union.hpp:55
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Mixed (n+1)-ary propagator.
Definition: pattern.hpp:272
SubOfUnion(Space &home, SubOfUnion &p)
Constructor for cloning p.
Definition: subofunion.hpp:149
bool shared
Whether the any views share a variable implementation.
Definition: rel-op.hh:261
Propagator for nary partition
Definition: rel-op.hh:256
Mixed ternary propagator.
Definition: pattern.hpp:237
Gecode toplevel namespace
static ExecStatus post(Home home, ViewArray< View0 > &y, View1 x)
Post propagator .
Definition: partition.hpp:79
Integer sets.
Definition: int.hh:174
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: union.hpp:75
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: partition.hpp:107
const Gecode::PropCond PC_SET_CLUB
Propagate when the cardinality or the least upper bound of a view changes.
Definition: var-type.hpp:227
Propagator for ternary intersection
Definition: rel-op.hh:124
static ExecStatus post(Home home, View0 x, View1 y, View2 z)
Post propagator .
Definition: union.hpp:61
Home class for posting propagators
Definition: core.hpp:856
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: subofunion.hpp:50
Propagator for nary union
Definition: rel-op.hh:219
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: inter.hpp:273
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: union.hpp:69
GLBndSet unionOfDets
Union of the determined (which are dropped)
Definition: rel-op.hh:263
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1075
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: partition.hpp:74
static ExecStatus post(Home home, View0 x, View1 y, View2 z)
Post propagator .
Definition: subofunion.hpp:155
bool shared
Whether the any views share a variable implementation.
Definition: rel-op.hh:224
LUBndSet intOfDets
Intersection of the determined (which are dropped)
Definition: rel-op.hh:190
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: inter.hpp:56
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: inter.hpp:261
GLBndSet unionOfDets
Union of the determined (which are dropped)
Definition: rel-op.hh:226
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: inter.hpp:62
View2 x2
View of type View2.
Definition: pattern.hpp:244
Propagation cost.
Definition: core.hpp:486
Intersection(Space &home, Intersection &p)
Constructor for cloning p.
Definition: inter.hpp:193
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: union.hpp:260
static ExecStatus post(Home home, ViewArray< View0 > &y, View1 x)
Post propagator .
Definition: union.hpp:235
static ExecStatus post(Home home, View0 x, View1 y, View2 z)
Post propagator .
Growing sets of integers.
Definition: var-imp.hpp:205
bool shared
Whether the any views share a variable implementation.
Definition: rel-op.hh:188
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
Definition: var-type.hpp:248
Propagator for the superset of intersection
Definition: rel-op.hh:63
SuperOfInter(Space &home, SuperOfInter &p)
Constructor for cloning p.
static ExecStatus post(Home home, ViewArray< View0 > &y, View1 x)
Post propagator .
Definition: inter.hpp:235
Shrinking sets of integers.
Definition: var-imp.hpp:243
IntersectionN(Space &home, IntersectionN &p)
Constructor for cloning p.
Definition: inter.hpp:225
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
UnionN(Space &home, UnionN &p)
Constructor for cloning p.
Definition: union.hpp:221
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
PartitionN(Space &home, PartitionN &p)
Constructor for cloning p.
Definition: partition.hpp:66
ExecStatus
Definition: core.hpp:472
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: partition.hpp:101