set.hpp
Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 00002 /* 00003 * Main authors: 00004 * Guido Tack <tack@gecode.org> 00005 * 00006 * Contributing authors: 00007 * Christian Schulte <schulte@gecode.org> 00008 * Gabor Szokoli <szokoli@gecode.org> 00009 * 00010 * Copyright: 00011 * Guido Tack, 2004 00012 * Christian Schulte, 2004 00013 * Gabor Szokoli, 2004 00014 * 00015 * Last modified: 00016 * $Date: 2010-08-31 17:19:33 +0200 (Tue, 31 Aug 2010) $ by $Author: schulte $ 00017 * $Revision: 11368 $ 00018 * 00019 * This file is part of Gecode, the generic constraint 00020 * development environment: 00021 * http://www.gecode.org 00022 * 00023 * Permission is hereby granted, free of charge, to any person obtaining 00024 * a copy of this software and associated documentation files (the 00025 * "Software"), to deal in the Software without restriction, including 00026 * without limitation the rights to use, copy, modify, merge, publish, 00027 * distribute, sublicense, and/or sell copies of the Software, and to 00028 * permit persons to whom the Software is furnished to do so, subject to 00029 * the following conditions: 00030 * 00031 * The above copyright notice and this permission notice shall be 00032 * included in all copies or substantial portions of the Software. 00033 * 00034 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00035 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00036 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00037 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00038 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00039 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00040 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00041 * 00042 */ 00043 00044 namespace Gecode { namespace Set { 00045 00046 /* 00047 * Constructors and access 00048 * 00049 */ 00050 00051 forceinline 00052 SetView::SetView(void) {} 00053 forceinline 00054 SetView::SetView(const SetVar& y) 00055 : VarImpView<SetVar>(y.varimp()) {} 00056 forceinline 00057 SetView::SetView(SetVarImp* y) 00058 : VarImpView<SetVar>(y) {} 00059 00060 /* 00061 * Variable information 00062 * 00063 */ 00064 00065 forceinline unsigned int 00066 SetView::glbSize(void) const { 00067 return x->glbSize(); 00068 } 00069 forceinline unsigned int 00070 SetView::lubSize(void) const { 00071 return x->lubSize(); 00072 } 00073 forceinline unsigned int 00074 SetView::unknownSize(void) const { 00075 return x->lubSize() - x->glbSize(); 00076 } 00077 forceinline bool 00078 SetView::contains(int i) const { 00079 return x->knownIn(i); 00080 } 00081 forceinline bool 00082 SetView::notContains(int i) const { 00083 return x->knownOut(i); 00084 } 00085 forceinline unsigned int 00086 SetView::cardMin(void) const { 00087 return x->cardMin(); 00088 } 00089 forceinline unsigned int 00090 SetView::cardMax(void) const { 00091 return x->cardMax(); 00092 } 00093 forceinline int 00094 SetView::lubMin(void) const { 00095 return x->lubMin(); 00096 } 00097 forceinline int 00098 SetView::lubMax(void) const { 00099 return x->lubMax(); 00100 } 00101 forceinline int 00102 SetView::lubMinN(unsigned int n) const { 00103 return x->lubMinN(n); 00104 } 00105 forceinline int 00106 SetView::glbMin(void) const { 00107 return x->glbMin(); 00108 } 00109 forceinline int 00110 SetView::glbMax(void) const { 00111 return x->glbMax(); 00112 } 00113 00114 /* 00115 * Tells 00116 * 00117 */ 00118 00119 forceinline ModEvent 00120 SetView::cardMin(Space& home, unsigned int m) { 00121 return x->cardMin(home, m); 00122 } 00123 00124 forceinline ModEvent 00125 SetView::cardMax(Space& home, unsigned int m) { 00126 return x->cardMax(home, m); 00127 } 00128 00129 forceinline ModEvent 00130 SetView::include (Space& home, int from, int to) { 00131 return x->include(home,from,to); 00132 } 00133 00134 forceinline ModEvent 00135 SetView::include (Space& home, int n) { 00136 return x->include(home,n); 00137 } 00138 00139 forceinline ModEvent 00140 SetView::exclude (Space& home, int n) { 00141 return x->exclude(home, n); 00142 } 00143 00144 forceinline ModEvent 00145 SetView::intersect (Space& home, int from, int to) { 00146 return x->intersect(home,from,to); 00147 } 00148 00149 forceinline ModEvent 00150 SetView::intersect (Space& home, int n) { 00151 return x->intersect(home,n); 00152 } 00153 00154 template<class I> ModEvent 00155 SetView::includeI (Space& home, I& iter) { 00156 return x->includeI(home, iter); 00157 } 00158 00159 forceinline ModEvent 00160 SetView::exclude (Space& home, int from, int to) { 00161 return x->exclude(home,from,to); 00162 } 00163 template<class I> ModEvent 00164 SetView::excludeI(Space& home, I& iter) { 00165 return x->excludeI(home, iter); 00166 } 00167 template<class I> ModEvent 00168 SetView::intersectI(Space& home, I& iter) { 00169 return x->intersectI(home, iter); 00170 } 00171 00172 00173 /* 00174 * Delta information for advisors 00175 * 00176 */ 00177 00178 forceinline ModEvent 00179 SetView::modevent(const Delta& d) { return SetVarImp::modevent(d); } 00180 00181 forceinline int 00182 SetView::glbMin(const Delta& d) const { return SetVarImp::glbMin(d); } 00183 00184 forceinline int 00185 SetView::glbMax(const Delta& d) const { return SetVarImp::glbMax(d); } 00186 00187 forceinline bool 00188 SetView::glbAny(const Delta& d) const { return SetVarImp::glbAny(d); } 00189 00190 forceinline int 00191 SetView::lubMin(const Delta& d) const { return SetVarImp::lubMin(d); } 00192 00193 forceinline int 00194 SetView::lubMax(const Delta& d) const { return SetVarImp::lubMax(d); } 00195 00196 forceinline bool 00197 SetView::lubAny(const Delta& d) const { return SetVarImp::lubAny(d); } 00198 00199 00204 template<> 00205 class LubRanges<SetView> : public LubRanges<SetVarImp*> { 00206 public: 00208 00209 00210 LubRanges(void); 00212 LubRanges(const SetView& x); 00214 void init(const SetView& x); 00216 }; 00217 00218 forceinline 00219 LubRanges<SetView>::LubRanges(void) {} 00220 00221 forceinline 00222 LubRanges<SetView>::LubRanges(const SetView& x) 00223 : LubRanges<SetVarImp*>(x.varimp()) {} 00224 00225 forceinline void 00226 LubRanges<SetView>::init(const SetView& x) { 00227 LubRanges<SetVarImp*>::init(x.varimp()); 00228 } 00229 00230 00235 template<> 00236 class GlbRanges<SetView> : public GlbRanges<SetVarImp*> { 00237 public: 00239 00240 00241 GlbRanges(void); 00243 GlbRanges(const SetView& x); 00245 void init(const SetView& x); 00246 }; 00247 00248 forceinline 00249 GlbRanges<SetView>::GlbRanges(void) {} 00250 00251 forceinline 00252 GlbRanges<SetView>::GlbRanges(const SetView& x) 00253 : GlbRanges<SetVarImp*>(x.varimp()) {} 00254 00255 forceinline void 00256 GlbRanges<SetView>::init(const SetView& x) { 00257 GlbRanges<SetVarImp*>::init(x.varimp()); 00258 } 00259 00260 }} 00261 00262 // STATISTICS: set-var 00263