Generated on Tue Jul 27 2010 21:59:12 for Gecode by doxygen 1.7.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: 2010-06-29 10:39:13 +0200 (Tue, 29 Jun 2010) $ by $Author: schulte $
00011  *     $Revision: 11118 $
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<IntVarImp>(y.varimp()) {}
00049   forceinline
00050   IntView::IntView(IntVarImp* y)
00051     : VarImpView<IntVarImp>(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     Iter::Ranges::IsRangeIter<I>();
00177     return x->narrow_r(home,i,depend);
00178   }
00179   template<class I>
00180   forceinline ModEvent
00181   IntView::inter_r(Space& home, I& i, bool depend) {
00182     Iter::Ranges::IsRangeIter<I>();
00183     return x->inter_r(home,i,depend);
00184   }
00185   template<class I>
00186   forceinline ModEvent
00187   IntView::minus_r(Space& home, I& i, bool depend) {
00188     Iter::Ranges::IsRangeIter<I>();
00189     return x->minus_r(home,i,depend);
00190   }
00191   template<class I>
00192   forceinline ModEvent
00193   IntView::narrow_v(Space& home, I& i, bool depend) {
00194     Iter::Values::IsValueIter<I>();
00195     return x->narrow_v(home,i,depend);
00196   }
00197   template<class I>
00198   forceinline ModEvent
00199   IntView::inter_v(Space& home, I& i, bool depend) {
00200     Iter::Values::IsValueIter<I>();
00201     return x->inter_v(home,i,depend);
00202   }
00203   template<class I>
00204   forceinline ModEvent
00205   IntView::minus_v(Space& home, I& i, bool depend) {
00206     Iter::Values::IsValueIter<I>();
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 bool
00226   IntView::any(const Delta& d) const {
00227     return IntVarImp::any(d);
00228   }
00229 
00230 
00231   forceinline ModEventDelta
00232   IntView::med(ModEvent me) {
00233     return VarImpView<IntVarImp>::med(me);
00234   }
00235 
00236 
00241   template<>
00242   class ViewRanges<IntView> : public IntVarImpFwd {
00243   public:
00245 
00246 
00247     ViewRanges(void);
00249     ViewRanges(const IntView& x);
00251     void init(const IntView& x);
00253   };
00254 
00255   forceinline
00256   ViewRanges<IntView>::ViewRanges(void) {}
00257 
00258   forceinline
00259   ViewRanges<IntView>::ViewRanges(const IntView& x)
00260     : IntVarImpFwd(x.varimp()) {}
00261 
00262   forceinline void
00263   ViewRanges<IntView>::init(const IntView& x) {
00264     IntVarImpFwd::init(x.varimp());
00265   }
00266 
00267 }}
00268 
00269 // STATISTICS: int-var
00270