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

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  *  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   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 #ifdef GECODE_HAS_CBS
00074   forceinline int
00075   IntView::baseval(int val) const {
00076     return val;
00077   }
00078 #endif
00079 
00080   forceinline unsigned int
00081   IntView::size(void) const {
00082     return x->size();
00083   }
00084   forceinline unsigned int
00085   IntView::width(void) const {
00086     return x->width();
00087   }
00088   forceinline unsigned int
00089   IntView::regret_min(void) const {
00090     return x->regret_min();
00091   }
00092   forceinline unsigned int
00093   IntView::regret_max(void) const {
00094     return x->regret_max();
00095   }
00096 
00097 
00098   /*
00099    * Domain tests
00100    *
00101    */
00102   forceinline bool
00103   IntView::range(void) const {
00104     return x->range();
00105   }
00106   forceinline bool
00107   IntView::in(int n) const {
00108     return x->in(n);
00109   }
00110   forceinline bool
00111   IntView::in(long long int n) const {
00112     return x->in(n);
00113   }
00114 
00115 
00116   /*
00117    * Domain update by value
00118    *
00119    */
00120   forceinline ModEvent
00121   IntView::lq(Space& home, int n) {
00122     return x->lq(home,n);
00123   }
00124   forceinline ModEvent
00125   IntView::lq(Space& home, long long int n) {
00126     return x->lq(home,n);
00127   }
00128 
00129   forceinline ModEvent
00130   IntView::le(Space& home, int n) {
00131     return x->lq(home,n-1);
00132   }
00133   forceinline ModEvent
00134   IntView::le(Space& home, long long int n) {
00135     return x->lq(home,n-1);
00136   }
00137 
00138   forceinline ModEvent
00139   IntView::gq(Space& home, int n) {
00140     return x->gq(home,n);
00141   }
00142   forceinline ModEvent
00143   IntView::gq(Space& home, long long int n) {
00144     return x->gq(home,n);
00145   }
00146 
00147   forceinline ModEvent
00148   IntView::gr(Space& home, int n) {
00149     return x->gq(home,n+1);
00150   }
00151   forceinline ModEvent
00152   IntView::gr(Space& home, long long int n) {
00153     return x->gq(home,n+1);
00154   }
00155 
00156   forceinline ModEvent
00157   IntView::nq(Space& home, int n) {
00158     return x->nq(home,n);
00159   }
00160   forceinline ModEvent
00161   IntView::nq(Space& home, long long int n) {
00162     return x->nq(home,n);
00163   }
00164 
00165   forceinline ModEvent
00166   IntView::eq(Space& home, int n) {
00167     return x->eq(home,n);
00168   }
00169   forceinline ModEvent
00170   IntView::eq(Space& home, long long int n) {
00171     return x->eq(home,n);
00172   }
00173 
00174 
00175   /*
00176    * Iterator-based domain update
00177    *
00178    */
00179   template<class I>
00180   forceinline ModEvent
00181   IntView::narrow_r(Space& home, I& i, bool depend) {
00182     return x->narrow_r(home,i,depend);
00183   }
00184   template<class I>
00185   forceinline ModEvent
00186   IntView::inter_r(Space& home, I& i, bool depend) {
00187     return x->inter_r(home,i,depend);
00188   }
00189   template<class I>
00190   forceinline ModEvent
00191   IntView::minus_r(Space& home, I& i, bool depend) {
00192     return x->minus_r(home,i,depend);
00193   }
00194   template<class I>
00195   forceinline ModEvent
00196   IntView::narrow_v(Space& home, I& i, bool depend) {
00197     return x->narrow_v(home,i,depend);
00198   }
00199   template<class I>
00200   forceinline ModEvent
00201   IntView::inter_v(Space& home, I& i, bool depend) {
00202     return x->inter_v(home,i,depend);
00203   }
00204   template<class I>
00205   forceinline ModEvent
00206   IntView::minus_v(Space& home, I& i, bool depend) {
00207     return x->minus_v(home,i,depend);
00208   }
00209 
00210 
00211 
00212 
00213   /*
00214    * Delta information for advisors
00215    *
00216    */
00217   forceinline int
00218   IntView::min(const Delta& d) const {
00219     return IntVarImp::min(d);
00220   }
00221   forceinline int
00222   IntView::max(const Delta& d) const {
00223     return IntVarImp::max(d);
00224   }
00225   forceinline unsigned int
00226   IntView::width(const Delta& d) const {
00227     return IntVarImp::width(d);
00228   }
00229   forceinline bool
00230   IntView::any(const Delta& d) const {
00231     return IntVarImp::any(d);
00232   }
00233 
00234 
00235   forceinline ModEventDelta
00236   IntView::med(ModEvent me) {
00237     return VarImpView<IntVar>::med(me);
00238   }
00239 
00240 
00245   template<>
00246   class ViewRanges<IntView> : public IntVarImpFwd {
00247   public:
00249 
00250 
00251     ViewRanges(void);
00253     ViewRanges(const IntView& x);
00255     void init(const IntView& x);
00257   };
00258 
00259   forceinline
00260   ViewRanges<IntView>::ViewRanges(void) {}
00261 
00262   forceinline
00263   ViewRanges<IntView>::ViewRanges(const IntView& x)
00264     : IntVarImpFwd(x.varimp()) {}
00265 
00266   forceinline void
00267   ViewRanges<IntView>::init(const IntView& x) {
00268     IntVarImpFwd::init(x.varimp());
00269   }
00270 
00271 }}
00272 
00273 // STATISTICS: int-var
00274