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 #ifndef __GECODE_INT_SEQUENCE_HH__
00039 #define __GECODE_INT_SEQUENCE_HH__
00040
00041 #include <gecode/int.hh>
00042 #include <gecode/int/rel.hh>
00043
00044 namespace Gecode { namespace Int { namespace Sequence {
00045
00058 template<class View>
00059 class SupportAdvisor;
00060
00061 template<class View,class Val,bool iss>
00062 class ViewValSupport;
00063
00068 template<class View, class Val,bool iss>
00069 class ViewValSupportArray {
00070 private:
00072 ViewValSupport<View,Val,iss>* xs;
00074 int n;
00075 public:
00077 ViewValSupportArray(void);
00079 ViewValSupportArray(const ViewValSupportArray<View,Val,iss>&);
00081 ViewValSupportArray(Space& home, ViewArray<View>&, Val s, int q);
00083 ViewValSupportArray(Space& home, int n);
00085 int size(void) const;
00087 ViewValSupport<View,Val,iss>& operator [](int n);
00089 const ViewValSupport<View,Val,iss>& operator [](int) const;
00091 void update(Space& home, bool share, ViewValSupportArray<View,Val,iss>& x);
00093 ExecStatus propagate(Space& home,ViewArray<View>& a,Val s,int q,int l,int u);
00095 ExecStatus advise(Space& home,ViewArray<View>& a,Val s,int q,int j,const Delta& d);
00096 };
00097
00104 template<class View, class Val>
00105 class Sequence : public Propagator {
00106 protected:
00108 Sequence(Space& home, bool shared, Sequence& p);
00110 Sequence(Home home, ViewArray<View>& x, Val s, int q, int l, int u);
00111 public:
00113 virtual Actor* copy(Space& home, bool share);
00115 ExecStatus advise(Space& home, Advisor& _a, const Delta& d);
00117 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00119 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00121 static ExecStatus post(Home home, ViewArray<View>& x, Val s, int q, int l, int u);
00123 static ExecStatus check(Space& home, ViewArray<View>& x, Val s, int q, int l, int u);
00125 virtual size_t dispose(Space& home);
00126 private:
00128 ViewArray<View> x;
00130 Val s;
00132 int q;
00134 int l;
00136 int u;
00138 ViewValSupportArray<View,Val,true> vvsamax;
00140 ViewValSupportArray<View,Val,false> vvsamin;
00142 Council<SupportAdvisor<View> > ac;
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