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

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