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 #include <sstream>
00039
00040 namespace Gecode { namespace Set {
00041
00042 template<class View>
00043 forceinline
00044 CachedView<View>::CachedView(void) {}
00045
00046 template<class View>
00047 forceinline
00048 CachedView<View>::CachedView(const View& y)
00049 : DerivedView<View>(y) {}
00050
00051 template<class View>
00052 forceinline unsigned int
00053 CachedView<View>::glbSize(void) const {
00054 return x.glbSize();
00055 }
00056
00057 template<class View>
00058 forceinline unsigned int
00059 CachedView<View>::lubSize(void) const {
00060 return x.lubSize();
00061 }
00062
00063 template<class View>
00064 forceinline unsigned int
00065 CachedView<View>::unknownSize(void) const {
00066 return x.unknownSize();
00067 }
00068
00069 template<class View>
00070 forceinline bool
00071 CachedView<View>::contains(int n) const { return x.contains(n); }
00072
00073 template<class View>
00074 forceinline bool
00075 CachedView<View>::notContains(int n) const { return x.notContains(n); }
00076
00077 template<class View>
00078 forceinline unsigned int
00079 CachedView<View>::cardMin(void) const {
00080 return x.cardMin();
00081 }
00082
00083 template<class View>
00084 forceinline unsigned int
00085 CachedView<View>::cardMax(void) const {
00086 return x.cardMax();
00087 }
00088
00089 template<class View>
00090 forceinline int
00091 CachedView<View>::lubMin(void) const {
00092 return x.lubMin();
00093 }
00094
00095 template<class View>
00096 forceinline int
00097 CachedView<View>::lubMax(void) const {
00098 return x.lubMax();
00099 }
00100
00101 template<class View>
00102 forceinline int
00103 CachedView<View>::glbMin(void) const {
00104 return x.glbMin();
00105 }
00106
00107 template<class View>
00108 forceinline int
00109 CachedView<View>::glbMax(void) const {
00110 return x.glbMax();
00111 }
00112
00113 template<class View>
00114 forceinline ModEvent
00115 CachedView<View>::cardMin(Space& home, unsigned int m) {
00116 return x.cardMin(home,m);
00117 }
00118
00119 template<class View>
00120 forceinline ModEvent
00121 CachedView<View>::cardMax(Space& home, unsigned int m) {
00122 return x.cardMax(home,m);
00123 }
00124
00125 template<class View>
00126 forceinline ModEvent
00127 CachedView<View>::include(Space& home, int i) {
00128 return x.include(home,i);
00129 }
00130
00131 template<class View>
00132 forceinline ModEvent
00133 CachedView<View>::exclude(Space& home, int i) {
00134 return x.exclude(home,i);
00135 }
00136
00137 template<class View>
00138 forceinline ModEvent
00139 CachedView<View>::intersect(Space& home, int i) {
00140 return x.intersect(home,i);
00141 }
00142
00143 template<class View>
00144 forceinline ModEvent
00145 CachedView<View>::intersect(Space& home, int i, int j) {
00146 return x.intersect(home,i,j);
00147 }
00148
00149 template<class View>
00150 forceinline ModEvent
00151 CachedView<View>::include(Space& home, int i, int j) {
00152 return x.include(home,i,j);
00153 }
00154
00155 template<class View>
00156 forceinline ModEvent
00157 CachedView<View>::exclude(Space& home, int i, int j) {
00158 return x.exclude(home,i,j);
00159 }
00160
00161 template<class View>
00162 template<class I> ModEvent
00163 CachedView<View>::excludeI(Space& home,I& iter) {
00164 return x.excludeI(home,iter);
00165 }
00166
00167 template<class View>
00168 template<class I> ModEvent
00169 CachedView<View>::includeI(Space& home,I& iter) {
00170 return x.includeI(home,iter);
00171 }
00172
00173 template<class View>
00174 template<class I> ModEvent
00175 CachedView<View>::intersectI(Space& home,I& iter) {
00176 return x.intersectI(home,iter);
00177 }
00178
00179 template<class View>
00180 forceinline void
00181 CachedView<View>::subscribe(Space& home, Propagator& p, PropCond pc,
00182 bool schedule) {
00183 x.subscribe(home,p,pc,schedule);
00184 }
00185
00186 template<class View>
00187 forceinline void
00188 CachedView<View>::cancel(Space& home, Propagator& p, PropCond pc) {
00189 x.cancel(home,p,pc);
00190 }
00191
00192 template<class View>
00193 forceinline void
00194 CachedView<View>::subscribe(Space& home, Advisor& a) {
00195 x.subscribe(home,a);
00196 }
00197
00198 template<class View>
00199 forceinline void
00200 CachedView<View>::cancel(Space& home, Advisor& a) {
00201 x.cancel(home,a);
00202 }
00203
00204 template<class View>
00205 forceinline void
00206 CachedView<View>::schedule(Space& home, Propagator& p, ModEvent me) {
00207 return View::schedule(home,p,me);
00208 }
00209 template<class View>
00210 forceinline ModEvent
00211 CachedView<View>::me(const ModEventDelta& med) {
00212 return View::me(med);
00213 }
00214
00215 template<class View>
00216 forceinline ModEventDelta
00217 CachedView<View>::med(ModEvent me) {
00218 return View::med(me);
00219 }
00220
00221
00222
00223
00224
00225
00226 template<class View>
00227 forceinline ModEvent
00228 CachedView<View>::modevent(const Delta& d) {
00229 return View::modevent(d);
00230 }
00231
00232 template<class View>
00233 forceinline int
00234 CachedView<View>::glbMin(const Delta& d) const {
00235 return x.glbMin(d);
00236 }
00237
00238 template<class View>
00239 forceinline int
00240 CachedView<View>::glbMax(const Delta& d) const {
00241 return x.glbMax(d);
00242 }
00243
00244 template<class View>
00245 forceinline bool
00246 CachedView<View>::glbAny(const Delta& d) const {
00247 return x.glbAny(d);
00248 }
00249
00250 template<class View>
00251 forceinline int
00252 CachedView<View>::lubMin(const Delta& d) const {
00253 return x.lubMin(d);
00254 }
00255
00256 template<class View>
00257 forceinline int
00258 CachedView<View>::lubMax(const Delta& d) const {
00259 return x.lubMax(d);
00260 }
00261
00262 template<class View>
00263 forceinline bool
00264 CachedView<View>::lubAny(const Delta& d) const {
00265 return x.lubAny(d);
00266 }
00267
00268 template<class View>
00269 forceinline void
00270 CachedView<View>::update(Space& home, bool share, CachedView<View>& y) {
00271 lubCache.update(home,y.lubCache);
00272 glbCache.update(home,y.glbCache);
00273 DerivedView<View>::update(home,share,y);
00274 }
00275
00276
00277
00278
00279
00280 template<class View>
00281 void
00282 CachedView<View>::initCache(Space& home,
00283 const IntSet& glb, const IntSet& lub) {
00284 glbCache.init(home);
00285 IntSetRanges gr(glb);
00286 glbCache.includeI(home,gr);
00287 lubCache.init(home);
00288 IntSetRanges lr(lub);
00289 lubCache.intersectI(home,lr);
00290 }
00291
00292 template<class View>
00293 forceinline void
00294 CachedView<View>::cacheGlb(Space& home) {
00295 GlbRanges<View> gr(DerivedView<View>::base());
00296 glbCache.includeI(home,gr);
00297 }
00298
00299 template<class View>
00300 forceinline void
00301 CachedView<View>::cacheLub(Space& home) {
00302 LubRanges<View> lr(DerivedView<View>::base());
00303 lubCache.intersectI(home,lr);
00304 }
00305
00306 template<class View>
00307 forceinline bool
00308 CachedView<View>::glbModified(void) const {
00309 return glbCache.size() != glbSize();
00310 }
00311
00312 template<class View>
00313 forceinline bool
00314 CachedView<View>::lubModified(void) const {
00315 return lubCache.size() != lubSize();
00316 }
00317
00322 template<class View>
00323 class LubRanges<CachedView<View> > : public LubRanges<View> {
00324 public:
00326
00327
00328 LubRanges(void) {}
00330 LubRanges(const CachedView<View>& x);
00332 void init(const CachedView<View>& x);
00334 };
00335
00336 template<class View>
00337 forceinline
00338 LubRanges<CachedView<View> >::LubRanges(const CachedView<View>& s)
00339 : LubRanges<View>(s.base()) {}
00340
00341 template<class View>
00342 forceinline void
00343 LubRanges<CachedView<View> >::init(const CachedView<View>& s) {
00344 LubRanges<View>::init(s.base());
00345 }
00346
00351 template<class View>
00352 class GlbRanges<CachedView<View> > : public GlbRanges<View> {
00353 public:
00355
00356
00357 GlbRanges(void) {}
00359 GlbRanges(const CachedView<View> & x);
00361 void init(const CachedView<View> & x);
00363 };
00364
00365 template<class View>
00366 forceinline
00367 GlbRanges<CachedView<View> >::GlbRanges(const CachedView<View> & s)
00368 : GlbRanges<View>(s.base()) {}
00369
00370 template<class View>
00371 forceinline void
00372 GlbRanges<CachedView<View> >::init(const CachedView<View> & s) {
00373 GlbRanges<View>::init(s.base());
00374 }
00375
00376 template<class Char, class Traits, class View>
00377 std::basic_ostream<Char,Traits>&
00378 operator <<(std::basic_ostream<Char,Traits>& os,
00379 const CachedView<View>& x) {
00380 return os << x.base();
00381 }
00382
00383 template<class View>
00384 forceinline
00385 GlbDiffRanges<View>::GlbDiffRanges(const CachedView<View>& x)
00386 : gr(x.base()), cr(x.glbCache) {
00387 Iter::Ranges::Diff<GlbRanges<View>,BndSetRanges>::init(gr,cr);
00388 }
00389
00390 template<class View>
00391 forceinline
00392 LubDiffRanges<View>::LubDiffRanges(const CachedView<View>& x)
00393 : cr(x.lubCache), lr(x.base()) {
00394 Iter::Ranges::Diff<BndSetRanges,LubRanges<View> >::init(cr,lr);
00395 }
00396
00397 }}
00398
00399