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 void reschedule(Space& home);
00083 virtual size_t dispose(Space& home);
00085 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00087 static ExecStatus post(Home home, View s,
00088 ViewArray<Gecode::Int::IntView>& x);
00089 };
00090
00108 template<class View>
00109 class ChannelInt : public Propagator {
00110 protected:
00112 ViewArray<Gecode::Int::CachedView<Gecode::Int::IntView> > xs;
00114 ViewArray<CachedView<View> > ys;
00115
00117 ChannelInt(Space& home, bool share,ChannelInt& p);
00119 ChannelInt(Home home,
00120 ViewArray<Gecode::Int::CachedView<Gecode::Int::IntView> >&,
00121 ViewArray<CachedView<View> >&);
00122 public:
00124 virtual Actor* copy(Space& home, bool share);
00126 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00128 virtual void reschedule(Space& home);
00130 virtual size_t dispose(Space& home);
00132 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00134 static ExecStatus post(Home home,
00135 ViewArray<Gecode::Int::CachedView<
00136 Gecode::Int::IntView> >& x,
00137 ViewArray<CachedView<View> >& y);
00138 };
00139
00151 template<class View>
00152 class ChannelBool
00153 : public MixNaryOnePropagator<Gecode::Int::BoolView,
00154 Gecode::Int::PC_BOOL_VAL,
00155 View,PC_GEN_NONE> {
00156 protected:
00157 typedef MixNaryOnePropagator<Gecode::Int::BoolView,
00158 Gecode::Int::PC_BOOL_VAL,
00159 View,PC_GEN_NONE> Super;
00160 using Super::x;
00161 using Super::y;
00162
00164 ChannelBool(Space& home, bool share,ChannelBool& p);
00166 ChannelBool(Home home,ViewArray<Gecode::Int::BoolView>&,
00167 View);
00168
00170 class IndexAdvisor : public Advisor {
00171 protected:
00173 int idx;
00174 public:
00176 template<class A>
00177 IndexAdvisor(Space& home, ChannelBool<View>& p, Council<A>& c,
00178 int index);
00180 IndexAdvisor(Space& home, bool share, IndexAdvisor& a);
00182 int index(void) const;
00184 template<class A>
00185 void dispose(Space& home, Council<A>& c);
00186 };
00187
00189 Council<IndexAdvisor> co;
00191 SetDelta delta;
00193 GLBndSet zeros;
00195 GLBndSet ones;
00197 bool running;
00198 public:
00200 virtual Actor* copy(Space& home,bool);
00202 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00204 virtual void reschedule(Space& home);
00206 virtual size_t dispose(Space& home);
00208 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00210 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
00212 static ExecStatus post(Home home,ViewArray<Gecode::Int::BoolView>& x,
00213 View y);
00214 };
00215
00229 template<typename View>
00230 class ChannelSet: public Propagator {
00231 protected:
00233 ViewArray<CachedView<View> > xs;
00235 ViewArray<CachedView<View> > ys;
00236
00238 ChannelSet(Space& home, bool share, ChannelSet& p);
00240 ChannelSet(Home home,
00241 ViewArray<CachedView<View> >&,
00242 ViewArray<CachedView<View> >&);
00243 public:
00245 virtual Actor* copy(Space& home, bool);
00247 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00249 virtual void reschedule(Space& home);
00251 virtual size_t dispose(Space& home);
00253 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00255 static ExecStatus post(Home home,
00256 ViewArray<CachedView<View> >& x,
00257 ViewArray<CachedView<View> >& y);
00258 };
00259
00260 }}}
00261
00262 #include <gecode/set/channel/sorted.hpp>
00263 #include <gecode/set/channel/int.hpp>
00264 #include <gecode/set/channel/bool.hpp>
00265 #include <gecode/set/channel/set.hpp>
00266
00267 #endif
00268
00269