Generated on Thu Mar 22 10:39:37 2012 for Gecode by doxygen 1.6.3

view.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, 2005
00008  *
00009  *  Last modified:
00010  *     $Date: 2011-09-28 14:50:49 +0200 (Wed, 28 Sep 2011) $ by $Author: tack $
00011  *     $Revision: 12418 $
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 #include <iostream>
00039 
00040 #if (-17 / 7) == -2
00041 #define GECODE_INT_RND_TWDS_ZERO 1
00042 #else
00043 #define GECODE_INT_RND_TWDS_ZERO 0
00044 #endif
00045 
00046 namespace Gecode { namespace Int {
00047 
00059   template<class View>
00060   class ViewRanges {
00061   public:
00063 
00064 
00065     ViewRanges(void);
00067     ViewRanges(const View& x);
00069     void init(const View& x);
00071 
00073 
00074 
00075     bool operator ()(void) const;
00077     void operator ++(void);
00079 
00081 
00082 
00083     int min(void) const;
00085     int max(void) const;
00087     unsigned int width(void) const;
00089   };
00090 
00099   template<class View>
00100   class ViewValues : public Iter::Ranges::ToValues<ViewRanges<View> > {
00101   public:
00103 
00104 
00105     ViewValues(void);
00107     ViewValues(const View& x);
00109     void init(const View& x);
00111   };
00112 
00113 }}
00114 
00115 #include <gecode/int/view/iter.hpp>
00116 
00117 namespace Gecode { namespace Int {
00118 
00135   class IntView : public VarImpView<IntVar> {
00136   protected:
00137     using VarImpView<IntVar>::x;
00138   public:
00140 
00141 
00142     IntView(void);
00144     IntView(const IntVar& y);
00146     IntView(IntVarImp* y);
00148     
00150 
00151 
00152     int min(void) const;
00154     int max(void) const;
00156     int med(void) const;
00158     int val(void) const;
00159 
00161     unsigned int size(void) const;
00163     unsigned int width(void) const;
00165     unsigned int regret_min(void) const;
00167     unsigned int regret_max(void) const;
00169     
00171 
00172 
00173     bool range(void) const;
00174     
00176     bool in(int n) const;
00178     bool in(double n) const;
00180     
00182 
00183 
00184     ModEvent lq(Space& home, int n);
00186     ModEvent lq(Space& home, double n);
00187     
00189     ModEvent le(Space& home, int n);
00191     ModEvent le(Space& home, double n);
00192     
00194     ModEvent gq(Space& home, int n);
00196     ModEvent gq(Space& home, double n);
00197     
00199     ModEvent gr(Space& home, int n);
00201     ModEvent gr(Space& home, double n);
00203     ModEvent nq(Space& home, int n);
00205     ModEvent nq(Space& home, double n);
00206 
00208     ModEvent eq(Space& home, int n);
00210     ModEvent eq(Space& home, double n);
00212 
00228 
00229     template<class I>
00230     ModEvent narrow_r(Space& home, I& i, bool depends=true);
00232     template<class I>
00233     ModEvent inter_r(Space& home, I& i, bool depends=true);
00235     template<class I>
00236     ModEvent minus_r(Space& home, I& i, bool depends=true);
00238     template<class I>
00239     ModEvent narrow_v(Space& home, I& i, bool depends=true);
00241     template<class I>
00242     ModEvent inter_v(Space& home, I& i, bool depends=true);
00244     template<class I>
00245     ModEvent minus_v(Space& home, I& i, bool depends=true);
00247 
00249 
00250 
00251     int min(const Delta& d) const;
00253     int max(const Delta& d) const;
00255     bool any(const Delta& d) const;
00257 
00259 
00260 
00261     static ModEventDelta med(ModEvent me);
00263   };
00264 
00269   template<class Char, class Traits>
00270   std::basic_ostream<Char,Traits>&
00271   operator <<(std::basic_ostream<Char,Traits>& os, const IntView& x);
00272   
00273 
00281   class MinusView : public DerivedView<IntView> {
00282   protected:
00283     using DerivedView<IntView>::x;
00284   public:
00286 
00287 
00288     MinusView(void);
00290     explicit MinusView(const IntView& y);
00292     
00294 
00295 
00296     int min(void) const;
00298     int max(void) const;
00300     int med(void) const;
00302     int val(void) const;
00303     
00305     unsigned int size(void) const;
00307     unsigned int width(void) const;
00309     unsigned int regret_min(void) const;
00311     unsigned int regret_max(void) const;
00313     
00315 
00316 
00317     bool range(void) const;
00318     
00320     bool in(int n) const;
00322     bool in(double n) const;
00324     
00326 
00327 
00328     ModEvent lq(Space& home, int n);
00330     ModEvent lq(Space& home, double n);
00332     ModEvent le(Space& home, int n);
00334     ModEvent le(Space& home, double n);
00336     ModEvent gq(Space& home, int n);
00338     ModEvent gq(Space& home, double n);
00340     ModEvent gr(Space& home, int n);
00342     ModEvent gr(Space& home, double n);
00344     ModEvent nq(Space& home, int n);
00346     ModEvent nq(Space& home, double n);
00348     ModEvent eq(Space& home, int n);
00350     ModEvent eq(Space& home, double n);
00352 
00368 
00369     template<class I>
00370     ModEvent narrow_r(Space& home, I& i, bool depends=true);
00372     template<class I>
00373     ModEvent inter_r(Space& home, I& i, bool depends=true);
00375     template<class I>
00376     ModEvent minus_r(Space& home, I& i, bool depends=true);
00378     template<class I>
00379     ModEvent narrow_v(Space& home, I& i, bool depends=true);
00381     template<class I>
00382     ModEvent inter_v(Space& home, I& i, bool depends=true);
00384     template<class I>
00385     ModEvent minus_v(Space& home, I& i, bool depends=true);
00387     
00389 
00390 
00391     static ModEventDelta med(ModEvent me);
00393     
00395 
00396 
00397     int min(const Delta& d) const;
00399     int max(const Delta& d) const;
00401     bool any(const Delta& d) const;
00403   };
00404 
00409   template<class Char, class Traits>
00410   std::basic_ostream<Char,Traits>&
00411   operator <<(std::basic_ostream<Char,Traits>& os, const MinusView& x);
00412 
00413 
00422   class OffsetView : public DerivedView<IntView> {
00423   protected:
00425     int c;
00426     using DerivedView<IntView>::x;
00427   public:
00429 
00430 
00431     OffsetView(void);
00433     OffsetView(const IntView& y, int c);
00435     
00437 
00438 
00439     int offset(void) const;
00441     void offset(int n);
00443     int min(void) const;
00445     int max(void) const;
00447     int med(void) const;
00449     int val(void) const;
00450     
00452     unsigned int size(void) const;
00454     unsigned int width(void) const;
00456     unsigned int regret_min(void) const;
00458     unsigned int regret_max(void) const;
00460     
00462 
00463 
00464     bool range(void) const;
00465     
00467     bool in(int n) const;
00469     bool in(double n) const;
00471     
00473 
00474 
00475     ModEvent lq(Space& home, int n);
00477     ModEvent lq(Space& home, double n);
00479     ModEvent le(Space& home, int n);
00481     ModEvent le(Space& home, double n);
00483     ModEvent gq(Space& home, int n);
00485     ModEvent gq(Space& home, double n);
00487     ModEvent gr(Space& home, int n);
00489     ModEvent gr(Space& home, double n);
00491     ModEvent nq(Space& home, int n);
00493     ModEvent nq(Space& home, double n);
00495     ModEvent eq(Space& home, int n);
00497     ModEvent eq(Space& home, double n);
00499     
00515 
00516     template<class I>
00517     ModEvent narrow_r(Space& home, I& i, bool depends=true);
00519     template<class I>
00520     ModEvent inter_r(Space& home, I& i, bool depends=true);
00522     template<class I>
00523     ModEvent minus_r(Space& home, I& i, bool depends=true);
00525     template<class I>
00526     ModEvent narrow_v(Space& home, I& i, bool depends=true);
00528     template<class I>
00529     ModEvent inter_v(Space& home, I& i, bool depends=true);
00531     template<class I>
00532     ModEvent minus_v(Space& home, I& i, bool depends=true);
00534 
00536 
00537 
00538     static ModEventDelta med(ModEvent me);
00540 
00542 
00543 
00544     int min(const Delta& d) const;
00546     int max(const Delta& d) const;
00548     bool any(const Delta& d) const;
00550     
00552 
00553 
00554     void update(Space& home, bool share, OffsetView& y);
00556   };
00557 
00562   template<class Char, class Traits>
00563   std::basic_ostream<Char,Traits>&
00564   operator <<(std::basic_ostream<Char,Traits>& os, const OffsetView& x);
00565   
00570 
00571   bool same(const OffsetView& x, const OffsetView& y);
00573   bool before(const OffsetView& x, const OffsetView& y);
00575 
00579   template<class View>
00580   class NoOffset {
00581   public:
00583     typedef View ViewType;
00585     View& operator ()(View& x);
00587     void update(const NoOffset&);
00589     int offset(void) const;
00590   };
00591 
00592   template<class View>
00593   forceinline View&
00594   NoOffset<View>::operator ()(View& x) {
00595     return x;
00596   }
00597 
00598   template<class View>
00599   forceinline void
00600   NoOffset<View>::update(const NoOffset&) {}
00601 
00602   template<class View>
00603   forceinline int
00604   NoOffset<View>::offset(void) const {
00605     return 0;
00606   }
00607   
00608 
00612   class Offset {
00613   public:
00615     typedef OffsetView ViewType;
00617     int c;
00619     Offset(int off = 0);
00621     OffsetView operator()(IntView& x);
00623     void update(const Offset& o);
00625     int offset(void) const;
00626   };
00627 
00628   forceinline
00629   Offset::Offset(int off) : c(off) {}
00630 
00631   forceinline void
00632   Offset::update(const Offset& o) { c = o.c; }
00633 
00634   forceinline int
00635   Offset::offset(void) const { return c; }
00636 
00637   forceinline OffsetView
00638   Offset::operator ()(IntView& x) {
00639       return OffsetView(x,c);
00640   }
00641 
00667   template<class Val, class UnsVal>
00668   class ScaleView : public DerivedView<IntView> {
00669   protected:
00670     using DerivedView<IntView>::x;
00672     int a;
00674 
00675 
00676     Val floor_div(double y) const;
00678     Val ceil_div(double y) const;
00680     Val exact_div(double y, bool& exact) const;
00681 #if GECODE_INT_RND_TWDS_ZERO
00682 
00683     int floor_div(int y) const;
00685     int ceil_div(int y) const;
00687     int exact_div(int y, bool& exact) const;
00688 #endif
00689 
00690 
00691   public:
00693 
00694 
00695     ScaleView(void);
00697     ScaleView(int b, const IntView& y);
00699     
00701 
00702 
00703     int scale(void) const;
00705     Val min(void) const;
00707     Val max(void) const;
00709     Val med(void) const;
00711     Val val(void) const;
00712     
00714     UnsVal size(void) const;
00716     UnsVal width(void) const;
00718     UnsVal regret_min(void) const;
00720     UnsVal regret_max(void) const;
00722 
00724 
00725 
00726     bool range(void) const;
00728     bool in(Val n) const;
00730     
00732 
00733 
00734     ModEvent lq(Space& home, Val n);
00736     ModEvent le(Space& home, Val n);
00738     ModEvent gq(Space& home, Val n);
00740     ModEvent gr(Space& home, Val n);
00742     ModEvent nq(Space& home, Val n);
00744     ModEvent eq(Space& home, Val n);
00746     
00748 
00749 
00750     static ModEventDelta med(ModEvent me);
00752 
00754 
00755 
00756     Val min(const Delta& d) const;
00758     Val max(const Delta& d) const;
00760     bool any(const Delta& d) const;
00762     
00764 
00765 
00766     void update(Space& home, bool share, ScaleView<Val,UnsVal>& y);
00768   };
00769 
00774   typedef ScaleView<int,unsigned int> IntScaleView;
00775 
00780   typedef ScaleView<double,double> DoubleScaleView;
00781   
00786   template<class Char, class Traits>
00787   std::basic_ostream<Char,Traits>&
00788   operator <<(std::basic_ostream<Char,Traits>& os, const IntScaleView& x);
00789   
00794   template<class Char, class Traits>
00795   std::basic_ostream<Char,Traits>&
00796   operator <<(std::basic_ostream<Char,Traits>& os, const DoubleScaleView& x);
00797 
00802 
00803   template<class Val, class UnsVal>
00804   bool same(const ScaleView<Val,UnsVal>& x, const ScaleView<Val,UnsVal>& y);
00806   template<class Val, class UnsVal>
00807   bool before(const ScaleView<Val,UnsVal>& x, const ScaleView<Val,UnsVal>& y);
00809 
00810 
00811 
00819   class ConstIntView : public ConstView<IntView> {
00820   protected:
00821     int x;
00822   public:
00824 
00825 
00826     ConstIntView(void);
00828     ConstIntView(int n);
00830     
00832 
00833 
00834     int min(void) const;
00836     int max(void) const;
00838     int med(void) const;
00840     int val(void) const;
00841     
00843     unsigned int size(void) const;
00845     unsigned int width(void) const;
00847     unsigned int regret_min(void) const;
00849     unsigned int regret_max(void) const;
00851 
00853 
00854 
00855     bool range(void) const;
00857     bool in(int n) const;
00859     bool in(double n) const;
00861     
00863 
00864 
00865     ModEvent lq(Space& home, int n);
00867     ModEvent lq(Space& home, double n);
00869     ModEvent le(Space& home, int n);
00871     ModEvent le(Space& home, double n);
00873     ModEvent gq(Space& home, int n);
00875     ModEvent gq(Space& home, double n);
00877     ModEvent gr(Space& home, int n);
00879     ModEvent gr(Space& home, double n);
00881     ModEvent nq(Space& home, int n);
00883     ModEvent nq(Space& home, double n);
00885     ModEvent eq(Space& home, int n);
00887     ModEvent eq(Space& home, double n);
00889 
00905 
00906     template<class I>
00907     ModEvent narrow_r(Space& home, I& i, bool depends=true);
00909     template<class I>
00910     ModEvent inter_r(Space& home, I& i, bool depends=true);
00912     template<class I>
00913     ModEvent minus_r(Space& home, I& i, bool depends=true);
00915     template<class I>
00916     ModEvent narrow_v(Space& home, I& i, bool depends=true);
00918     template<class I>
00919     ModEvent inter_v(Space& home, I& i, bool depends=true);
00921     template<class I>
00922     ModEvent minus_v(Space& home, I& i, bool depends=true);
00924 
00926 
00927 
00928     int min(const Delta& d) const;
00930     int max(const Delta& d) const;
00932     bool any(const Delta& d) const;
00934 
00936 
00937 
00938     void update(Space& home, bool share, ConstIntView& y);
00940   };
00941 
00946   template<class Char, class Traits>
00947   std::basic_ostream<Char,Traits>&
00948   operator <<(std::basic_ostream<Char,Traits>& os, const ConstIntView& x);
00949 
00955 
00956   bool same(const ConstIntView& x, const ConstIntView& y);
00958   bool before(const ConstIntView& x, const ConstIntView& y);
00960 
00961 
00969   class ZeroIntView : public ConstView<IntView> {
00970   public:
00972 
00973 
00974     ZeroIntView(void);
00976     
00978 
00979 
00980     int min(void) const;
00982     int max(void) const;
00984     int med(void) const;
00986     int val(void) const;
00987     
00989     unsigned int size(void) const;
00991     unsigned int width(void) const;
00993     unsigned int regret_min(void) const;
00995     unsigned int regret_max(void) const;
00997 
00999 
01000 
01001     bool range(void) const;
01003     bool in(int n) const;
01005     bool in(double n) const;
01007     
01009 
01010 
01011     ModEvent lq(Space& home, int n);
01013     ModEvent lq(Space& home, double n);
01015     ModEvent le(Space& home, int n);
01017     ModEvent le(Space& home, double n);
01019     ModEvent gq(Space& home, int n);
01021     ModEvent gq(Space& home, double n);
01023     ModEvent gr(Space& home, int n);
01025     ModEvent gr(Space& home, double n);
01027     ModEvent nq(Space& home, int n);
01029     ModEvent nq(Space& home, double n);
01031     ModEvent eq(Space& home, int n);
01033     ModEvent eq(Space& home, double n);
01035 
01051 
01052     template<class I>
01053     ModEvent narrow_r(Space& home, I& i, bool depends=true);
01055     template<class I>
01056     ModEvent inter_r(Space& home, I& i, bool depends=true);
01058     template<class I>
01059     ModEvent minus_r(Space& home, I& i, bool depends=true);
01061     template<class I>
01062     ModEvent narrow_v(Space& home, I& i, bool depends=true);
01064     template<class I>
01065     ModEvent inter_v(Space& home, I& i, bool depends=true);
01067     template<class I>
01068     ModEvent minus_v(Space& home, I& i, bool depends=true);
01070 
01072 
01073 
01074     int min(const Delta& d) const;
01076     int max(const Delta& d) const;
01078     bool any(const Delta& d) const;
01080   };
01081 
01086   template<class Char, class Traits>
01087   std::basic_ostream<Char,Traits>&
01088   operator <<(std::basic_ostream<Char,Traits>& os, const ZeroIntView& x);
01089 
01095 
01096   bool same(const ZeroIntView& x, const ZeroIntView& y);
01098 
01099   template<class View> class ViewDiffRanges;
01100 
01111   template<class View>
01112   class CachedView : public DerivedView<View> {
01113     friend class ViewDiffRanges<View>;
01114   protected:
01115     using DerivedView<View>::x;
01117     RangeList* _firstRange;
01119     RangeList* _lastRange;
01121     unsigned int _size;
01122   public:
01124 
01125 
01126     CachedView(void);
01128     explicit CachedView(const View& y);
01130     
01132 
01133 
01134     int min(void) const;
01136     int max(void) const;
01138     int med(void) const;
01140     int val(void) const;
01141     
01143     unsigned int size(void) const;
01145     unsigned int width(void) const;
01147     unsigned int regret_min(void) const;
01149     unsigned int regret_max(void) const;
01151     
01153 
01154 
01155     bool range(void) const;
01156     
01158     bool in(int n) const;
01160     bool in(double n) const;
01162     
01164 
01165 
01166     ModEvent lq(Space& home, int n);
01168     ModEvent lq(Space& home, double n);
01170     ModEvent le(Space& home, int n);
01172     ModEvent le(Space& home, double n);
01174     ModEvent gq(Space& home, int n);
01176     ModEvent gq(Space& home, double n);
01178     ModEvent gr(Space& home, int n);
01180     ModEvent gr(Space& home, double n);
01182     ModEvent nq(Space& home, int n);
01184     ModEvent nq(Space& home, double n);
01186     ModEvent eq(Space& home, int n);
01188     ModEvent eq(Space& home, double n);
01190     
01206 
01207     template<class I>
01208     ModEvent narrow_r(Space& home, I& i, bool depends=true);
01210     template<class I>
01211     ModEvent inter_r(Space& home, I& i, bool depends=true);
01213     template<class I>
01214     ModEvent minus_r(Space& home, I& i, bool depends=true);
01216     template<class I>
01217     ModEvent narrow_v(Space& home, I& i, bool depends=true);
01219     template<class I>
01220     ModEvent inter_v(Space& home, I& i, bool depends=true);
01222     template<class I>
01223     ModEvent minus_v(Space& home, I& i, bool depends=true);
01225 
01227 
01228 
01229     static ModEventDelta med(ModEvent me);
01231 
01233 
01234 
01235     int min(const Delta& d) const;
01237     int max(const Delta& d) const;
01239     bool any(const Delta& d) const;
01241 
01243 
01244 
01245     void initCache(Space& home, const IntSet& s);
01247     void cache(Space& home);
01249     bool modified(void) const;
01251     
01253 
01254 
01255     void update(Space& home, bool share, CachedView<View>& y);
01257   };
01258 
01263   template<class Char, class Traits, class View>
01264   std::basic_ostream<Char,Traits>&
01265   operator <<(std::basic_ostream<Char,Traits>& os, const CachedView<View>& x);
01266   
01271 
01272   template<class View>
01273   bool same(const CachedView<View>& x, const CachedView<View>& y);
01275   template<class View>
01276   bool before(const CachedView<View>& x, const CachedView<View>& y);
01278 
01287   template<class View>
01288   class ViewDiffRanges
01289     : public Iter::Ranges::Diff<Iter::Ranges::RangeList,ViewRanges<View> > {
01290     typedef Iter::Ranges::Diff<Iter::Ranges::RangeList,ViewRanges<View> > 
01291       Super;
01292   protected:
01294     Iter::Ranges::RangeList cr;
01296     ViewRanges<View> dr;
01297   public:
01299 
01300 
01301     ViewDiffRanges(void);
01303     ViewDiffRanges(const CachedView<View>& x);
01305     void init(const CachedView<View>& x);
01307   };
01308 
01315   class BoolView : public VarImpView<BoolVar> {
01316   protected:
01317     using VarImpView<BoolVar>::x;
01318   public:
01320 
01321 
01322     BoolView(void);
01324     BoolView(const BoolVar& y);
01326     BoolView(BoolVarImp* y);
01328     
01330 
01331 
01332     static const int BITS = BoolVarImp::BITS;
01334     static const BoolStatus ZERO = BoolVarImp::ZERO;
01336     static const BoolStatus ONE  = BoolVarImp::ONE;
01338     static const BoolStatus NONE = BoolVarImp::NONE;
01340     BoolStatus status(void) const;
01342     
01344 
01345 
01346     int min(void) const;
01348     int max(void) const;
01350     int med(void) const;
01352     int val(void) const;
01353     
01355     unsigned int size(void) const;
01357     unsigned int width(void) const;
01359     unsigned int regret_min(void) const;
01361     unsigned int regret_max(void) const;
01363     
01365 
01366 
01367     bool range(void) const;
01369     bool in(int n) const;
01371     bool in(double n) const;
01373 
01375 
01376 
01377     bool zero(void) const;
01379     bool one(void) const;
01381     bool none(void) const;
01383     
01385 
01386 
01387     ModEvent one(Space& home);
01389     ModEvent zero(Space& home);
01391     ModEvent one_none(Space& home);
01393     ModEvent zero_none(Space& home);
01395 
01397 
01398 
01399     ModEvent lq(Space& home, int n);
01401     ModEvent lq(Space& home, double n);
01402 
01404     ModEvent le(Space& home, int n);
01406     ModEvent le(Space& home, double n);
01407     
01409     ModEvent gq(Space& home, int n);
01411     ModEvent gq(Space& home, double n);
01412 
01414     ModEvent gr(Space& home, int n);
01416     ModEvent gr(Space& home, double n);
01417     
01419     ModEvent nq(Space& home, int n);
01421     ModEvent nq(Space& home, double n);
01422 
01424     ModEvent eq(Space& home, int n);
01426     ModEvent eq(Space& home, double n);
01428     
01444 
01445     template<class I>
01446     ModEvent narrow_r(Space& home, I& i, bool depends=true);
01448     template<class I>
01449     ModEvent inter_r(Space& home, I& i, bool depends=true);
01451     template<class I>
01452     ModEvent minus_r(Space& home, I& i, bool depends=true);
01454     template<class I>
01455     ModEvent narrow_v(Space& home, I& i, bool depends=true);
01457     template<class I>
01458     ModEvent inter_v(Space& home, I& i, bool depends=true);
01460     template<class I>
01461     ModEvent minus_v(Space& home, I& i, bool depends=true);
01463 
01465 
01466 
01467     int min(const Delta& d) const;
01469     int max(const Delta& d) const;
01471     bool any(const Delta& d) const;
01473     static bool zero(const Delta& d);
01475     static bool one(const Delta& d);
01477     
01479 
01480 
01481     static ModEventDelta med(ModEvent me);
01483   };
01484 
01489   template<class Char, class Traits>
01490   std::basic_ostream<Char,Traits>&
01491   operator <<(std::basic_ostream<Char,Traits>& os, const BoolView& x);
01492   
01493 
01494 
01503   class NegBoolView : public DerivedView<BoolView> {
01504   protected:
01505     using DerivedView<BoolView>::x;
01506   public:
01508 
01509 
01510     NegBoolView(void);
01512     explicit NegBoolView(const BoolView& y);
01514     
01516 
01517 
01518     static const int BITS = BoolView::BITS;
01520     static const BoolStatus ZERO = BoolView::ONE;
01522     static const BoolStatus ONE  = BoolView::ZERO;
01524     static const BoolStatus NONE = BoolView::NONE;
01526     BoolStatus status(void) const;
01528     
01530 
01531 
01532     bool zero(void) const;
01534     bool one(void) const;
01536     bool none(void) const;
01538     
01540 
01541 
01542     ModEvent one(Space& home);
01544     ModEvent zero(Space& home);
01546     ModEvent one_none(Space& home);
01548     ModEvent zero_none(Space& home);
01550     
01552 
01553 
01554     int min(void) const;
01556     int max(void) const;
01558     int val(void) const;
01560     
01562 
01563 
01564     int min(const Delta& d) const;
01566     int max(const Delta& d) const;
01568     bool any(const Delta& d) const;
01570     static bool zero(const Delta& d);
01572     static bool one(const Delta& d);
01574   };
01575 
01580   template<class Char, class Traits>
01581   std::basic_ostream<Char,Traits>&
01582   operator <<(std::basic_ostream<Char,Traits>& os, const NegBoolView& x);
01583 
01584 }}
01585 
01586 #include <gecode/int/var/int.hpp>
01587 #include <gecode/int/var/bool.hpp>
01588 
01589 #include <gecode/int/view/int.hpp>
01590 
01591 #include <gecode/int/view/constint.hpp>
01592 #include <gecode/int/view/zero.hpp>
01593 #include <gecode/int/view/minus.hpp>
01594 #include <gecode/int/view/offset.hpp>
01595 #include <gecode/int/view/scale.hpp>
01596 #include <gecode/int/view/cached.hpp>
01597 
01598 #include <gecode/int/view/bool.hpp>
01599 
01600 #include <gecode/int/view/neg-bool.hpp>
01601 
01602 #include <gecode/int/view/print.hpp>
01603 #include <gecode/int/var/print.hpp>
01604 
01605 namespace Gecode { namespace Int {
01606 
01613 
01614   enum RelTest {
01615     RT_FALSE = 0, 
01616     RT_MAYBE = 1, 
01617     RT_TRUE  = 2  
01618   };
01619   
01621   template<class View> RelTest rtest_eq_bnd(View x, View y);
01623   template<class View> RelTest rtest_eq_dom(View x, View y);
01625   template<class View> RelTest rtest_eq_bnd(View x, int n);
01627   template<class View> RelTest rtest_eq_dom(View x, int n);
01628   
01630   template<class View> RelTest rtest_nq_bnd(View x, View y);
01632   template<class View> RelTest rtest_nq_dom(View x, View y);
01634   template<class View> RelTest rtest_nq_bnd(View x, int n);
01636   template<class View> RelTest rtest_nq_dom(View x, int n);
01637 
01639   template<class View> RelTest rtest_lq(View x, View y);
01641   template<class View> RelTest rtest_lq(View x, int n);
01642   
01644   template<class View> RelTest rtest_le(View x, View y);
01646   template<class View> RelTest rtest_le(View x, int n);
01647   
01649   template<class View> RelTest rtest_gq(View x, View y);
01651   template<class View> RelTest rtest_gq(View x, int n);
01652   
01654   template<class View> RelTest rtest_gr(View x, View y);
01656   template<class View> RelTest rtest_gr(View x, int n);
01658 
01659 
01664   enum BoolTest {
01665     BT_NONE, 
01666     BT_SAME, 
01667     BT_COMP  
01668   };
01669   
01675 
01676   BoolTest bool_test(const BoolView& b0, const BoolView& b1);
01678   BoolTest bool_test(const BoolView& b0, const NegBoolView& b1);
01680   BoolTest bool_test(const NegBoolView& b0, const BoolView& b1);
01682   BoolTest bool_test(const NegBoolView& b0, const NegBoolView& b1);
01684   
01685 }}
01686 
01687 #include <gecode/int/view/rel-test.hpp>
01688 #include <gecode/int/view/bool-test.hpp>
01689 
01690 // STATISTICS: int-var