Generated on Sat Jun 2 2018 07:17:44 for Gecode by doxygen 1.8.13
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<>
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:
83  IdxViewArray iv;
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:
123  IdxViewArray iv;
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:
198  IdxViewArray iv;
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 
Gecode::Int::IdxViewArray< SView > IdxViewArray
Definition: element.hh:196
Base-class for propagators.
Definition: core.hpp:1023
Propagator for element with disjointness
Definition: element.hh:194
Computation spaces.
Definition: core.hpp:1701
Propagator for element with union of constant sets
Definition: element.hh:157
Base-class for both propagators and branchers.
Definition: core.hpp:627
Gecode::Int::IdxViewArray< View > IdxViewArray
Definition: element.hh:80
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
union Gecode::@585::NNF::@62 u
Union depending on nodetype t.
Integer sets.
Definition: int.hh:170
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition: set.hh:765
Passing integer variables.
Definition: int.hh:633
Singleton set view.
Definition: view.hpp:585
Propagator for element with intersection
Definition: element.hh:78
Set view for set variables
Definition: view.hpp:56
Passing set variables.
Definition: set.hh:488
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:765
Propagator for element with union
Definition: element.hh:119
Propagation cost.
Definition: core.hpp:485
ExecStatus
Definition: core.hpp:471
Post propagator for SetVar x
Definition: set.hh:765
An array of IdxView pairs.
Definition: idx-view.hh:67
Gecode toplevel namespace
void reschedule(Space &home, Propagator &p, IntSet &y)
Definition: rel.hpp:92
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
Home class for posting propagators
Definition: core.hpp:853
Class to map VarArg type to view.
Definition: idx-view.hh:60
Gecode::Int::IdxViewArray< View > IdxViewArray
Definition: element.hh:121
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
Definition: filter.cpp:138