00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __GECODE_INT_ELEMENT_HH__
00025 #define __GECODE_INT_ELEMENT_HH__
00026
00027 #include "gecode/int.hh"
00028 #include "gecode/int/rel.hh"
00029
00030 #include "gecode/support/shared-array.hh"
00031 #include "gecode/support/sort.hh"
00032
00033 #include "gecode/iter.hh"
00034
00040 namespace Gecode { namespace Int { namespace Element {
00041
00042
00043
00044
00045
00046
00047 typedef Support::SharedArray<int> IntSharedArray;
00048
00050 class IdxValMap;
00051
00058 template <class ViewA, class ViewB>
00059 class Int : public Propagator {
00060 protected:
00062 ViewA x0;
00064 ViewB x1;
00066 IntSharedArray c;
00068 IdxValMap* ivm;
00070 Int(Space* home, bool shared, Int& p);
00072 Int(Space* home, IntSharedArray& i, ViewA x0, ViewB x1);
00073 public:
00075 virtual Actor* copy(Space* home, bool share);
00077 virtual PropCost cost(void) const;
00079 virtual ExecStatus propagate(Space* home);
00081 static ExecStatus post(Space* home, IntSharedArray& i,
00082 ViewA x0, ViewB x1);
00084 virtual void flush(void);
00086 virtual size_t size(void) const;
00088 virtual size_t dispose(Space* home);
00089 };
00090
00091
00092
00097 template <class ViewB> class IdxView;
00098
00103 template <class ViewA, class ViewB, PropCond pcb>
00104 class View : public Propagator {
00105 protected:
00107 ViewA x0;
00109 ViewB x1;
00111 int n;
00113 IdxView<ViewB>* iv;
00115 View(Space* home, bool share, View& p);
00117 View(Space* home, IdxView<ViewB>* iv, int n, ViewA x0, ViewB x1);
00118 public:
00119
00120 virtual PropCost cost(void) const;
00122 virtual size_t dispose(Space* home);
00123 };
00124
00125
00132 template <class ViewA, class ViewB>
00133 class ViewBnd : public View<ViewA,ViewB,PC_INT_BND> {
00134 protected:
00135 using View<ViewA,ViewB,PC_INT_BND>::x0;
00136 using View<ViewA,ViewB,PC_INT_BND>::x1;
00137 using View<ViewA,ViewB,PC_INT_BND>::n;
00138 using View<ViewA,ViewB,PC_INT_BND>::iv;
00139
00141 ViewBnd(Space* home, bool share, ViewBnd& p);
00143 ViewBnd(Space* home, IdxView<ViewB>* iv, int n, ViewA x0, ViewB x1);
00144 public:
00146 virtual Actor* copy(Space* home, bool share);
00148 virtual ExecStatus propagate(Space* home);
00150 static ExecStatus post(Space* home, IdxView<ViewB>* iv, int n,
00151 ViewA x0, ViewB x1);
00152 };
00153
00164 template <class ViewA, class ViewB>
00165 class ViewDom : public View<ViewA,ViewB,PC_INT_DOM> {
00166 protected:
00167 using View<ViewA,ViewB,PC_INT_DOM>::x0;
00168 using View<ViewA,ViewB,PC_INT_DOM>::x1;
00169 using View<ViewA,ViewB,PC_INT_DOM>::n;
00170 using View<ViewA,ViewB,PC_INT_DOM>::iv;
00171
00173 ViewDom(Space* home, bool share, ViewDom& p);
00175 ViewDom(Space* home, IdxView<ViewB>* iv, int n, ViewA x0, ViewB x1);
00176 public:
00178 virtual Actor* copy(Space* home, bool share);
00186 virtual PropCost cost(void) const;
00188 virtual ExecStatus propagate(Space* home);
00190 static ExecStatus post(Space* home, IdxView<ViewB>* iv, int n,
00191 ViewA x0, ViewB x1);
00192 };
00193
00194 }}}
00195
00196 #include "gecode/int/element/int.icc"
00197 #include "gecode/int/element/view.icc"
00198
00199 #endif
00200
00201
00202
00203