Generated on Fri Mar 20 15:56:02 2015 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: 2013-02-14 17:04:32 +0100 (Thu, 14 Feb 2013) $ by $Author: schulte $
00011  *     $Revision: 13297 $
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 namespace Gecode { namespace Int {
00041 
00053   template<class View>
00054   class ViewRanges {
00055   public:
00057 
00058 
00059     ViewRanges(void);
00061     ViewRanges(const View& x);
00063     void init(const View& x);
00065 
00067 
00068 
00069     bool operator ()(void) const;
00071     void operator ++(void);
00073 
00075 
00076 
00077     int min(void) const;
00079     int max(void) const;
00081     unsigned int width(void) const;
00083   };
00084 
00093   template<class View>
00094   class ViewValues : public Iter::Ranges::ToValues<ViewRanges<View> > {
00095   public:
00097 
00098 
00099     ViewValues(void);
00101     ViewValues(const View& x);
00103     void init(const View& x);
00105   };
00106 
00107 }}
00108 
00109 #include <gecode/int/view/iter.hpp>
00110 
00111 namespace Gecode { namespace Int {
00112 
00129   class IntView : public VarImpView<IntVar> {
00130   protected:
00131     using VarImpView<IntVar>::x;
00132   public:
00134 
00135 
00136     IntView(void);
00138     IntView(const IntVar& y);
00140     IntView(IntVarImp* y);
00142     
00144 
00145 
00146     int min(void) const;
00148     int max(void) const;
00150     int med(void) const;
00152     int val(void) const;
00153 
00155     unsigned int size(void) const;
00157     unsigned int width(void) const;
00159     unsigned int regret_min(void) const;
00161     unsigned int regret_max(void) const;
00163     
00165 
00166 
00167     bool range(void) const;
00168     
00170     bool in(int n) const;
00172     bool in(long long int n) const;
00174     
00176 
00177 
00178     ModEvent lq(Space& home, int n);
00180     ModEvent lq(Space& home, long long int n);
00181     
00183     ModEvent le(Space& home, int n);
00185     ModEvent le(Space& home, long long int n);
00186     
00188     ModEvent gq(Space& home, int n);
00190     ModEvent gq(Space& home, long long int n);
00191     
00193     ModEvent gr(Space& home, int n);
00195     ModEvent gr(Space& home, long long int n);
00196 
00198     ModEvent nq(Space& home, int n);
00200     ModEvent nq(Space& home, long long int n);
00201 
00203     ModEvent eq(Space& home, int n);
00205     ModEvent eq(Space& home, long long int n);
00207 
00223 
00224     template<class I>
00225     ModEvent narrow_r(Space& home, I& i, bool depends=true);
00227     template<class I>
00228     ModEvent inter_r(Space& home, I& i, bool depends=true);
00230     template<class I>
00231     ModEvent minus_r(Space& home, I& i, bool depends=true);
00233     template<class I>
00234     ModEvent narrow_v(Space& home, I& i, bool depends=true);
00236     template<class I>
00237     ModEvent inter_v(Space& home, I& i, bool depends=true);
00239     template<class I>
00240     ModEvent minus_v(Space& home, I& i, bool depends=true);
00242 
00244 
00245 
00246     int min(const Delta& d) const;
00248     int max(const Delta& d) const;
00250     bool any(const Delta& d) const;
00252 
00254 
00255 
00256     static ModEventDelta med(ModEvent me);
00258   };
00259 
00264   template<class Char, class Traits>
00265   std::basic_ostream<Char,Traits>&
00266   operator <<(std::basic_ostream<Char,Traits>& os, const IntView& x);
00267   
00268 
00276   class MinusView : public DerivedView<IntView> {
00277   protected:
00278     using DerivedView<IntView>::x;
00279   public:
00281 
00282 
00283     MinusView(void);
00285     explicit MinusView(const IntView& y);
00287     
00289 
00290 
00291     int min(void) const;
00293     int max(void) const;
00295     int med(void) const;
00297     int val(void) const;
00298     
00300     unsigned int size(void) const;
00302     unsigned int width(void) const;
00304     unsigned int regret_min(void) const;
00306     unsigned int regret_max(void) const;
00308     
00310 
00311 
00312     bool range(void) const;
00313     
00315     bool in(int n) const;
00317     bool in(long long int n) const;
00319     
00321 
00322 
00323     ModEvent lq(Space& home, int n);
00325     ModEvent lq(Space& home, long long int n);
00326 
00328     ModEvent le(Space& home, int n);
00330     ModEvent le(Space& home, long long int n);
00331 
00333     ModEvent gq(Space& home, int n);
00335     ModEvent gq(Space& home, long long int n);
00336 
00338     ModEvent gr(Space& home, int n);
00340     ModEvent gr(Space& home, long long int n);
00341 
00343     ModEvent nq(Space& home, int n);
00345     ModEvent nq(Space& home, long long int n);
00346 
00348     ModEvent eq(Space& home, int n);
00350     ModEvent eq(Space& home, long long int 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(long long int n) const;
00471     
00473 
00474 
00475     ModEvent lq(Space& home, int n);
00477     ModEvent lq(Space& home, long long int n);
00478 
00480     ModEvent le(Space& home, int n);
00482     ModEvent le(Space& home, long long int n);
00483 
00485     ModEvent gq(Space& home, int n);
00487     ModEvent gq(Space& home, long long int n);
00488 
00490     ModEvent gr(Space& home, int n);
00492     ModEvent gr(Space& home, long long int n);
00493 
00495     ModEvent nq(Space& home, int n);
00497     ModEvent nq(Space& home, long long int n);
00498 
00500     ModEvent eq(Space& home, int n);
00502     ModEvent eq(Space& home, long long int n);
00504     
00520 
00521     template<class I>
00522     ModEvent narrow_r(Space& home, I& i, bool depends=true);
00524     template<class I>
00525     ModEvent inter_r(Space& home, I& i, bool depends=true);
00527     template<class I>
00528     ModEvent minus_r(Space& home, I& i, bool depends=true);
00530     template<class I>
00531     ModEvent narrow_v(Space& home, I& i, bool depends=true);
00533     template<class I>
00534     ModEvent inter_v(Space& home, I& i, bool depends=true);
00536     template<class I>
00537     ModEvent minus_v(Space& home, I& i, bool depends=true);
00539 
00541 
00542 
00543     static ModEventDelta med(ModEvent me);
00545 
00547 
00548 
00549     int min(const Delta& d) const;
00551     int max(const Delta& d) const;
00553     bool any(const Delta& d) const;
00555     
00557 
00558 
00559     void update(Space& home, bool share, OffsetView& y);
00561   };
00562 
00567   template<class Char, class Traits>
00568   std::basic_ostream<Char,Traits>&
00569   operator <<(std::basic_ostream<Char,Traits>& os, const OffsetView& x);
00570   
00575 
00576   bool same(const OffsetView& x, const OffsetView& y);
00578   bool before(const OffsetView& x, const OffsetView& y);
00580 
00584   template<class View>
00585   class NoOffset {
00586   public:
00588     typedef View ViewType;
00590     View& operator ()(View& x);
00592     void update(const NoOffset&);
00594     int offset(void) const;
00595   };
00596 
00597   template<class View>
00598   forceinline View&
00599   NoOffset<View>::operator ()(View& x) {
00600     return x;
00601   }
00602 
00603   template<class View>
00604   forceinline void
00605   NoOffset<View>::update(const NoOffset&) {}
00606 
00607   template<class View>
00608   forceinline int
00609   NoOffset<View>::offset(void) const {
00610     return 0;
00611   }
00612   
00613 
00617   class Offset {
00618   public:
00620     typedef OffsetView ViewType;
00622     int c;
00624     Offset(int off = 0);
00626     OffsetView operator()(IntView& x);
00628     void update(const Offset& o);
00630     int offset(void) const;
00631   };
00632 
00633   forceinline
00634   Offset::Offset(int off) : c(off) {}
00635 
00636   forceinline void
00637   Offset::update(const Offset& o) { c = o.c; }
00638 
00639   forceinline int
00640   Offset::offset(void) const { return c; }
00641 
00642   forceinline OffsetView
00643   Offset::operator ()(IntView& x) {
00644       return OffsetView(x,c);
00645   }
00646 
00670   template<class Val, class UnsVal>
00671   class ScaleView : public DerivedView<IntView> {
00672   protected:
00673     using DerivedView<IntView>::x;
00675     int a;
00676   public:
00678 
00679 
00680     ScaleView(void);
00682     ScaleView(int b, const IntView& y);
00684     
00686 
00687 
00688     int scale(void) const;
00690     Val min(void) const;
00692     Val max(void) const;
00694     Val med(void) const;
00696     Val val(void) const;
00697     
00699     UnsVal size(void) const;
00701     UnsVal width(void) const;
00703     UnsVal regret_min(void) const;
00705     UnsVal regret_max(void) const;
00707 
00709 
00710 
00711     bool range(void) const;
00713     bool in(Val n) const;
00715     
00717 
00718 
00719     ModEvent lq(Space& home, Val n);
00721     ModEvent le(Space& home, Val n);
00723     ModEvent gq(Space& home, Val n);
00725     ModEvent gr(Space& home, Val n);
00727     ModEvent nq(Space& home, Val n);
00729     ModEvent eq(Space& home, Val n);
00731     
00733 
00734 
00735     static ModEventDelta med(ModEvent me);
00737 
00739 
00740 
00741     Val min(const Delta& d) const;
00743     Val max(const Delta& d) const;
00745     bool any(const Delta& d) const;
00747     
00749 
00750 
00751     void update(Space& home, bool share, ScaleView<Val,UnsVal>& y);
00753   };
00754 
00759   typedef ScaleView<int,unsigned int> IntScaleView;
00760 
00765   typedef ScaleView<long long int,unsigned long long int> LLongScaleView;
00766   
00771   template<class Char, class Traits>
00772   std::basic_ostream<Char,Traits>&
00773   operator <<(std::basic_ostream<Char,Traits>& os, const IntScaleView& x);
00774   
00779   template<class Char, class Traits>
00780   std::basic_ostream<Char,Traits>&
00781   operator <<(std::basic_ostream<Char,Traits>& os, const LLongScaleView& x);
00782 
00787 
00788   template<class Val, class UnsVal>
00789   bool same(const ScaleView<Val,UnsVal>& x, const ScaleView<Val,UnsVal>& y);
00791   template<class Val, class UnsVal>
00792   bool before(const ScaleView<Val,UnsVal>& x, const ScaleView<Val,UnsVal>& y);
00794 
00795 
00796 
00804   class ConstIntView : public ConstView<IntView> {
00805   protected:
00806     int x;
00807   public:
00809 
00810 
00811     ConstIntView(void);
00813     ConstIntView(int n);
00815     
00817 
00818 
00819     int min(void) const;
00821     int max(void) const;
00823     int med(void) const;
00825     int val(void) const;
00826     
00828     unsigned int size(void) const;
00830     unsigned int width(void) const;
00832     unsigned int regret_min(void) const;
00834     unsigned int regret_max(void) const;
00836 
00838 
00839 
00840     bool range(void) const;
00842     bool in(int n) const;
00844     bool in(long long int n) const;
00846     
00848 
00849 
00850     ModEvent lq(Space& home, int n);
00852     ModEvent lq(Space& home, long long int n);
00853 
00855     ModEvent le(Space& home, int n);
00857     ModEvent le(Space& home, long long int n);
00858 
00860     ModEvent gq(Space& home, int n);
00862     ModEvent gq(Space& home, long long int n);
00863 
00865     ModEvent gr(Space& home, int n);
00867     ModEvent gr(Space& home, long long int n);
00868 
00870     ModEvent nq(Space& home, int n);
00872     ModEvent nq(Space& home, long long int n);
00873 
00875     ModEvent eq(Space& home, int n);
00877     ModEvent eq(Space& home, long long int n);
00879 
00895 
00896     template<class I>
00897     ModEvent narrow_r(Space& home, I& i, bool depends=true);
00899     template<class I>
00900     ModEvent inter_r(Space& home, I& i, bool depends=true);
00902     template<class I>
00903     ModEvent minus_r(Space& home, I& i, bool depends=true);
00905     template<class I>
00906     ModEvent narrow_v(Space& home, I& i, bool depends=true);
00908     template<class I>
00909     ModEvent inter_v(Space& home, I& i, bool depends=true);
00911     template<class I>
00912     ModEvent minus_v(Space& home, I& i, bool depends=true);
00914 
00916 
00917 
00918     int min(const Delta& d) const;
00920     int max(const Delta& d) const;
00922     bool any(const Delta& d) const;
00924 
00926 
00927 
00928     void update(Space& home, bool share, ConstIntView& y);
00930   };
00931 
00936   template<class Char, class Traits>
00937   std::basic_ostream<Char,Traits>&
00938   operator <<(std::basic_ostream<Char,Traits>& os, const ConstIntView& x);
00939 
00945 
00946   bool same(const ConstIntView& x, const ConstIntView& y);
00948   bool before(const ConstIntView& x, const ConstIntView& y);
00950 
00951 
00959   class ZeroIntView : public ConstView<IntView> {
00960   public:
00962 
00963 
00964     ZeroIntView(void);
00966     
00968 
00969 
00970     int min(void) const;
00972     int max(void) const;
00974     int med(void) const;
00976     int val(void) const;
00977     
00979     unsigned int size(void) const;
00981     unsigned int width(void) const;
00983     unsigned int regret_min(void) const;
00985     unsigned int regret_max(void) const;
00987 
00989 
00990 
00991     bool range(void) const;
00993     bool in(int n) const;
00995     bool in(long long int n) const;
00997     
00999 
01000 
01001     ModEvent lq(Space& home, int n);
01003     ModEvent lq(Space& home, long long int n);
01004 
01006     ModEvent le(Space& home, int n);
01008     ModEvent le(Space& home, long long int n);
01009 
01011     ModEvent gq(Space& home, int n);
01013     ModEvent gq(Space& home, long long int n);
01014 
01016     ModEvent gr(Space& home, int n);
01018     ModEvent gr(Space& home, long long int n);
01019 
01021     ModEvent nq(Space& home, int n);
01023     ModEvent nq(Space& home, long long int n);
01024 
01026     ModEvent eq(Space& home, int n);
01028     ModEvent eq(Space& home, long long int n);
01030 
01046 
01047     template<class I>
01048     ModEvent narrow_r(Space& home, I& i, bool depends=true);
01050     template<class I>
01051     ModEvent inter_r(Space& home, I& i, bool depends=true);
01053     template<class I>
01054     ModEvent minus_r(Space& home, I& i, bool depends=true);
01056     template<class I>
01057     ModEvent narrow_v(Space& home, I& i, bool depends=true);
01059     template<class I>
01060     ModEvent inter_v(Space& home, I& i, bool depends=true);
01062     template<class I>
01063     ModEvent minus_v(Space& home, I& i, bool depends=true);
01065 
01067 
01068 
01069     int min(const Delta& d) const;
01071     int max(const Delta& d) const;
01073     bool any(const Delta& d) const;
01075   };
01076 
01081   template<class Char, class Traits>
01082   std::basic_ostream<Char,Traits>&
01083   operator <<(std::basic_ostream<Char,Traits>& os, const ZeroIntView& x);
01084 
01090 
01091   bool same(const ZeroIntView& x, const ZeroIntView& y);
01093 
01094   template<class View> class ViewDiffRanges;
01095 
01106   template<class View>
01107   class CachedView : public DerivedView<View> {
01108     friend class ViewDiffRanges<View>;
01109   protected:
01110     using DerivedView<View>::x;
01112     RangeList* _firstRange;
01114     RangeList* _lastRange;
01116     unsigned int _size;
01117   public:
01119 
01120 
01121     CachedView(void);
01123     explicit CachedView(const View& y);
01125     
01127 
01128 
01129     int min(void) const;
01131     int max(void) const;
01133     int med(void) const;
01135     int val(void) const;
01136     
01138     unsigned int size(void) const;
01140     unsigned int width(void) const;
01142     unsigned int regret_min(void) const;
01144     unsigned int regret_max(void) const;
01146     
01148 
01149 
01150     bool range(void) const;
01151     
01153     bool in(int n) const;
01155     bool in(long long int n) const;
01157     
01159 
01160 
01161     ModEvent lq(Space& home, int n);
01163     ModEvent lq(Space& home, long long int n);
01164 
01166     ModEvent le(Space& home, int n);
01168     ModEvent le(Space& home, long long int n);
01169 
01171     ModEvent gq(Space& home, int n);
01173     ModEvent gq(Space& home, long long int n);
01174 
01176     ModEvent gr(Space& home, int n);
01178     ModEvent gr(Space& home, long long int n);
01179 
01181     ModEvent nq(Space& home, int n);
01183     ModEvent nq(Space& home, long long int n);
01184 
01186     ModEvent eq(Space& home, int n);
01188     ModEvent eq(Space& home, long long int 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(long long int 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, long long int n);
01402 
01404     ModEvent le(Space& home, int n);
01406     ModEvent le(Space& home, long long int n);
01407     
01409     ModEvent gq(Space& home, int n);
01411     ModEvent gq(Space& home, long long int n);
01412 
01414     ModEvent gr(Space& home, int n);
01416     ModEvent gr(Space& home, long long int n);
01417     
01419     ModEvent nq(Space& home, int n);
01421     ModEvent nq(Space& home, long long int n);
01422 
01424     ModEvent eq(Space& home, int n);
01426     ModEvent eq(Space& home, long long int 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