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