Generated on Sat Feb 7 2015 02:01:22 for Gecode by doxygen 1.8.9.1
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: 2015-01-18 16:50:03 +0100 (Sun, 18 Jan 2015) $ by $Author: schulte $
13  * $Revision: 14365 $
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/idx-view.hh>
46 #include <gecode/int/element.hh>
47 #include <gecode/set/rel.hh>
48 #include <gecode/set/rel-op.hh>
49 
50 namespace Gecode { namespace Int {
52  template<>
54  public:
56  };
58  template<>
60  public:
62  };
63 }}
64 
65 namespace Gecode { namespace Set { namespace Element {
66 
78  template<class View, class View0, class View1>
80  public:
82  protected:
84  IdxViewArray iv;
85  View0 x0;
86  View1 x1;
87 
89  ElementIntersection(Space& home, bool share,ElementIntersection& p);
91  ElementIntersection(Home home,IdxViewArray&,View0,View1,
92  const IntSet& universe);
93  public:
95  virtual Actor* copy(Space& home,bool);
96  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
98  virtual size_t dispose(Space& home);
100  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
106  static ExecStatus post(Home home,IdxViewArray& x, View0 y,
107  View1 z, const IntSet& u);
108  };
109 
116  template<class View, class View0, class View1>
117  class ElementUnion : public Propagator {
118  public:
120  protected:
121  IdxViewArray iv;
122  View0 x0;
123  View1 x1;
124 
126  ElementUnion(Space& home, bool share,ElementUnion& p);
128  ElementUnion(Home home,IdxViewArray&,View0,View1);
129  public:
131  virtual Actor* copy(Space& home,bool);
132  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
134  virtual size_t dispose(Space& home);
136  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
142  static ExecStatus post(Home home,IdxViewArray& x,View0 y, View1 z);
143  };
144 
151  template<class SView, class RView>
152  class ElementUnionConst : public Propagator {
153  protected:
154  SView x0;
156  int n_iv;
157  RView x1;
158 
160  ElementUnionConst(Space& home, bool share,ElementUnionConst& p);
162  ElementUnionConst(Home home,SView,const IntSetArgs&,RView);
163  public:
165  virtual Actor* copy(Space& home,bool);
166  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
168  virtual size_t dispose(Space& home);
170  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
176  static ExecStatus post(Home home,SView z,const IntSetArgs& x,RView y);
177  };
178 
185  template<class SView, class RView>
186  class ElementDisjoint : public Propagator {
187  public:
189  protected:
190  IdxViewArray iv;
191  RView x1;
192 
194  ElementDisjoint(Space& home, bool share,ElementDisjoint& p);
196  ElementDisjoint(Home home,IdxViewArray&,RView);
197  public:
199  virtual Actor* copy(Space& home,bool);
200  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
202  virtual size_t dispose(Space& home);
204  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
206  static ExecStatus post(Home home,IdxViewArray& x,RView y);
207  };
208 
209 }}}
210 
215 
216 #endif
217 
218 // STATISTICS: set-prop
219 
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
Gecode::Int::IdxViewArray< SView > IdxViewArray
Definition: element.hh:188
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:186
Computation spaces.
Definition: core.hpp:1362
Propagator for element with union of constant sets
Definition: element.hh:152
Base-class for both propagators and branchers.
Definition: core.hpp:666
Gecode::Int::IdxViewArray< View > IdxViewArray
Definition: element.hh:81
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:171
ElementIntersection(Space &home, bool share, ElementIntersection &p)
Constructor for cloning p.
Definition: inter.hpp:57
Passing integer variables.
Definition: int.hh:636
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:79
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:117
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
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
An array of IdxView pairs.
Definition: idx-view.hh:71
Gecode toplevel namespace
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
Class to map VarArg type to view.
Definition: idx-view.hh:64
Gecode::Int::IdxViewArray< View > IdxViewArray
Definition: element.hh:119
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: disjoint.hpp:78
ElementDisjoint(Space &home, bool share, ElementDisjoint &p)
Constructor for cloning p.
Definition: disjoint.hpp:55