Generated on Sat Aug 16 2014 17:18:50 for Gecode by doxygen 1.8.7
element.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  * Copyright:
8  * Guido Tack, 2004
9  * Christian Schulte, 2004
10  *
11  * Last modified:
12  * $Date: 2011-09-06 10:05:16 +0200 (Tue, 06 Sep 2011) $ by $Author: tack $
13  * $Revision: 12391 $
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_SELECT_HH__
41 #define __GECODE_SET_SELECT_HH__
42 
43 #include <gecode/set.hh>
44 
45 #include <gecode/int/element.hh>
46 #include <gecode/set/rel.hh>
47 #include <gecode/set/rel-op.hh>
48 
49 namespace Gecode { namespace Int { namespace Element {
51  template<>
52  class ViewToVarArg<Gecode::Set::SetView> {
53  public:
55  };
57  template<>
59  public:
61  };
62 }}}
63 
64 namespace Gecode { namespace Set { namespace Element {
65 
77  template<class View, class View0, class View1>
79  public:
81  protected:
84  View0 x0;
85  View1 x1;
86 
88  ElementIntersection(Space& home, bool share,ElementIntersection& p);
90  ElementIntersection(Home home,IdxViewArray&,View0,View1,
91  const IntSet& universe);
92  public:
94  virtual Actor* copy(Space& home,bool);
95  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
97  virtual size_t dispose(Space& home);
99  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
105  static ExecStatus post(Home home,IdxViewArray& x, View0 y,
106  View1 z, const IntSet& u);
107  };
108 
115  template<class View, class View0, class View1>
116  class ElementUnion : public Propagator {
117  public:
119  protected:
121  View0 x0;
122  View1 x1;
123 
125  ElementUnion(Space& home, bool share,ElementUnion& p);
127  ElementUnion(Home home,IdxViewArray&,View0,View1);
128  public:
130  virtual Actor* copy(Space& home,bool);
131  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
133  virtual size_t dispose(Space& home);
135  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
141  static ExecStatus post(Home home,IdxViewArray& x,View0 y, View1 z);
142  };
143 
150  template<class SView, class RView>
151  class ElementUnionConst : public Propagator {
152  protected:
153  SView x0;
155  int n_iv;
156  RView x1;
157 
159  ElementUnionConst(Space& home, bool share,ElementUnionConst& p);
161  ElementUnionConst(Home home,SView,const IntSetArgs&,RView);
162  public:
164  virtual Actor* copy(Space& home,bool);
165  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
167  virtual size_t dispose(Space& home);
169  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
175  static ExecStatus post(Home home,SView z,const IntSetArgs& x,RView y);
176  };
177 
184  template<class SView, class RView>
185  class ElementDisjoint : public Propagator {
186  public:
188  protected:
190  RView x1;
191 
193  ElementDisjoint(Space& home, bool share,ElementDisjoint& p);
195  ElementDisjoint(Home home,IdxViewArray&,RView);
196  public:
198  virtual Actor* copy(Space& home,bool);
199  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
201  virtual size_t dispose(Space& home);
203  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
205  static ExecStatus post(Home home,IdxViewArray& x,RView y);
206  };
207 
208 }}}
209 
214 
215 #endif
216 
217 // STATISTICS: set-prop
218 
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: disjoint.hpp:93
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z, const IntSet &u)
Definition: inter.hpp:90
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: union.hpp:72
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: union.hpp:65
static ExecStatus post(Home home, SView z, const IntSetArgs &x, RView y)
Definition: unionConst.hpp:93
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: unionConst.hpp:113
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: unionConst.hpp:72
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: unionConst.hpp:78
Base-class for propagators.
Definition: core.hpp:755
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: union.hpp:105
Propagator for element with disjointness
Definition: element.hh:185
Computation spaces.
Definition: core.hpp:1325
Propagator for element with union of constant sets
Definition: element.hh:151
Base-class for both propagators and branchers.
Definition: core.hpp:666
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: unionConst.hpp:107
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: union.hpp:99
ElementUnionConst(Space &home, bool share, ElementUnionConst &p)
Constructor for cloning p.
Definition: unionConst.hpp:60
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:764
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: disjoint.hpp:99
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z)
Definition: union.hpp:86
Integer sets.
Definition: int.hh:169
Gecode::Int::Element::IdxViewArray< SView > IdxViewArray
Definition: element.hh:187
ElementIntersection(Space &home, bool share, ElementIntersection &p)
Constructor for cloning p.
Definition: inter.hpp:57
Passing integer variables.
Definition: int.hh:634
Singleton set view.
Definition: view.hpp:589
static ExecStatus post(Home home, IdxViewArray &x, RView y)
Post propagator for .
Definition: disjoint.hpp:64
Propagator for element with intersection
Definition: element.hh:78
Set view for set variables
Definition: view.hpp:60
Passing set variables.
Definition: set.hh:490
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Propagator for element with union
Definition: element.hh:116
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: inter.hpp:110
Propagation cost.
Definition: core.hpp:537
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: inter.hpp:68
An array of IndexView pairs.
Definition: element.hh:214
ExecStatus
Definition: core.hpp:523
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: inter.hpp:75
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: disjoint.hpp:84
ElementUnion(Space &home, bool share, ElementUnion &p)
Constructor for cloning p.
Definition: union.hpp:56
Class to get VarArg type for view.
Definition: element.hh:207
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: inter.hpp:104
Home class for posting propagators
Definition: core.hpp:717
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: disjoint.hpp:78
Gecode::Int::Element::IdxViewArray< View > IdxViewArray
Definition: element.hh:118
ElementDisjoint(Space &home, bool share, ElementDisjoint &p)
Constructor for cloning p.
Definition: disjoint.hpp:55
Gecode::Int::Element::IdxViewArray< View > IdxViewArray
Definition: element.hh:80