this repo has no description
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2/* 3 * Main authors: 4 * Christian Schulte <schulte@gecode.org> 5 * 6 * Contributing authors: 7 * Samuel Gagnon <samuel.gagnon92@gmail.com> 8 * 9 * Copyright: 10 * Christian Schulte, 2002 11 * Samuel Gagnon, 2018 12 * 13 * This file is part of Gecode, the generic constraint 14 * development environment: 15 * http://www.gecode.org 16 * 17 * Permission is hereby granted, free of charge, to any person obtaining 18 * a copy of this software and associated documentation files (the 19 * "Software"), to deal in the Software without restriction, including 20 * without limitation the rights to use, copy, modify, merge, publish, 21 * distribute, sublicense, and/or sell copies of the Software, and to 22 * permit persons to whom the Software is furnished to do so, subject to 23 * the following conditions: 24 * 25 * The above copyright notice and this permission notice shall be 26 * included in all copies or substantial portions of the Software. 27 * 28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 29 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 31 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 32 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 33 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 34 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 35 * 36 */ 37 38namespace Gecode { namespace Int { 39 40 /* 41 * Constructors and initialization 42 * 43 */ 44 forceinline 45 BoolView::BoolView(void) {} 46 forceinline 47 BoolView::BoolView(const BoolVar& y) 48 : VarImpView<BoolVar>(y.varimp()) {} 49 forceinline 50 BoolView::BoolView(BoolVarImp* y) 51 : VarImpView<BoolVar>(y) {} 52 53 /* 54 * Value access 55 * 56 */ 57 forceinline BoolStatus 58 BoolView::status(void) const { 59 return x->status(); 60 } 61 forceinline int 62 BoolView::min(void) const { 63 return x->min(); 64 } 65 forceinline int 66 BoolView::max(void) const { 67 return x->max(); 68 } 69 forceinline int 70 BoolView::med(void) const { 71 return x->med(); 72 } 73 forceinline int 74 BoolView::val(void) const { 75 return x->val(); 76 } 77#ifdef GECODE_HAS_CBS 78 forceinline int 79 BoolView::baseval(int val) const { 80 return val; 81 } 82#endif 83 84 forceinline unsigned int 85 BoolView::size(void) const { 86 return x->size(); 87 } 88 forceinline unsigned int 89 BoolView::width(void) const { 90 return x->width(); 91 } 92 forceinline unsigned int 93 BoolView::regret_min(void) const { 94 return x->regret_min(); 95 } 96 forceinline unsigned int 97 BoolView::regret_max(void) const { 98 return x->regret_max(); 99 } 100 101 102 /* 103 * Domain tests 104 * 105 */ 106 forceinline bool 107 BoolView::range(void) const { 108 return x->range(); 109 } 110 forceinline bool 111 BoolView::in(int n) const { 112 return x->in(n); 113 } 114 forceinline bool 115 BoolView::in(long long int n) const { 116 return x->in(n); 117 } 118 119 120 /* 121 * Domain update by value 122 * 123 */ 124 forceinline ModEvent 125 BoolView::lq(Space& home, int n) { 126 return x->lq(home,n); 127 } 128 forceinline ModEvent 129 BoolView::lq(Space& home, long long int n) { 130 return x->lq(home,n); 131 } 132 133 forceinline ModEvent 134 BoolView::le(Space& home, int n) { 135 return x->lq(home,n-1); 136 } 137 forceinline ModEvent 138 BoolView::le(Space& home, long long int n) { 139 return x->lq(home,n-1); 140 } 141 142 forceinline ModEvent 143 BoolView::gq(Space& home, int n) { 144 return x->gq(home,n); 145 } 146 forceinline ModEvent 147 BoolView::gq(Space& home, long long int n) { 148 return x->gq(home,n); 149 } 150 151 forceinline ModEvent 152 BoolView::gr(Space& home, int n) { 153 return x->gq(home,n+1); 154 } 155 forceinline ModEvent 156 BoolView::gr(Space& home, long long int n) { 157 return x->gq(home,n+1); 158 } 159 160 forceinline ModEvent 161 BoolView::nq(Space& home, int n) { 162 return x->nq(home,n); 163 } 164 forceinline ModEvent 165 BoolView::nq(Space& home, long long int n) { 166 return x->nq(home,n); 167 } 168 169 forceinline ModEvent 170 BoolView::eq(Space& home, int n) { 171 return x->eq(home,n); 172 } 173 forceinline ModEvent 174 BoolView::eq(Space& home, long long int n) { 175 return x->eq(home,n); 176 } 177 178 179 /* 180 * Iterator-based domain update 181 * 182 */ 183 template<class I> 184 forceinline ModEvent 185 BoolView::narrow_r(Space& home, I& i, bool depend) { 186 return x->narrow_r(home,i,depend); 187 } 188 template<class I> 189 forceinline ModEvent 190 BoolView::inter_r(Space& home, I& i, bool depend) { 191 return x->inter_r(home,i,depend); 192 } 193 template<class I> 194 forceinline ModEvent 195 BoolView::minus_r(Space& home, I& i, bool depend) { 196 return x->minus_r(home,i,depend); 197 } 198 template<class I> 199 forceinline ModEvent 200 BoolView::narrow_v(Space& home, I& i, bool depend) { 201 return x->narrow_v(home,i,depend); 202 } 203 template<class I> 204 forceinline ModEvent 205 BoolView::inter_v(Space& home, I& i, bool depend) { 206 return x->inter_v(home,i,depend); 207 } 208 template<class I> 209 forceinline ModEvent 210 BoolView::minus_v(Space& home, I& i, bool depend) { 211 return x->minus_v(home,i,depend); 212 } 213 214 215 /* 216 * Boolean domain tests 217 * 218 */ 219 forceinline bool 220 BoolView::zero(void) const { 221 return x->zero(); 222 } 223 forceinline bool 224 BoolView::one(void) const { 225 return x->one(); 226 } 227 forceinline bool 228 BoolView::none(void) const { 229 return x->none(); 230 } 231 232 233 /* 234 * Boolean assignment operations 235 * 236 */ 237 forceinline ModEvent 238 BoolView::zero_none(Space& home) { 239 return x->zero_none(home); 240 } 241 forceinline ModEvent 242 BoolView::one_none(Space& home) { 243 return x->one_none(home); 244 } 245 246 forceinline ModEvent 247 BoolView::zero(Space& home) { 248 return x->zero(home); 249 } 250 forceinline ModEvent 251 BoolView::one(Space& home) { 252 return x->one(home); 253 } 254 255 256 /* 257 * Delta information for advisors 258 * 259 */ 260 forceinline int 261 BoolView::min(const Delta& d) const { 262 return BoolVarImp::min(d); 263 } 264 forceinline int 265 BoolView::max(const Delta& d) const { 266 return BoolVarImp::max(d); 267 } 268 forceinline unsigned int 269 BoolView::width(const Delta& d) const { 270 return BoolVarImp::width(d); 271 } 272 forceinline bool 273 BoolView::any(const Delta& d) const { 274 return BoolVarImp::any(d); 275 } 276 forceinline bool 277 BoolView::zero(const Delta& d) { 278 return BoolVarImp::zero(d); 279 } 280 forceinline bool 281 BoolView::one(const Delta& d) { 282 return BoolVarImp::one(d); 283 } 284 285 286 287 forceinline ModEventDelta 288 BoolView::med(ModEvent me) { 289 return VarImpView<BoolVar>::med(me); 290 } 291 292 /** 293 * \brief %Range iterator for Boolean variable views 294 * \ingroup TaskActorIntView 295 */ 296 template<> 297 class ViewRanges<BoolView> : public Iter::Ranges::Singleton { 298 public: 299 /// \name Constructors and initialization 300 //@{ 301 /// Default constructor 302 ViewRanges(void); 303 /// Initialize with ranges for view \a x 304 ViewRanges(const BoolView& x); 305 /// Initialize with ranges for view \a x 306 void init(const BoolView& x); 307 //@} 308 }; 309 310 forceinline 311 ViewRanges<BoolView>::ViewRanges(void) {} 312 313 forceinline 314 ViewRanges<BoolView>::ViewRanges(const BoolView& x) 315 : Iter::Ranges::Singleton(x.min(),x.max()) {} 316 317 forceinline void 318 ViewRanges<BoolView>::init(const BoolView& x) { 319 Iter::Ranges::Singleton::init(x.min(),x.max()); 320 } 321 322}} 323 324// STATISTICS: int-var