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 #ifndef __GECODE_INT_ELEMENT_HH__
00041 #define __GECODE_INT_ELEMENT_HH__
00042
00043 #include "gecode/int.hh"
00044 #include "gecode/int/rel.hh"
00045
00051 namespace Gecode { namespace Int { namespace Element {
00052
00053
00054
00055
00056
00057
00058 typedef SharedArray<int> IntSharedArray;
00059
00061 class IdxValMap;
00062
00069 template <class ViewA, class ViewB>
00070 class Int : public Propagator {
00071 protected:
00073 ViewA x0;
00075 ViewB x1;
00077 IntSharedArray c;
00079 IdxValMap* ivm;
00081 Int(Space* home, bool shared, Int& p);
00083 Int(Space* home, IntSharedArray& i, ViewA x0, ViewB x1);
00084 public:
00086 virtual Actor* copy(Space* home, bool share);
00088 virtual PropCost cost(ModEventDelta med) const;
00090 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00092 virtual Reflection::ActorSpec spec(const Space* home,
00093 Reflection::VarMap& m) const;
00095 static void post(Space* home, Reflection::VarMap& vars,
00096 const Reflection::ActorSpec& spec);
00098 static Support::Symbol ati(void);
00100 static ExecStatus post(Space* home, IntSharedArray& i,
00101 ViewA x0, ViewB x1);
00103 virtual size_t allocated(void) const;
00105 virtual size_t dispose(Space* home);
00106 };
00107
00108
00109
00114 template <class ViewB> class IdxView;
00115
00120 template <class VA, class VB, class VC, PropCond pc_ac>
00121 class View : public Propagator {
00122 protected:
00124 IdxView<VA>* iv;
00126 int n;
00128 VB x0;
00130 VC x1;
00132 View(Space* home, bool share, View& p);
00134 View(Space* home, IdxView<VA>* iv, int n, VB x0, VC x1);
00136 Reflection::ActorSpec spec(const Space* home, Reflection::VarMap& m,
00137 const Support::Symbol& name) const;
00138 public:
00139
00140 virtual PropCost cost(ModEventDelta med) const;
00142 virtual size_t dispose(Space* home);
00143 };
00144
00145
00152 template <class VA, class VB, class VC>
00153 class ViewBnd : public View<VA,VB,VC,PC_INT_BND> {
00154 protected:
00155 using View<VA,VB,VC,PC_INT_BND>::iv;
00156 using View<VA,VB,VC,PC_INT_BND>::n;
00157 using View<VA,VB,VC,PC_INT_BND>::x0;
00158 using View<VA,VB,VC,PC_INT_BND>::x1;
00159
00161 ViewBnd(Space* home, bool share, ViewBnd& p);
00163 ViewBnd(Space* home, IdxView<VA>* iv, int n, VB x0, VC x1);
00164 public:
00166 virtual Actor* copy(Space* home, bool share);
00168 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00170 virtual Reflection::ActorSpec spec(const Space* home,
00171 Reflection::VarMap& m) const;
00173 static void post(Space* home, Reflection::VarMap& vars,
00174 const Reflection::ActorSpec& spec);
00176 static Support::Symbol ati(void);
00178 static ExecStatus post(Space* home, IdxView<VA>* iv, int n,
00179 VB x0, VC x1);
00180 };
00181
00192 template <class VA, class VB, class VC>
00193 class ViewDom : public View<VA,VB,VC,PC_INT_DOM> {
00194 protected:
00195 using View<VA,VB,VC,PC_INT_DOM>::iv;
00196 using View<VA,VB,VC,PC_INT_DOM>::n;
00197 using View<VA,VB,VC,PC_INT_DOM>::x0;
00198 using View<VA,VB,VC,PC_INT_DOM>::x1;
00199
00201 ViewDom(Space* home, bool share, ViewDom& p);
00203 ViewDom(Space* home, IdxView<VA>* iv, int n, VB x0, VC x1);
00204 public:
00206 virtual Actor* copy(Space* home, bool share);
00214 virtual PropCost cost(ModEventDelta med) const;
00216 virtual ExecStatus propagate(Space* home, ModEventDelta med);
00218 virtual Reflection::ActorSpec spec(const Space* home,
00219 Reflection::VarMap& m) const;
00221 static void post(Space* home, Reflection::VarMap& vars,
00222 const Reflection::ActorSpec& spec);
00224 static Support::Symbol ati(void);
00226 static ExecStatus post(Space* home, IdxView<VA>* iv, int n,
00227 VB x0, VC x1);
00228 };
00229
00230 }}}
00231
00232 #include "gecode/int/element/int.icc"
00233 #include "gecode/int/element/view.icc"
00234
00235 #endif
00236
00237
00238
00239