Generated on Tue Jan 19 2021 06:15:49 for Gecode by doxygen 1.8.13
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  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #ifndef __GECODE_SET_CHANNEL_HH__
39 #define __GECODE_SET_CHANNEL_HH__
40 
41 #include <gecode/set.hh>
42 
43 namespace Gecode { namespace Set { namespace Channel {
44 
59  template<class View>
60  class ChannelSorted : public Propagator {
61  protected:
63  View x0;
66 
71  public:
73  virtual Actor* copy(Space& home);
75  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
77  virtual void reschedule(Space& home);
79  virtual size_t dispose(Space& home);
81  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
83  static ExecStatus post(Home home, View s,
85  };
86 
104  template<class View>
105  class ChannelInt : public Propagator {
106  protected:
111 
113  ChannelInt(Space& home, ChannelInt& p);
115  ChannelInt(Home home,
118  public:
120  virtual Actor* copy(Space& home);
122  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
124  virtual void reschedule(Space& home);
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, 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, 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);
198  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
200  virtual void reschedule(Space& home);
202  virtual size_t dispose(Space& home);
204  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
206  virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
209  View y);
210  };
211 
225  template<typename View>
226  class ChannelSet: public Propagator {
227  protected:
232 
234  ChannelSet(Space& home, ChannelSet& p);
236  ChannelSet(Home home,
239  public:
241  virtual Actor* copy(Space& home);
243  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
245  virtual void reschedule(Space& home);
247  virtual size_t dispose(Space& home);
249  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
251  static ExecStatus post(Home home,
254  };
255 
256 }}}
257 
262 
263 #endif
264 
265 // STATISTICS: set-prop
const PropCond PC_GEN_NONE
Propagation condition to be ignored (convenience)
Definition: core.hpp:74
Council of advisors
Definition: core.hpp:154
bool running
Flag whether propagation is currently running.
Definition: channel.hh:193
Propagator for successors/predecessors channelling
Definition: channel.hh:226
ViewArray< CachedView< View > > xs
SetViews, reflects the successors of .
Definition: channel.hh:229
MixNaryOnePropagator< Gecode::Int::BoolView, Gecode::Int::PC_BOOL_VAL, View, PC_GEN_NONE > Super
Definition: channel.hh:155
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_LINEAR_LO)
Definition: sorted.hpp:84
Mixed (n+1)-ary propagator.
Definition: pattern.hpp:272
Council< IndexAdvisor > co
Council for managing advisors.
Definition: channel.hh:185
Base-class for propagators.
Definition: core.hpp:1023
ViewArray< Gecode::Int::CachedView< Gecode::Int::IntView > > xs
IntViews, reflects which set contains element .
Definition: channel.hh:108
Base-class for advisors.
Definition: core.hpp:1251
GLBndSet zeros
Accumulated zero Booleans.
Definition: channel.hh:189
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: sorted.hpp:106
Computation spaces.
Definition: core.hpp:1701
Base-class for both propagators and branchers.
Definition: core.hpp:627
View x0
SetView for the match.
Definition: channel.hh:63
Gecode::IntSet d(v, 7)
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
virtual void reschedule(Space &home)
Schedule function.
Definition: sorted.hpp:90
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1034
Advisor storing a single index
Definition: channel.hh:166
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Advise function.
Definition: core.cpp:67
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:65
Propagator for the sorted channel constraint
Definition: channel.hh:60
Integer view for integer variables.
Definition: view.hpp:129
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:767
ViewArray< CachedView< View > > ys
SetViews, reflects the predecessors of .
Definition: channel.hh:231
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:249
Generic domain change information to be supplied to advisors.
Definition: core.hpp:203
Propagation cost.
Definition: core.hpp:485
ExecStatus
Definition: core.hpp:471
ViewArray< CachedView< View > > ys
SetViews that are constrained to be disjoint.
Definition: channel.hh:110
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: sorted.hpp:112
virtual size_t dispose(Space &home)
Delete Propagator.
Definition: sorted.hpp:97
ChannelSorted(Space &home, ChannelSorted &p)
Constructor for cloning p.
Definition: sorted.hpp:57
Growing sets of integers.
Definition: var-imp.hpp:205
Post propagator for SetVar x
Definition: set.hh:767
GLBndSet ones
Accumulated one Booleans.
Definition: channel.hh:191
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
ViewArray< Gecode::Int::IntView > xs
IntViews that together form the set x0.
Definition: channel.hh:65
Propagator for channelling between variable-value-dual models
Definition: channel.hh:105
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
Home class for posting propagators
Definition: core.hpp:853
struct Gecode::@593::NNF::@62::@64 a
For atomic nodes.
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:52
Boolean view for Boolean variables.
Definition: view.hpp:1380