Generated on Thu Apr 5 2018 19:44:19 for Gecode by doxygen 1.8.13
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$ by $Author$
17  * $Revision$
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;
78  SuperOfInter(Home home, View0, View1, View2);
79  public:
81  virtual Actor* copy(Space& home);
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, SubOfUnion& p);
108  SubOfUnion(Home home, View0, View1, View2);
109  public:
111  virtual Actor* copy(Space& home);
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, Intersection& p);
139  Intersection(Home home,View0,View1,View2);
140  public:
142  virtual Actor* copy(Space& home);
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, Union& p);
169  Union(Home home, View0, View1, View2);
170  public:
172  virtual Actor* copy(Space& home);
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>
187  public MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
188  protected:
192  bool shared;
198  IntersectionN(Home home, ViewArray<View0>&, View1);
200  IntersectionN(Home home, ViewArray<View0>&, const IntSet&, View1);
201  public:
203  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
205  virtual Actor* copy(Space& home);
207  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
209  static ExecStatus post(Home home,ViewArray<View0>& y,View1 x);
211  static ExecStatus post(Home home,ViewArray<View0>& y,
212  const IntSet& z,View1 x);
213  };
214 
221  template<class View0, class View1>
222  class UnionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
223  View1,PC_SET_ANY> {
224  protected:
228  bool shared;
232  UnionN(Space& home, UnionN& p);
234  UnionN(Home home,ViewArray<View0>&,View1);
236  UnionN(Home home,ViewArray<View0>&,const IntSet&,View1);
237  public:
239  virtual Actor* copy(Space& home);
241  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
243  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
245  static ExecStatus post(Home home,ViewArray<View0>& y,View1 x);
247  static ExecStatus post(Home home,ViewArray<View0>& y,
248  const IntSet& z,View1 x);
249  };
250 
251 
258  template<class View0, class View1>
259  class PartitionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
260  View1,PC_SET_ANY> {
261  protected:
265  bool shared;
269  PartitionN(Space& home, PartitionN& p);
271  PartitionN(Home home, ViewArray<View0>&, View1);
273  PartitionN(Home home, ViewArray<View0>&, const IntSet&, View1);
274  public:
276  virtual Actor* copy(Space& home);
278  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
280  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
282  static ExecStatus post(Home home,ViewArray<View0>& y,View1 x);
284  static ExecStatus post(Home home,ViewArray<View0>& y,
285  const IntSet& z,View1 x);
286  };
287 
288 }}}
289 
297 
298 #endif
299 
300 // STATISTICS: set-prop
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 nary union
Definition: rel-op.hh:222
bool shared
Whether the any views share a variable implementation.
Definition: rel-op.hh:192
Propagator for ternary union
Definition: rel-op.hh:156
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Shrinking sets of integers.
Definition: var-imp.hpp:247
Mixed (n+1)-ary propagator.
Definition: pattern.hpp:276
SuperOfInter(Space &home, SuperOfInter &p)
Constructor for cloning p.
static ExecStatus post(Home home, View0 x, View1 y, View2 z)
Post propagator .
Computation spaces.
Definition: core.hpp:1668
bool shared
Whether the any views share a variable implementation.
Definition: rel-op.hh:228
Base-class for both propagators and branchers.
Definition: core.hpp:620
Propagator for the subset of union
Definition: rel-op.hh:95
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
Mixed ternary propagator.
Definition: pattern.hpp:241
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1027
Propagator for nary partition
Definition: rel-op.hh:259
LUBndSet intOfDets
Intersection of the determined (which are dropped)
Definition: rel-op.hh:194
Integer sets.
Definition: int.hh:174
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition: set.hh:769
GLBndSet unionOfDets
Union of the determined (which are dropped)
Definition: rel-op.hh:230
GLBndSet unionOfDets
Union of the determined (which are dropped)
Definition: rel-op.hh:267
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
Definition: var-type.hpp:248
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low ternary)
Definition: pattern.hpp:689
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:769
Propagation cost.
Definition: core.hpp:478
ExecStatus
Definition: core.hpp:464
Growing sets of integers.
Definition: var-imp.hpp:209
Propagator for the superset of intersection
Definition: rel-op.hh:65
Post propagator for SetVar x
Definition: set.hh:769
bool shared
Whether the any views share a variable implementation.
Definition: rel-op.hh:265
Gecode toplevel namespace
int ModEventDelta
Modification event deltas.
Definition: core.hpp:91
Home class for posting propagators
Definition: core.hpp:846
Propagator for nary intersection
Definition: rel-op.hh:186
Propagator for ternary intersection
Definition: rel-op.hh:126