00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef __GECODE_SET_CHANNEL_HH__
00043 #define __GECODE_SET_CHANNEL_HH__
00044
00045 #include <gecode/set.hh>
00046
00047 namespace Gecode { namespace Set { namespace Channel {
00048
00063 template<class View>
00064 class ChannelSorted : public Propagator {
00065 protected:
00067 View x0;
00069 ViewArray<Gecode::Int::IntView> xs;
00070
00072 ChannelSorted(Space& home, bool share,ChannelSorted& p);
00074 ChannelSorted(Home home, View, ViewArray<Gecode::Int::IntView>&);
00075 public:
00077 virtual Actor* copy(Space& home,bool);
00079 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00081 virtual size_t dispose(Space& home);
00083 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00085 static ExecStatus post(Home home, View s,
00086 ViewArray<Gecode::Int::IntView>& x);
00087 };
00088
00106 template<class View>
00107 class ChannelInt : public Propagator {
00108 protected:
00110 ViewArray<Gecode::Int::CachedView<Gecode::Int::IntView> > xs;
00112 ViewArray<CachedView<View> > ys;
00113
00115 ChannelInt(Space& home, bool share,ChannelInt& p);
00117 ChannelInt(Home home,
00118 ViewArray<Gecode::Int::CachedView<Gecode::Int::IntView> >&,
00119 ViewArray<CachedView<View> >&);
00120 public:
00122 virtual Actor* copy(Space& home,bool);
00124 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00126 virtual size_t dispose(Space& home);
00128 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00130 static ExecStatus post(Home home,
00131 ViewArray<Gecode::Int::CachedView<
00132 Gecode::Int::IntView> >& x,
00133 ViewArray<CachedView<View> >& y);
00134 };
00135
00147 template<class View>
00148 class ChannelBool
00149 : public MixNaryOnePropagator<Gecode::Int::BoolView,
00150 Gecode::Int::PC_BOOL_VAL,
00151 View,PC_GEN_NONE> {
00152 protected:
00153 typedef MixNaryOnePropagator<Gecode::Int::BoolView,
00154 Gecode::Int::PC_BOOL_VAL,
00155 View,PC_GEN_NONE> Super;
00156 using Super::x;
00157 using Super::y;
00158
00160 ChannelBool(Space& home, bool share,ChannelBool& p);
00162 ChannelBool(Home home,ViewArray<Gecode::Int::BoolView>&,
00163 View);
00164
00166 class IndexAdvisor : public Advisor {
00167 protected:
00169 int idx;
00170 public:
00172 template<class A>
00173 IndexAdvisor(Space& home, ChannelBool<View>& p, Council<A>& c,
00174 int index);
00176 IndexAdvisor(Space& home, bool share, IndexAdvisor& a);
00178 int index(void) const;
00180 template<class A>
00181 void dispose(Space& home, Council<A>& c);
00182 };
00183
00185 Council<IndexAdvisor> co;
00187 SetDelta delta;
00189 GLBndSet zeros;
00191 GLBndSet ones;
00193 bool running;
00194 public:
00196 virtual Actor* copy(Space& home,bool);
00198 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00200 virtual size_t dispose(Space& home);
00202 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00204 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
00206 static ExecStatus post(Home home,ViewArray<Gecode::Int::BoolView>& x,
00207 View y);
00208 };
00209
00223 template<typename View>
00224 class ChannelSet: public Propagator {
00225 protected:
00227 ViewArray<CachedView<View> > xs;
00229 ViewArray<CachedView<View> > ys;
00230
00232 ChannelSet(Space& home, bool share, ChannelSet& p);
00234 ChannelSet(Home home,
00235 ViewArray<CachedView<View> >&,
00236 ViewArray<CachedView<View> >&);
00237 public:
00239 virtual Actor* copy(Space& home, bool);
00241 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00243 virtual size_t dispose(Space& home);
00245 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00247 static ExecStatus post(Home home,
00248 ViewArray<CachedView<View> >& x,
00249 ViewArray<CachedView<View> >& y);
00250 };
00251
00252 }}}
00253
00254 #include <gecode/set/channel/sorted.hpp>
00255 #include <gecode/set/channel/int.hpp>
00256 #include <gecode/set/channel/bool.hpp>
00257 #include <gecode/set/channel/set.hpp>
00258
00259 #endif
00260
00261