00001 #ifndef GC_NEIGHBORED2_HH_
00002 #define GC_NEIGHBORED2_HH_
00003
00004 #include <gecode/kernel.hh>
00005 #include <gecode/int.hh>
00006 #include <gecode/search.hh>
00007
00008 #include <biu/LatticeFrame.hh>
00009
00010 namespace cpsp
00011 {
00012 namespace gecode
00013 {
00014
00015 typedef Gecode::BinaryPropagator< Gecode::Int::IntView,
00016 Gecode::Int::PC_INT_DOM> GC_BinProp;
00017
00018 class GC_Neighbored2 : public GC_BinProp
00019
00020 {
00021 private:
00022
00029 biu::IndexSet
00030 getIndexedNeighbors( const biu::LatticeFrame::index_type center) const;
00031
00033 Gecode::ModEvent removeNonNeighbors( Gecode::Space* home,
00034 Gecode::Int::IntView& x,
00035 int center);
00038 Gecode::ModEvent removeNonNeighbors(Gecode::Space* home);
00039
00041 static const unsigned int MAXPROPSIZEINIT;
00042
00043
00044 protected:
00045
00046 using GC_BinProp::x0;
00047 using GC_BinProp::x1;
00048
00051 const biu::LatticeFrame* lattice;
00052
00054 biu::IndexVec neighborhood;
00055
00060 Gecode::IntConLevel conLevel;
00061
00064 unsigned int maxPropSize;
00065
00068 bool maxPropSizeBin;
00069
00072 unsigned int minPropSize;
00073
00075 GC_Neighbored2(Gecode::Space* home, bool share, GC_Neighbored2& p);
00076
00078 GC_Neighbored2( Gecode::Space* home,
00079 Gecode::Int::IntView x0,
00080 Gecode::Int::IntView x1,
00081 const biu::LatticeFrame* lattice,
00082 Gecode::IntConLevel conLvl,
00083 unsigned int maxPrSize,
00084 bool maxPrSizeBin,
00085 unsigned int minPrSize);
00086
00087 public:
00089 static Gecode::ExecStatus post( Gecode::Space* home,
00090 Gecode::Int::IntView x0,
00091 Gecode::Int::IntView x1,
00092 const biu::LatticeFrame* lattice,
00093 Gecode::IntConLevel conLvl =Gecode::ICL_BND,
00094 unsigned int maxPrSize = MAXPROPSIZEINIT,
00095 bool maxPrSizeBin = false,
00096 unsigned int minPrSize = 0);
00097
00099 virtual Gecode::Actor* copy(Gecode::Space* home, bool share);
00100
00102 virtual Gecode::PropCost cost(void) const;
00103
00105 virtual Gecode::ExecStatus propagate(Gecode::Space* home);
00106
00107 };
00108
00109 }
00110 }
00111
00112 #endif