Generated on Sat Jul 28 2018 17:11:02 for Gecode by doxygen 1.8.14
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: 2016-06-29 17:28:17 +0200 (Wed, 29 Jun 2016) $ by $Author: schulte $
15  * $Revision: 15137 $
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 void reschedule(Space& home);
83  virtual size_t dispose(Space& home);
85  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
87  static ExecStatus post(Home home, View s,
89  };
90 
108  template<class View>
109  class ChannelInt : public Propagator {
110  protected:
115 
117  ChannelInt(Space& home, bool share,ChannelInt& p);
119  ChannelInt(Home home,
122  public:
124  virtual Actor* copy(Space& home, bool share);
126  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
128  virtual void reschedule(Space& home);
130  virtual size_t dispose(Space& home);
132  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
134  static ExecStatus post(Home home,
138  };
139 
151  template<class View>
153  : public MixNaryOnePropagator<Gecode::Int::BoolView,
154  Gecode::Int::PC_BOOL_VAL,
155  View,PC_GEN_NONE> {
156  protected:
160  using Super::x;
161  using Super::y;
162 
164  ChannelBool(Space& home, bool share,ChannelBool& p);
167  View);
168 
170  class IndexAdvisor : public Advisor {
171  protected:
173  int idx;
174  public:
176  template<class A>
178  int index);
180  IndexAdvisor(Space& home, bool share, IndexAdvisor& a);
182  int index(void) const;
184  template<class A>
185  void dispose(Space& home, Council<A>& c);
186  };
187 
197  bool running;
198  public:
200  virtual Actor* copy(Space& home,bool);
202  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
204  virtual void reschedule(Space& home);
206  virtual size_t dispose(Space& home);
208  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
210  virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
213  View y);
214  };
215 
229  template<typename View>
230  class ChannelSet: public Propagator {
231  protected:
236 
238  ChannelSet(Space& home, bool share, ChannelSet& p);
240  ChannelSet(Home home,
243  public:
245  virtual Actor* copy(Space& home, bool);
247  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
249  virtual void reschedule(Space& home);
251  virtual size_t dispose(Space& home);
253  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
255  static ExecStatus post(Home home,
258  };
259 
260 }}}
261 
266 
267 #endif
268 
269 // STATISTICS: set-prop
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: int.hpp:119
const PropCond PC_GEN_NONE
Propagation condition to be ignored (convenience)
Definition: core.hpp:154
Council of advisors
Definition: core.hpp:232
bool running
Flag whether propagation is currently running.
Definition: channel.hh:197
Propagator for successors/predecessors channelling
Definition: channel.hh:230
ViewArray< CachedView< View > > xs
SetViews, reflects the successors of .
Definition: channel.hh:233
MixNaryOnePropagator< Gecode::Int::BoolView, Gecode::Int::PC_BOOL_VAL, View, PC_GEN_NONE > Super
Definition: channel.hh:159
ChannelInt(Space &home, bool share, ChannelInt &p)
Constructor for cloning p.
Definition: int.hpp:63
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_QUADRATIC_LO)
Definition: int.hpp:97
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_LINEAR_LO)
Definition: sorted.hpp:88
Mixed (n+1)-ary propagator.
Definition: propagator.hpp:282
Council< IndexAdvisor > co
Council for managing advisors.
Definition: channel.hh:189
Base-class for propagators.
Definition: core.hpp:1092
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:112
Base-class for advisors.
Definition: core.hpp:1294
GLBndSet zeros
Accumulated zero Booleans.
Definition: channel.hh:193
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: set.hpp:111
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:1748
Base-class for both propagators and branchers.
Definition: core.hpp:696
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: sorted.hpp:110
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool.hpp:159
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
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
virtual void reschedule(Space &home)
Schedule function.
Definition: sorted.hpp:94
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:96
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: bool.hpp:145
ChannelSet(Space &home, bool share, ChannelSet &p)
Constructor for cloning p.
Definition: set.hpp:56
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: int.hpp:125
Advisor storing a single index
Definition: channel.hh:170
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:209
virtual void reschedule(Space &home)
Schedule function.
Definition: bool.hpp:138
Propagator for the sorted channel constraint
Definition: channel.hh:64
Integer view for integer variables.
Definition: view.hpp:129
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:784
ViewArray< CachedView< View > > ys
SetViews, reflects the predecessors of .
Definition: channel.hh:235
Generic domain change information to be supplied to advisors.
Definition: core.hpp:281
int index(void) const
Access index.
Definition: bool.hpp:64
virtual void reschedule(Space &home)
Schedule function.
Definition: int.hpp:103
Propagation cost.
Definition: core.hpp:554
ExecStatus
Definition: core.hpp:540
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_QUADRATIC_HI)
Definition: set.hpp:83
ViewArray< CachedView< View > > ys
SetViews that are constrained to be disjoint.
Definition: channel.hh:114
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: sorted.hpp:116
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: bool.hpp:153
virtual size_t dispose(Space &home)
Delete Propagator.
Definition: sorted.hpp:101
Growing sets of integers.
Definition: var-imp.hpp:209
Post propagator for SetVar x
Definition: set.hh:784
GLBndSet ones
Accumulated one Booleans.
Definition: channel.hh:195
virtual void reschedule(Space &home)
Schedule function.
Definition: set.hpp:89
Propagator for channelling between set variable and its characteristic function
Definition: channel.hh:152
Gecode toplevel namespace
SetDelta delta
Accumulated delta information.
Definition: channel.hh:191
static ExecStatus post(Home home, ViewArray< CachedView< View > > &x, ViewArray< CachedView< View > > &y)
Post propagator for .
Definition: set.hpp:64
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:109
int ModEventDelta
Modification event deltas.
Definition: core.hpp:169
ChannelSorted(Space &home, bool share, ChannelSorted &p)
Constructor for cloning p.
Definition: sorted.hpp:61
Home class for posting propagators
Definition: core.hpp:922
ChannelBool(Space &home, bool share, ChannelBool &p)
Constructor for cloning p.
Definition: bool.hpp:116
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: int.hpp:110
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