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