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 #ifndef __GECODE_INT_SEQUENCE_HH__
00035 #define __GECODE_INT_SEQUENCE_HH__
00036
00037 #include <gecode/int.hh>
00038 #include <gecode/int/rel.hh>
00039
00040 namespace Gecode { namespace Int { namespace Sequence {
00041
00054 template<class View>
00055 class SupportAdvisor;
00056
00057 template<class View,class Val,bool iss>
00058 class ViewValSupport;
00059
00064 template<class View, class Val,bool iss>
00065 class ViewValSupportArray {
00066 private:
00068 ViewValSupport<View,Val,iss>* xs;
00070 int n;
00071 public:
00073 ViewValSupportArray(void);
00075 ViewValSupportArray(const ViewValSupportArray<View,Val,iss>&);
00077 ViewValSupportArray(Space& home, ViewArray<View>&, Val s, int q);
00079 ViewValSupportArray(Space& home, int n);
00081 int size(void) const;
00083 ViewValSupport<View,Val,iss>& operator [](int n);
00085 const ViewValSupport<View,Val,iss>& operator [](int) const;
00087 void update(Space& home, ViewValSupportArray<View,Val,iss>& x);
00089 ExecStatus propagate(Space& home,ViewArray<View>& a,Val s,int q,int l,int u);
00091 ExecStatus advise(Space& home,ViewArray<View>& a,Val s,int q,int j,const Delta& d);
00092 };
00093
00100 template<class View, class Val>
00101 class Sequence : public Propagator {
00102 protected:
00104 Sequence(Space& home, Sequence& p);
00106 Sequence(Home home, ViewArray<View>& x, Val s, int q, int l, int u);
00107 public:
00109 virtual Actor* copy(Space& home);
00111 ExecStatus advise(Space& home, Advisor& _a, const Delta& d);
00113 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00115 virtual void reschedule(Space& home);
00117 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00119 static ExecStatus post(Home home, ViewArray<View>& x, Val s, int q, int l, int u);
00121 static ExecStatus check(ViewArray<View>& x, Val s, int q, int l, int u);
00123 virtual size_t dispose(Space& home);
00124 private:
00126 ViewArray<View> x;
00128 Val s;
00130 int q;
00132 int l;
00134 int u;
00136 ViewValSupportArray<View,Val,true> vvsamax;
00138 ViewValSupportArray<View,Val,false> vvsamin;
00140 Council<SupportAdvisor<View> > ac;
00142 bool tofail;
00143 };
00144
00145 }}}
00146
00147 #include <gecode/int/sequence/set-op.hpp>
00148 #include <gecode/int/sequence/violations.hpp>
00149 #include <gecode/int/sequence/int.hpp>
00150 #include <gecode/int/sequence/view.hpp>
00151
00152 #endif
00153
00154