Generated on Sat Feb 7 2015 02:01:20 for Gecode by doxygen 1.8.9.1
channel.hh
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Denys Duchier <denys.duchier@univ-orleans.fr>
5  * Guido Tack <tack@gecode.org>
6  * Christian Schulte <schulte@gecode.org>
7  *
8  * Copyright:
9  * Denys Duchier, 2011
10  * Guido Tack, 2011
11  * Christian Schulte, 2004
12  *
13  * Last modified:
14  * $Date: 2011-11-03 11:52:07 +0100 (Thu, 03 Nov 2011) $ by $Author: tack $
15  * $Revision: 12452 $
16  *
17  * This file is part of Gecode, the generic constraint
18  * development environment:
19  * http://www.gecode.org
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining
22  * a copy of this software and associated documentation files (the
23  * "Software"), to deal in the Software without restriction, including
24  * without limitation the rights to use, copy, modify, merge, publish,
25  * distribute, sublicense, and/or sell copies of the Software, and to
26  * permit persons to whom the Software is furnished to do so, subject to
27  * the following conditions:
28  *
29  * The above copyright notice and this permission notice shall be
30  * included in all copies or substantial portions of the Software.
31  *
32  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39  *
40  */
41 
42 #ifndef __GECODE_SET_CHANNEL_HH__
43 #define __GECODE_SET_CHANNEL_HH__
44 
45 #include <gecode/set.hh>
46 
47 namespace Gecode { namespace Set { namespace Channel {
48 
63  template<class View>
64  class ChannelSorted : public Propagator {
65  protected:
67  View x0;
70 
72  ChannelSorted(Space& home, bool share,ChannelSorted& p);
75  public:
77  virtual Actor* copy(Space& home,bool);
79  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
81  virtual size_t dispose(Space& home);
83  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
85  static ExecStatus post(Home home, View s,
87  };
88 
106  template<class View>
107  class ChannelInt : public Propagator {
108  protected:
113 
115  ChannelInt(Space& home, bool share,ChannelInt& p);
117  ChannelInt(Home home,
120  public:
122  virtual Actor* copy(Space& home,bool);
124  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
126  virtual size_t dispose(Space& home);
128  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
130  static ExecStatus post(Home home,
134  };
135 
147  template<class View>
149  : public MixNaryOnePropagator<Gecode::Int::BoolView,
150  Gecode::Int::PC_BOOL_VAL,
151  View,PC_GEN_NONE> {
152  protected:
156  using Super::x;
157  using Super::y;
158 
160  ChannelBool(Space& home, bool share,ChannelBool& p);
163  View);
164 
166  class IndexAdvisor : public Advisor {
167  protected:
169  int idx;
170  public:
172  template<class A>
174  int index);
176  IndexAdvisor(Space& home, bool share, IndexAdvisor& a);
178  int index(void) const;
180  template<class A>
181  void dispose(Space& home, Council<A>& c);
182  };
183 
193  bool running;
194  public:
196  virtual Actor* copy(Space& home,bool);
198  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
200  virtual size_t dispose(Space& home);
202  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
204  virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
207  View y);
208  };
209 
223  template<typename View>
224  class ChannelSet: public Propagator {
225  protected:
230 
232  ChannelSet(Space& home, bool share, ChannelSet& p);
234  ChannelSet(Home home,
237  public:
239  virtual Actor* copy(Space& home, bool);
241  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
243  virtual size_t dispose(Space& home);
245  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
247  static ExecStatus post(Home home,
250  };
251 
252 }}}
253 
258 
259 #endif
260 
261 // STATISTICS: set-prop
const PropCond PC_GEN_NONE
Propagation condition to be ignored (convenience)
Definition: core.hpp:158
Council of advisors
Definition: core.hpp:226
bool running
Flag whether propagation is currently running.
Definition: channel.hh:193
Propagator for successors/predecessors channelling
Definition: channel.hh:224
ViewArray< CachedView< View > > xs
SetViews, reflects the successors of .
Definition: channel.hh:227
MixNaryOnePropagator< Gecode::Int::BoolView, Gecode::Int::PC_BOOL_VAL, View, PC_GEN_NONE > Super
Definition: channel.hh:155
ChannelInt(Space &home, bool share, ChannelInt &p)
Constructor for cloning p.
Definition: int.hpp:63
Mixed (n+1)-ary propagator.
Definition: propagator.hpp:268
Council< IndexAdvisor > co
Council for managing advisors.
Definition: channel.hh:185
Base-class for propagators.
Definition: core.hpp:755
void dispose(Space &home, Council< A > &c)
Delete advisor.
Definition: bool.hpp:71
ViewArray< Gecode::Int::CachedView< Gecode::Int::IntView > > xs
IntViews, reflects which set contains element .
Definition: channel.hh:110
Base-class for advisors.
Definition: core.hpp:926
GLBndSet zeros
Accumulated zero Booleans.
Definition: channel.hh:189
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: set.hpp:112
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_QUADRATIC_LO)
Definition: bool.hpp:132
static ExecStatus post(Home home, ViewArray< Gecode::Int::BoolView > &x, View y)
Post propagator for .
Definition: bool.hpp:123
Computation spaces.
Definition: core.hpp:1362
Base-class for both propagators and branchers.
Definition: core.hpp:666
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: sorted.hpp:103
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool.hpp:152
View x0
SetView for the match.
Definition: channel.hh:67
Gecode::IntSet d(v, 7)
IndexAdvisor(Space &home, ChannelBool< View > &p, Council< A > &c, int index)
Constructor for creation.
Definition: bool.hpp:45
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
static ExecStatus post(Home home, ViewArray< Gecode::Int::CachedView< Gecode::Int::IntView > > &x, ViewArray< CachedView< View > > &y)
Post propagator for .
Definition: int.hpp:71
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: set.hpp:95
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: bool.hpp:138
ChannelSet(Space &home, bool share, ChannelSet &p)
Constructor for cloning p.
Definition: set.hpp:57
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: int.hpp:118
int index(void) const
Access index.
Definition: bool.hpp:64
Advisor storing a single index
Definition: channel.hh:166
static ExecStatus post(Home home, View s, ViewArray< Gecode::Int::IntView > &x)
Post propagator that propagates that s contains the , which are sorted in non-descending order...
Definition: sorted.hpp:69
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition: bool.hpp:202
Propagator for the sorted channel constraint
Definition: channel.hh:64
Integer view for integer variables.
Definition: view.hpp:129
ViewArray< CachedView< View > > ys
SetViews, reflects the predecessors of .
Definition: channel.hh:229
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Generic domain change information to be supplied to advisors.
Definition: core.hpp:275
Propagation cost.
Definition: core.hpp:537
ExecStatus
Definition: core.hpp:523
ViewArray< CachedView< View > > ys
SetViews that are constrained to be disjoint.
Definition: channel.hh:112
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: sorted.hpp:109
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: bool.hpp:146
virtual size_t dispose(Space &home)
Delete Propagator.
Definition: sorted.hpp:94
Cached integer view.
Definition: view.hpp:1107
Growing sets of integers.
Definition: var-imp.hpp:209
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_LINEAR_LO)
Definition: sorted.hpp:88
GLBndSet ones
Accumulated one Booleans.
Definition: channel.hh:191
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_QUADRATIC_LO)
Definition: int.hpp:97
Propagator for channelling between set variable and its characteristic function
Definition: channel.hh:148
Gecode toplevel namespace
SetDelta delta
Accumulated delta information.
Definition: channel.hh:187
static ExecStatus post(Home home, ViewArray< CachedView< View > > &x, ViewArray< CachedView< View > > &y)
Post propagator for .
Definition: set.hpp:66
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: set.hpp:105
ViewArray< Gecode::Int::IntView > xs
IntViews that together form the set x0.
Definition: channel.hh:69
Propagator for channelling between variable-value-dual models
Definition: channel.hh:107
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
ChannelSorted(Space &home, bool share, ChannelSorted &p)
Constructor for cloning p.
Definition: sorted.hpp:61
Home class for posting propagators
Definition: core.hpp:717
ChannelBool(Space &home, bool share, ChannelBool &p)
Constructor for cloning p.
Definition: bool.hpp:116
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_QUADRATIC_HI)
Definition: set.hpp:88
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: int.hpp:112
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: int.hpp:103
const Gecode::PropCond PC_BOOL_VAL
Propagate when a view becomes assigned (single value)
Definition: var-type.hpp:126
Finite set delta information for advisors.
Definition: var-imp.hpp:56
Boolean view for Boolean variables.
Definition: view.hpp:1315