Generated on Sat Apr 10 2021 00:00:00 for Gecode by doxygen 1.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  * This file is part of Gecode, the generic constraint
12  * development environment:
13  * http://www.gecode.org
14  *
15  * Permission is hereby granted, free of charge, to any person obtaining
16  * a copy of this software and associated documentation files (the
17  * "Software"), to deal in the Software without restriction, including
18  * without limitation the rights to use, copy, modify, merge, publish,
19  * distribute, sublicense, and/or sell copies of the Software, and to
20  * permit persons to whom the Software is furnished to do so, subject to
21  * the following conditions:
22  *
23  * The above copyright notice and this permission notice shall be
24  * included in all copies or substantial portions of the Software.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33  *
34  */
35 
36 #ifndef __GECODE_SET_SELECT_HH__
37 #define __GECODE_SET_SELECT_HH__
38 
39 #include <gecode/set.hh>
40 
41 #include <gecode/int/idx-view.hh>
42 #include <gecode/int/element.hh>
43 #include <gecode/set/rel.hh>
44 #include <gecode/set/rel-op.hh>
45 
46 namespace Gecode { namespace Int {
47 
49  template<>
50  class ViewToVarArg<Gecode::Set::SetView> {
51  public:
53  };
54 
56  template<>
58  public:
60  };
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 
90  ElementIntersection(Home home, IdxViewArray&,View0,View1,
91  const IntSet& universe);
92  public:
94  virtual Actor* copy(Space& home);
96  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
98  virtual void reschedule(Space& home);
100  virtual size_t dispose(Space& home);
102  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
108  static ExecStatus post(Home home,IdxViewArray& x, View0 y,
109  View1 z, const IntSet& u);
110  };
111 
118  template<class View, class View0, class View1>
119  class ElementUnion : public Propagator {
120  public:
122  protected:
124  View0 x0;
125  View1 x1;
126 
128  ElementUnion(Space& home, ElementUnion& p);
130  ElementUnion(Home home,IdxViewArray&,View0,View1);
131  public:
133  virtual Actor* copy(Space& home);
135  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
137  virtual void reschedule(Space& home);
139  virtual size_t dispose(Space& home);
141  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
147  static ExecStatus post(Home home,IdxViewArray& x,View0 y, View1 z);
148  };
149 
156  template<class SView, class RView>
157  class ElementUnionConst : public Propagator {
158  protected:
159  SView x0;
161  int n_iv;
162  RView x1;
163 
167  ElementUnionConst(Home home, SView, const IntSetArgs&, RView);
168  public:
170  virtual Actor* copy(Space& home);
172  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
174  virtual void reschedule(Space& home);
176  virtual size_t dispose(Space& home);
178  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
184  static ExecStatus post(Home home,SView z,const IntSetArgs& x,RView y);
185  };
186 
193  template<class SView, class RView>
194  class ElementDisjoint : public Propagator {
195  public:
197  protected:
199  RView x1;
200 
204  ElementDisjoint(Home home,IdxViewArray&,RView);
205  public:
207  virtual Actor* copy(Space& home);
209  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
211  virtual void reschedule(Space& home);
213  virtual size_t dispose(Space& home);
215  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
217  static ExecStatus post(Home home,IdxViewArray& x,RView y);
218  };
219 
220 }}}
221 
226 
227 #endif
228 
229 // STATISTICS: set-prop
230 
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:249
Base-class for both propagators and branchers.
Definition: core.hpp:628
Home class for posting propagators
Definition: core.hpp:856
Integer sets.
Definition: int.hh:174
Passing integer variables.
Definition: int.hh:656
An array of IdxView pairs.
Definition: idx-view.hh:67
Class to map VarArg type to view.
Definition: idx-view.hh:60
Propagation cost.
Definition: core.hpp:486
Base-class for propagators.
Definition: core.hpp:1064
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1075
Passing set variables.
Definition: set.hh:488
Propagator for element with disjointness
Definition: element.hh:194
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: disjoint.hpp:74
Gecode::Int::IdxViewArray< SView > IdxViewArray
Definition: element.hh:196
ElementDisjoint(Space &home, ElementDisjoint &p)
Constructor for cloning p.
Definition: disjoint.hpp:51
static ExecStatus post(Home home, IdxViewArray &x, RView y)
Post propagator for .
Definition: disjoint.hpp:60
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: disjoint.hpp:96
virtual void reschedule(Space &home)
Schedule function.
Definition: disjoint.hpp:80
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: disjoint.hpp:87
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: disjoint.hpp:102
Propagator for element with intersection
Definition: element.hh:78
ElementIntersection(Space &home, ElementIntersection &p)
Constructor for cloning p.
Definition: inter.hpp:53
Gecode::Int::IdxViewArray< View > IdxViewArray
Definition: element.hh:80
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: inter.hpp:106
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: inter.hpp:77
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: inter.hpp:62
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: inter.hpp:112
virtual void reschedule(Space &home)
Schedule function.
Definition: inter.hpp:69
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z, const IntSet &u)
Definition: inter.hpp:92
Propagator for element with union of constant sets
Definition: element.hh:157
ElementUnionConst(Space &home, ElementUnionConst &p)
Constructor for cloning p.
Definition: unionConst.hpp:56
static ExecStatus post(Home home, SView z, const IntSetArgs &x, RView y)
Definition: unionConst.hpp:95
virtual void reschedule(Space &home)
Schedule function.
Definition: unionConst.hpp:73
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: unionConst.hpp:80
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: unionConst.hpp:109
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: unionConst.hpp:115
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: unionConst.hpp:67
Propagator for element with union
Definition: element.hh:119
virtual void reschedule(Space &home)
Schedule function.
Definition: union.hpp:68
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: union.hpp:109
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: union.hpp:76
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z)
Definition: union.hpp:90
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: union.hpp:61
ElementUnion(Space &home, ElementUnion &p)
Constructor for cloning p.
Definition: union.hpp:52
Gecode::Int::IdxViewArray< View > IdxViewArray
Definition: element.hh:121
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: union.hpp:103
Set view for set variables
Definition: view.hpp:56
Singleton set view.
Definition: view.hpp:594
Computation spaces.
Definition: core.hpp:1742
ExecStatus
Definition: core.hpp:472
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89