00001 #ifndef GC_NEIGHBORED3_HH_
00002 #define GC_NEIGHBORED3_HH_
00003
00004
00005
00006 #include <gecode/kernel.hh>
00007 #include <gecode/int.hh>
00008 #include <gecode/search.hh>
00009
00010 #include <biu/LatticeFrame.hh>
00011
00012 namespace cpsp
00013 {
00014 namespace gecode
00015 {
00016
00017 typedef Gecode::TernaryPropagator< Gecode::Int::IntView,
00018 Gecode::Int::PC_INT_DOM> GC_TriProp;
00019
00020 class GC_Neighbored3 : public GC_TriProp
00021 {
00022 private:
00023
00030 biu::IndexSet
00031 getIndexedNeighbors( const biu::LatticeFrame::index_type center) const;
00032
00034 Gecode::ModEvent removeNonNeighbors( Gecode::Space* home,
00035 Gecode::Int::IntView& x,
00036 int center);
00039 Gecode::ModEvent removeNonNeighbors( Gecode::Space* home,
00040 Gecode::Int::IntView& a,
00041 Gecode::Int::IntView& b);
00042
00044 Gecode::ModEvent removeNonNeighbors( Gecode::Space* home,
00045 Gecode::Int::IntView& a,
00046 Gecode::Int::IntView& b,
00047 Gecode::Int::IntView& c);
00048
00050 static const unsigned int MAXPROPSIZEINIT;
00051
00052 protected:
00053
00054 using GC_TriProp::x0;
00055 using GC_TriProp::x1;
00056 using GC_TriProp::x2;
00057
00060 const biu::LatticeFrame* lattice;
00061
00063 biu::IndexVec neighborhood;
00064
00069 Gecode::IntConLevel conLevel;
00070
00073 unsigned int maxPropSize;
00074
00077 bool maxPropSizeBin;
00078
00081 unsigned int minPropSize;
00082
00084 GC_Neighbored3(Gecode::Space* home, bool share, GC_Neighbored3& p);
00085
00087 GC_Neighbored3( Gecode::Space* home,
00088 Gecode::Int::IntView x0,
00089 Gecode::Int::IntView x1,
00090 Gecode::Int::IntView x2,
00091 const biu::LatticeFrame* lattice,
00092 Gecode::IntConLevel conLvl,
00093 unsigned int maxPrSize,
00094 bool maxPrSizeBin,
00095 unsigned int minPrSize);
00096
00097 public:
00098
00100 static Gecode::ExecStatus post( Gecode::Space* home,
00101 Gecode::Int::IntView x0,
00102 Gecode::Int::IntView x1,
00103 Gecode::Int::IntView x2,
00104 const biu::LatticeFrame* lattice,
00105 Gecode::IntConLevel conLvl =Gecode::ICL_BND,
00106 unsigned int maxPrSize = MAXPROPSIZEINIT,
00107 bool maxPrSizeBin = false,
00108 unsigned int minPrSize = 0);
00109
00111 virtual Gecode::Actor* copy(Gecode::Space* home, bool share);
00112
00114 virtual Gecode::PropCost cost(void) const;
00115
00117 virtual Gecode::ExecStatus propagate(Gecode::Space* home);
00118
00119 };
00120
00121 }
00122 }
00123
00124 #endif