Generated on Tue Jan 28 2020 00:00:00 for Gecode by doxygen 1.8.17
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: 2016-06-29 17:28:17 +0200 (Wed, 29 Jun 2016) $ by $Author: schulte $
13  * $Revision: 15137 $
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 {
51 
53  template<>
55  public:
57  };
58 
60  template<>
62  public:
64  };
65 
66 }}
67 
68 namespace Gecode { namespace Set { namespace Element {
69 
81  template<class View, class View0, class View1>
83  public:
85  protected:
88  View0 x0;
89  View1 x1;
90 
92  ElementIntersection(Space& home, bool share,ElementIntersection& p);
94  ElementIntersection(Home home,IdxViewArray&,View0,View1,
95  const IntSet& universe);
96  public:
98  virtual Actor* copy(Space& home,bool);
100  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
102  virtual void reschedule(Space& home);
104  virtual size_t dispose(Space& home);
106  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
112  static ExecStatus post(Home home,IdxViewArray& x, View0 y,
113  View1 z, const IntSet& u);
114  };
115 
122  template<class View, class View0, class View1>
123  class ElementUnion : public Propagator {
124  public:
126  protected:
128  View0 x0;
129  View1 x1;
130 
132  ElementUnion(Space& home, bool share,ElementUnion& p);
134  ElementUnion(Home home,IdxViewArray&,View0,View1);
135  public:
137  virtual Actor* copy(Space& home,bool);
139  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
141  virtual void reschedule(Space& home);
143  virtual size_t dispose(Space& home);
145  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
151  static ExecStatus post(Home home,IdxViewArray& x,View0 y, View1 z);
152  };
153 
160  template<class SView, class RView>
161  class ElementUnionConst : public Propagator {
162  protected:
163  SView x0;
165  int n_iv;
166  RView x1;
167 
169  ElementUnionConst(Space& home, bool share,ElementUnionConst& p);
171  ElementUnionConst(Home home,SView,const IntSetArgs&,RView);
172  public:
174  virtual Actor* copy(Space& home,bool);
176  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
178  virtual void reschedule(Space& home);
180  virtual size_t dispose(Space& home);
182  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
188  static ExecStatus post(Home home,SView z,const IntSetArgs& x,RView y);
189  };
190 
197  template<class SView, class RView>
198  class ElementDisjoint : public Propagator {
199  public:
201  protected:
203  RView x1;
204 
206  ElementDisjoint(Space& home, bool share,ElementDisjoint& p);
208  ElementDisjoint(Home home,IdxViewArray&,RView);
209  public:
211  virtual Actor* copy(Space& home,bool);
213  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
215  virtual void reschedule(Space& home);
217  virtual size_t dispose(Space& home);
219  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
221  static ExecStatus post(Home home,IdxViewArray& x,RView y);
222  };
223 
224 }}}
225 
230 
231 #endif
232 
233 // STATISTICS: set-prop
234 
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: union.hpp:107
Propagator for element with disjointness
Definition: element.hh:198
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: union.hpp:65
Post propagator for SetVar x
Definition: set.hh:784
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:784
RView x1
Definition: element.hh:166
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: unionConst.hpp:85
Propagator for element with intersection
Definition: element.hh:82
An array of IdxView pairs.
Definition: idx-view.hh:71
IdxViewArray iv
Definition: element.hh:87
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: disjoint.hpp:100
Passing integer variables.
Definition: int.hh:639
Singleton set view.
Definition: view.hpp:589
Gecode::Int::IdxViewArray< SView > IdxViewArray
Definition: element.hh:200
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: inter.hpp:68
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition: set.hh:784
Passing set variables.
Definition: set.hh:492
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z, const IntSet &u)
Definition: inter.hpp:98
IntSet * iv
Definition: element.hh:164
Class to map VarArg type to view.
Definition: idx-view.hh:64
Computation spaces.
Definition: core.hpp:1748
Gecode::SetVarArgs argtype
Definition: element.hh:56
Base-class for both propagators and branchers.
Definition: core.hpp:696
virtual void reschedule(Space &home)
Schedule function.
Definition: disjoint.hpp:84
ElementUnion(Space &home, bool share, ElementUnion &p)
Constructor for cloning p.
Definition: union.hpp:56
virtual void reschedule(Space &home)
Schedule function.
Definition: inter.hpp:75
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: unionConst.hpp:114
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: unionConst.hpp:120
Gecode::Int::IdxViewArray< View > IdxViewArray
Definition: element.hh:125
Gecode::IntVarArgs argtype
Definition: element.hh:63
ElementUnionConst(Space &home, bool share, ElementUnionConst &p)
Constructor for cloning p.
Definition: unionConst.hpp:60
IntSet universe
Definition: element.hh:86
Gecode toplevel namespace
Base-class for propagators.
Definition: core.hpp:1092
Integer sets.
Definition: int.hh:174
Gecode::Int::IdxViewArray< View > IdxViewArray
Definition: element.hh:84
View1 x1
Definition: element.hh:129
ElementDisjoint(Space &home, bool share, ElementDisjoint &p)
Constructor for cloning p.
Definition: disjoint.hpp:55
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: unionConst.hpp:72
Home class for posting propagators
Definition: core.hpp:922
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: union.hpp:80
int n_iv
Definition: element.hh:165
View0 x0
Definition: element.hh:128
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1103
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: inter.hpp:118
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: inter.hpp:83
virtual void reschedule(Space &home)
Schedule function.
Definition: unionConst.hpp:78
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: disjoint.hpp:91
Propagation cost.
Definition: core.hpp:554
virtual void reschedule(Space &home)
Schedule function.
Definition: union.hpp:72
Set view for set variables
Definition: view.hpp:60
ElementIntersection(Space &home, bool share, ElementIntersection &p)
Constructor for cloning p.
Definition: inter.hpp:57
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: disjoint.hpp:78
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: union.hpp:113
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: disjoint.hpp:106
SView x0
Definition: element.hh:163
RView x1
Definition: element.hh:203
Propagator for element with union
Definition: element.hh:123
Propagator for element with union of constant sets
Definition: element.hh:161
static ExecStatus post(Home home, SView z, const IntSetArgs &x, RView y)
Definition: unionConst.hpp:100
View0 x0
Definition: element.hh:88
View1 x1
Definition: element.hh:89
int ModEventDelta
Modification event deltas.
Definition: core.hpp:169
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z)
Definition: union.hpp:94
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
static ExecStatus post(Home home, IdxViewArray &x, RView y)
Post propagator for .
Definition: disjoint.hpp:64
IdxViewArray iv
Definition: element.hh:127
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: inter.hpp:112
ExecStatus
Definition: core.hpp:540
IdxViewArray iv
Definition: element.hh:202