Generated on Sun Feb 17 15:24:23 2019 for Gecode by doxygen 1.6.3

bool.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  *  Contributing authors:
00007  *     Samuel Gagnon <samuel.gagnon92@gmail.com>
00008  *
00009  *  Copyright:
00010  *     Christian Schulte, 2002
00011  *     Samuel Gagnon, 2018
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   BoolView::BoolView(void) {}
00046   forceinline
00047   BoolView::BoolView(const BoolVar& y)
00048     : VarImpView<BoolVar>(y.varimp()) {}
00049   forceinline
00050   BoolView::BoolView(BoolVarImp* y)
00051     : VarImpView<BoolVar>(y) {}
00052 
00053   /*
00054    * Value access
00055    *
00056    */
00057   forceinline BoolStatus
00058   BoolView::status(void) const {
00059     return x->status();
00060   }
00061   forceinline int
00062   BoolView::min(void) const {
00063     return x->min();
00064   }
00065   forceinline int
00066   BoolView::max(void) const {
00067     return x->max();
00068   }
00069   forceinline int
00070   BoolView::med(void) const {
00071     return x->med();
00072   }
00073   forceinline int
00074   BoolView::val(void) const {
00075     return x->val();
00076   }
00077 #ifdef GECODE_HAS_CBS
00078   forceinline int
00079   BoolView::baseval(int val) const {
00080     return val;
00081   }
00082 #endif
00083 
00084   forceinline unsigned int
00085   BoolView::size(void) const {
00086     return x->size();
00087   }
00088   forceinline unsigned int
00089   BoolView::width(void) const {
00090     return x->width();
00091   }
00092   forceinline unsigned int
00093   BoolView::regret_min(void) const {
00094     return x->regret_min();
00095   }
00096   forceinline unsigned int
00097   BoolView::regret_max(void) const {
00098     return x->regret_max();
00099   }
00100 
00101 
00102   /*
00103    * Domain tests
00104    *
00105    */
00106   forceinline bool
00107   BoolView::range(void) const {
00108     return x->range();
00109   }
00110   forceinline bool
00111   BoolView::in(int n) const {
00112     return x->in(n);
00113   }
00114   forceinline bool
00115   BoolView::in(long long int n) const {
00116     return x->in(n);
00117   }
00118 
00119 
00120   /*
00121    * Domain update by value
00122    *
00123    */
00124   forceinline ModEvent
00125   BoolView::lq(Space& home, int n) {
00126     return x->lq(home,n);
00127   }
00128   forceinline ModEvent
00129   BoolView::lq(Space& home, long long int n) {
00130     return x->lq(home,n);
00131   }
00132 
00133   forceinline ModEvent
00134   BoolView::le(Space& home, int n) {
00135     return x->lq(home,n-1);
00136   }
00137   forceinline ModEvent
00138   BoolView::le(Space& home, long long int n) {
00139     return x->lq(home,n-1);
00140   }
00141 
00142   forceinline ModEvent
00143   BoolView::gq(Space& home, int n) {
00144     return x->gq(home,n);
00145   }
00146   forceinline ModEvent
00147   BoolView::gq(Space& home, long long int n) {
00148     return x->gq(home,n);
00149   }
00150 
00151   forceinline ModEvent
00152   BoolView::gr(Space& home, int n) {
00153     return x->gq(home,n+1);
00154   }
00155   forceinline ModEvent
00156   BoolView::gr(Space& home, long long int n) {
00157     return x->gq(home,n+1);
00158   }
00159 
00160   forceinline ModEvent
00161   BoolView::nq(Space& home, int n) {
00162     return x->nq(home,n);
00163   }
00164   forceinline ModEvent
00165   BoolView::nq(Space& home, long long int n) {
00166     return x->nq(home,n);
00167   }
00168 
00169   forceinline ModEvent
00170   BoolView::eq(Space& home, int n) {
00171     return x->eq(home,n);
00172   }
00173   forceinline ModEvent
00174   BoolView::eq(Space& home, long long int n) {
00175     return x->eq(home,n);
00176   }
00177 
00178 
00179   /*
00180    * Iterator-based domain update
00181    *
00182    */
00183   template<class I>
00184   forceinline ModEvent
00185   BoolView::narrow_r(Space& home, I& i, bool depend) {
00186     return x->narrow_r(home,i,depend);
00187   }
00188   template<class I>
00189   forceinline ModEvent
00190   BoolView::inter_r(Space& home, I& i, bool depend) {
00191     return x->inter_r(home,i,depend);
00192   }
00193   template<class I>
00194   forceinline ModEvent
00195   BoolView::minus_r(Space& home, I& i, bool depend) {
00196     return x->minus_r(home,i,depend);
00197   }
00198   template<class I>
00199   forceinline ModEvent
00200   BoolView::narrow_v(Space& home, I& i, bool depend) {
00201     return x->narrow_v(home,i,depend);
00202   }
00203   template<class I>
00204   forceinline ModEvent
00205   BoolView::inter_v(Space& home, I& i, bool depend) {
00206     return x->inter_v(home,i,depend);
00207   }
00208   template<class I>
00209   forceinline ModEvent
00210   BoolView::minus_v(Space& home, I& i, bool depend) {
00211     return x->minus_v(home,i,depend);
00212   }
00213 
00214 
00215   /*
00216    * Boolean domain tests
00217    *
00218    */
00219   forceinline bool
00220   BoolView::zero(void) const {
00221     return x->zero();
00222   }
00223   forceinline bool
00224   BoolView::one(void) const {
00225     return x->one();
00226   }
00227   forceinline bool
00228   BoolView::none(void) const {
00229     return x->none();
00230   }
00231 
00232 
00233   /*
00234    * Boolean assignment operations
00235    *
00236    */
00237   forceinline ModEvent
00238   BoolView::zero_none(Space& home) {
00239     return x->zero_none(home);
00240   }
00241   forceinline ModEvent
00242   BoolView::one_none(Space& home) {
00243     return x->one_none(home);
00244   }
00245 
00246   forceinline ModEvent
00247   BoolView::zero(Space& home) {
00248     return x->zero(home);
00249   }
00250   forceinline ModEvent
00251   BoolView::one(Space& home) {
00252     return x->one(home);
00253   }
00254 
00255 
00256   /*
00257    * Delta information for advisors
00258    *
00259    */
00260   forceinline int
00261   BoolView::min(const Delta& d) const {
00262     return BoolVarImp::min(d);
00263   }
00264   forceinline int
00265   BoolView::max(const Delta& d) const {
00266     return BoolVarImp::max(d);
00267   }
00268   forceinline unsigned int
00269   BoolView::width(const Delta& d) const {
00270     return BoolVarImp::width(d);
00271   }
00272   forceinline bool
00273   BoolView::any(const Delta& d) const {
00274     return BoolVarImp::any(d);
00275   }
00276   forceinline bool
00277   BoolView::zero(const Delta& d) {
00278     return BoolVarImp::zero(d);
00279   }
00280   forceinline bool
00281   BoolView::one(const Delta& d) {
00282     return BoolVarImp::one(d);
00283   }
00284 
00285 
00286 
00287   forceinline ModEventDelta
00288   BoolView::med(ModEvent me) {
00289     return VarImpView<BoolVar>::med(me);
00290   }
00291 
00296   template<>
00297   class ViewRanges<BoolView> : public Iter::Ranges::Singleton {
00298   public:
00300 
00301 
00302     ViewRanges(void);
00304     ViewRanges(const BoolView& x);
00306     void init(const BoolView& x);
00308   };
00309 
00310   forceinline
00311   ViewRanges<BoolView>::ViewRanges(void) {}
00312 
00313   forceinline
00314   ViewRanges<BoolView>::ViewRanges(const BoolView& x)
00315     : Iter::Ranges::Singleton(x.min(),x.max()) {}
00316 
00317   forceinline void
00318   ViewRanges<BoolView>::init(const BoolView& x) {
00319     Iter::Ranges::Singleton::init(x.min(),x.max());
00320   }
00321 
00322 }}
00323 
00324 // STATISTICS: int-var