Generated on Mon Nov 30 23:53:24 2009 for Gecode by doxygen 1.6.1

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: 2009-09-08 21:10:29 +0200 (Tue, 08 Sep 2009) $ by $Author: schulte $
00011  *     $Revision: 9692 $
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& x)
00048     : VarViewBase<IntVarImp>(x.var()) {}
00049   forceinline
00050   IntView::IntView(IntVarImp* x)
00051     : VarViewBase<IntVarImp>(x) {}
00052 
00053   /*
00054    * Value access
00055    *
00056    */
00057   forceinline int
00058   IntView::min(void) const {
00059     return varimp->min();
00060   }
00061   forceinline int
00062   IntView::max(void) const {
00063     return varimp->max();
00064   }
00065   forceinline int
00066   IntView::med(void) const {
00067     return varimp->med();
00068   }
00069   forceinline int
00070   IntView::val(void) const {
00071     return varimp->val();
00072   }
00073 
00074   forceinline unsigned int
00075   IntView::size(void) const {
00076     return varimp->size();
00077   }
00078   forceinline unsigned int
00079   IntView::width(void) const {
00080     return varimp->width();
00081   }
00082   forceinline unsigned int
00083   IntView::regret_min(void) const {
00084     return varimp->regret_min();
00085   }
00086   forceinline unsigned int
00087   IntView::regret_max(void) const {
00088     return varimp->regret_max();
00089   }
00090 
00091 
00092   /*
00093    * Domain tests
00094    *
00095    */
00096   forceinline bool
00097   IntView::range(void) const {
00098     return varimp->range();
00099   }
00100   forceinline bool
00101   IntView::assigned(void) const {
00102     return varimp->assigned();
00103   }
00104 
00105   forceinline bool
00106   IntView::in(int n) const {
00107     return varimp->in(n);
00108   }
00109   forceinline bool
00110   IntView::in(double n) const {
00111     return varimp->in(n);
00112   }
00113 
00114 
00115   /*
00116    * Domain update by value
00117    *
00118    */
00119   forceinline ModEvent
00120   IntView::lq(Space& home, int n) {
00121     return varimp->lq(home,n);
00122   }
00123   forceinline ModEvent
00124   IntView::lq(Space& home, double n) {
00125     return varimp->lq(home,n);
00126   }
00127 
00128   forceinline ModEvent
00129   IntView::le(Space& home, int n) {
00130     return varimp->lq(home,n-1);
00131   }
00132   forceinline ModEvent
00133   IntView::le(Space& home, double n) {
00134     return lq(home,n-1.0);
00135   }
00136 
00137   forceinline ModEvent
00138   IntView::gq(Space& home, int n) {
00139     return varimp->gq(home,n);
00140   }
00141   forceinline ModEvent
00142   IntView::gq(Space& home, double n) {
00143     return varimp->gq(home,n);
00144   }
00145 
00146   forceinline ModEvent
00147   IntView::gr(Space& home, int n) {
00148     return varimp->gq(home,n+1);
00149   }
00150   forceinline ModEvent
00151   IntView::gr(Space& home, double n) {
00152     return gq(home,n+1.0);
00153   }
00154 
00155   forceinline ModEvent
00156   IntView::nq(Space& home, int n) {
00157     return varimp->nq(home,n);
00158   }
00159   forceinline ModEvent
00160   IntView::nq(Space& home, double n) {
00161     return varimp->nq(home,n);
00162   }
00163 
00164   forceinline ModEvent
00165   IntView::eq(Space& home, int n) {
00166     return varimp->eq(home,n);
00167   }
00168   forceinline ModEvent
00169   IntView::eq(Space& home, double n) {
00170     return varimp->eq(home,n);
00171   }
00172 
00173 
00174   /*
00175    * Iterator-based domain update
00176    *
00177    */
00178   template<class I>
00179   forceinline ModEvent
00180   IntView::narrow_r(Space& home, I& i, bool depend) {
00181     Iter::Ranges::IsRangeIter<I>();
00182     return varimp->narrow_r(home,i,depend);
00183   }
00184   template<class I>
00185   forceinline ModEvent
00186   IntView::inter_r(Space& home, I& i, bool depend) {
00187     Iter::Ranges::IsRangeIter<I>();
00188     return varimp->inter_r(home,i,depend);
00189   }
00190   template<class I>
00191   forceinline ModEvent
00192   IntView::minus_r(Space& home, I& i, bool depend) {
00193     Iter::Ranges::IsRangeIter<I>();
00194     return varimp->minus_r(home,i,depend);
00195   }
00196   template<class I>
00197   forceinline ModEvent
00198   IntView::narrow_v(Space& home, I& i, bool depend) {
00199     Iter::Values::IsValueIter<I>();
00200     return varimp->narrow_v(home,i,depend);
00201   }
00202   template<class I>
00203   forceinline ModEvent
00204   IntView::inter_v(Space& home, I& i, bool depend) {
00205     Iter::Values::IsValueIter<I>();
00206     return varimp->inter_v(home,i,depend);
00207   }
00208   template<class I>
00209   forceinline ModEvent
00210   IntView::minus_v(Space& home, I& i, bool depend) {
00211     Iter::Values::IsValueIter<I>();
00212     return varimp->minus_v(home,i,depend);
00213   }
00214 
00215 
00216 
00217 
00218   /*
00219    * Delta information for advisors
00220    *
00221    */
00222   forceinline ModEvent
00223   IntView::modevent(const Delta& d) {
00224     return IntVarImp::modevent(d);
00225   }
00226   forceinline int
00227   IntView::min(const Delta& d) const {
00228     return IntVarImp::min(d);
00229   }
00230   forceinline int
00231   IntView::max(const Delta& d) const {
00232     return IntVarImp::max(d);
00233   }
00234   forceinline bool
00235   IntView::any(const Delta& d) const {
00236     return IntVarImp::any(d);
00237   }
00238 
00239 
00240   forceinline ModEventDelta
00241   IntView::med(ModEvent me) {
00242     return VarViewBase<IntVarImp>::med(me);
00243   }
00244 
00245 
00246 
00247   /*
00248    * Cloning
00249    *
00250    */
00251   forceinline void
00252   IntView::update(Space& home, bool share, IntView& x) {
00253     varimp = x.varimp->copy(home,share);
00254   }
00255 
00256 
00261   template<>
00262   class ViewRanges<IntView> : public IntVarImpFwd {
00263   public:
00265 
00266 
00267     ViewRanges(void);
00269     ViewRanges(const IntView& x);
00271     void init(const IntView& x);
00273   };
00274 
00275   forceinline
00276   ViewRanges<IntView>::ViewRanges(void) {}
00277 
00278   forceinline
00279   ViewRanges<IntView>::ViewRanges(const IntView& x)
00280     : IntVarImpFwd(x.var()) {}
00281 
00282   forceinline void
00283   ViewRanges<IntView>::init(const IntView& x) {
00284     IntVarImpFwd::init(x.var());
00285   }
00286 
00287 }}
00288 
00289 // STATISTICS: int-var
00290