Generated on Sat Feb 7 2015 02:01:30 for Gecode by doxygen 1.8.9.1
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  * Last modified:
16  * $Date: 2009-10-12 17:36:53 +0200 (Mon, 12 Oct 2009) $ by $Author: schulte $
17  * $Revision: 9878 $
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_RELOP_HH__
45 #define __GECODE_SET_RELOP_HH__
46 
47 #include <gecode/set.hh>
48 #include <gecode/set/rel.hh>
49 
50 namespace Gecode { namespace Set { namespace RelOp {
51 
64  template<class View0, class View1, class View2>
65  class SuperOfInter :
66  public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
67  View2,PC_SET_CLUB> {
68  protected:
69  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
70  View2,PC_SET_CLUB>::x0;
71  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
72  View2,PC_SET_CLUB>::x1;
73  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
74  View2,PC_SET_CLUB>::x2;
76  SuperOfInter(Space& home, bool share,SuperOfInter& p);
78  SuperOfInter(Home home,View0, View1, View2);
79  public:
81  virtual Actor* copy(Space& home,bool);
83  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
85  static ExecStatus post(Home home, View0 x, View1 y, View2 z);
86  };
87 
94  template<class View0, class View1, class View2>
95  class SubOfUnion :
96  public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
97  View2,PC_SET_ANY> {
98  protected:
99  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
100  View2,PC_SET_ANY>::x0;
101  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
102  View2,PC_SET_ANY>::x1;
103  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
104  View2,PC_SET_ANY>::x2;
106  SubOfUnion(Space& home, bool share,SubOfUnion& p);
108  SubOfUnion(Home home,View0, View1, View2);
109  public:
111  virtual Actor* copy(Space& home,bool);
113  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
115  static ExecStatus post(Home home,View0 x,View1 y,View2 z);
116  };
117 
118 
125  template<class View0, class View1, class View2>
127  public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
128  View2,PC_SET_ANY> {
129  protected:
130  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
131  View2,PC_SET_ANY>::x0;
132  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
133  View2,PC_SET_ANY>::x1;
134  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
135  View2,PC_SET_ANY>::x2;
137  Intersection(Space& home, bool share,Intersection& p);
139  Intersection(Home home,View0,View1,View2);
140  public:
142  virtual Actor* copy(Space& home,bool);
144  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
146  static ExecStatus post(Home home,View0 x,View1 y,View2 z);
147  };
148 
155  template<class View0, class View1, class View2>
156  class Union:
157  public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
158  View2,PC_SET_ANY> {
159  protected:
160  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
161  View2,PC_SET_ANY>::x0;
162  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
163  View2,PC_SET_ANY>::x1;
164  using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
165  View2,PC_SET_ANY>::x2;
167  Union(Space& home, bool share,Union& p);
169  Union(Home home,View0,View1,View2);
170  public:
172  virtual Actor* copy(Space& home,bool);
174  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
176  static ExecStatus post(Home home,View0 x,View1 y,View2 z);
177  };
178 
185  template<class View0, class View1>
186  class IntersectionN :
187  public MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
188  protected:
192  bool shared;
196  IntersectionN(Space& home, bool share,IntersectionN& p);
198  IntersectionN(Home home,ViewArray<View0>&, View1);
200  IntersectionN(Home home,ViewArray<View0>&, const IntSet&, View1);
201  public:
202  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
204  virtual Actor* copy(Space& home,bool);
206  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
208  static ExecStatus post(Home home,ViewArray<View0>& y,View1 x);
210  static ExecStatus post(Home home,ViewArray<View0>& y,
211  const IntSet& z,View1 x);
212  };
213 
220  template<class View0, class View1>
221  class UnionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
222  View1,PC_SET_ANY> {
223  protected:
227  bool shared;
231  UnionN(Space& home, bool share,UnionN& p);
233  UnionN(Home home,ViewArray<View0>&,View1);
235  UnionN(Home home,ViewArray<View0>&,const IntSet&,View1);
236  public:
238  virtual Actor* copy(Space& home, bool);
240  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
241  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
243  static ExecStatus post(Home home,ViewArray<View0>& y,View1 x);
245  static ExecStatus post(Home home,ViewArray<View0>& y,
246  const IntSet& z,View1 x);
247  };
248 
249 
256  template<class View0, class View1>
257  class PartitionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
258  View1,PC_SET_ANY> {
259  protected:
263  bool shared;
267  PartitionN(Space& home, bool share,PartitionN& p);
269  PartitionN(Home home,ViewArray<View0>&, View1);
271  PartitionN(Home home,ViewArray<View0>&, const IntSet&, View1);
272  public:
274  virtual Actor* copy(Space& home,bool);
276  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
277  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
279  static ExecStatus post(Home home,ViewArray<View0>& y,View1 x);
281  static ExecStatus post(Home home,ViewArray<View0>& y,
282  const IntSet& z,View1 x);
283  };
284 
285 }}}
286 
294 
295 #endif
296 
297 // STATISTICS: set-prop
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: inter.hpp:60
const Gecode::PropCond PC_SET_CLUB
Propagate when the cardinality or the least upper bound of a view changes.
Definition: var-type.hpp:227
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
Definition: partition.hpp:105
IntersectionN(Space &home, bool share, IntersectionN &p)
Constructor for cloning p.
Definition: inter.hpp:229
Propagator for nary union
Definition: rel-op.hh:221
bool shared
Whether the any views share a variable implementation.
Definition: rel-op.hh:192
static ExecStatus post(Home home, View0 x, View1 y, View2 z)
Post propagator .
Definition: subofunion.hpp:159
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: union.hpp:79
static ExecStatus post(Home home, ViewArray< View0 > &y, View1 x)
Post propagator .
Definition: inter.hpp:239
Propagator for ternary union
Definition: rel-op.hh:156
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Intersection(Space &home, bool share, Intersection &p)
Constructor for cloning p.
Definition: inter.hpp:197
Shrinking sets of integers.
Definition: var-imp.hpp:247
Mixed (n+1)-ary propagator.
Definition: propagator.hpp:268
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: inter.hpp:265
static ExecStatus post(Home home, View0 x, View1 y, View2 z)
Post propagator .
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: union.hpp:270
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: partition.hpp:78
Union(Space &home, bool share, Union &p)
Constructor for cloning p.
Definition: union.hpp:59
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: subofunion.hpp:54
Computation spaces.
Definition: core.hpp:1362
bool shared
Whether the any views share a variable implementation.
Definition: rel-op.hh:227
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: union.hpp:233
PartitionN(Space &home, bool share, PartitionN &p)
Constructor for cloning p.
Definition: partition.hpp:70
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: partition.hpp:111
Base-class for both propagators and branchers.
Definition: core.hpp:666
Propagator for the subset of union
Definition: rel-op.hh:95
SuperOfInter(Space &home, bool share, SuperOfInter &p)
Constructor for cloning p.
static ExecStatus post(Home home, View0 x, View1 y, View2 z)
Post propagator .
Definition: inter.hpp:52
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: inter.hpp:66
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
static ExecStatus post(Home home, View0 x, View1 y, View2 z)
Post propagator .
Definition: union.hpp:65
Mixed ternary propagator.
Definition: propagator.hpp:235
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
Definition: inter.hpp:271
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:764
Propagator for nary partition
Definition: rel-op.hh:257
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
Definition: union.hpp:264
LUBndSet intOfDets
Intersection of the determined (which are dropped)
Definition: rel-op.hh:194
Integer sets.
Definition: int.hh:171
SubOfUnion(Space &home, bool share, SubOfUnion &p)
Constructor for cloning p.
Definition: subofunion.hpp:153
GLBndSet unionOfDets
Union of the determined (which are dropped)
Definition: rel-op.hh:229
GLBndSet unionOfDets
Union of the determined (which are dropped)
Definition: rel-op.hh:265
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
Definition: var-type.hpp:248
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: union.hpp:73
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Propagation cost.
Definition: core.hpp:537
ExecStatus
Definition: core.hpp:523
Growing sets of integers.
Definition: var-imp.hpp:209
Propagator for the superset of intersection
Definition: rel-op.hh:65
bool shared
Whether the any views share a variable implementation.
Definition: rel-op.hh:263
Gecode toplevel namespace
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: subofunion.hpp:48
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
Home class for posting propagators
Definition: core.hpp:717
UnionN(Space &home, bool share, UnionN &p)
Constructor for cloning p.
Definition: union.hpp:225
static ExecStatus post(Home home, ViewArray< View0 > &y, View1 x)
Post propagator .
Definition: union.hpp:239
Propagator for nary intersection
Definition: rel-op.hh:186
static ExecStatus post(Home home, ViewArray< View0 > &y, View1 x)
Post propagator .
Definition: partition.hpp:83
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: inter.hpp:277
Propagator for ternary intersection
Definition: rel-op.hh:126