Generated on Tue May 22 09:39:51 2018 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  *  Contributing authors:
00007  *     Samuel Gagnon <samuel.gagnon92@gmail.com>
00008  *
00009  *  Copyright:
00010  *     Christian Schulte, 2005
00011  *     Samuel Gagnon, 2018
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 #ifdef GECODE_HAS_CBS
00154 
00155     int baseval(int val) const;
00156 #endif
00157 
00159     unsigned int size(void) const;
00161     unsigned int width(void) const;
00163     unsigned int regret_min(void) const;
00165     unsigned int regret_max(void) const;
00167 
00169 
00170 
00171     bool range(void) const;
00172 
00174     bool in(int n) const;
00176     bool in(long long int n) const;
00178 
00180 
00181 
00182     ModEvent lq(Space& home, int n);
00184     ModEvent lq(Space& home, long long int n);
00185 
00187     ModEvent le(Space& home, int n);
00189     ModEvent le(Space& home, long long int n);
00190 
00192     ModEvent gq(Space& home, int n);
00194     ModEvent gq(Space& home, long long int n);
00195 
00197     ModEvent gr(Space& home, int n);
00199     ModEvent gr(Space& home, long long int n);
00200 
00202     ModEvent nq(Space& home, int n);
00204     ModEvent nq(Space& home, long long int n);
00205 
00207     ModEvent eq(Space& home, int n);
00209     ModEvent eq(Space& home, long long int n);
00211 
00227 
00228     template<class I>
00229     ModEvent narrow_r(Space& home, I& i, bool depends=true);
00231     template<class I>
00232     ModEvent inter_r(Space& home, I& i, bool depends=true);
00234     template<class I>
00235     ModEvent minus_r(Space& home, I& i, bool depends=true);
00237     template<class I>
00238     ModEvent narrow_v(Space& home, I& i, bool depends=true);
00240     template<class I>
00241     ModEvent inter_v(Space& home, I& i, bool depends=true);
00243     template<class I>
00244     ModEvent minus_v(Space& home, I& i, bool depends=true);
00246 
00248 
00249 
00250     int min(const Delta& d) const;
00252     int max(const Delta& d) const;
00254     unsigned int width(const Delta& d) const;
00256     bool any(const Delta& d) const;
00258 
00260 
00261 
00262     static ModEventDelta med(ModEvent me);
00264   };
00265 
00270   template<class Char, class Traits>
00271   std::basic_ostream<Char,Traits>&
00272   operator <<(std::basic_ostream<Char,Traits>& os, const IntView& x);
00273 
00274 
00282   class MinusView : public DerivedView<IntView> {
00283   protected:
00284     using DerivedView<IntView>::x;
00285   public:
00287 
00288 
00289     MinusView(void);
00291     explicit MinusView(const IntView& y);
00293 
00295 
00296 
00297     int min(void) const;
00299     int max(void) const;
00301     int med(void) const;
00303     int val(void) const;
00304 #ifdef GECODE_HAS_CBS
00305 
00306     int baseval(int val) const;
00307 #endif
00308 
00310     unsigned int size(void) const;
00312     unsigned int width(void) const;
00314     unsigned int regret_min(void) const;
00316     unsigned int regret_max(void) const;
00318 
00320 
00321 
00322     bool range(void) const;
00323 
00325     bool in(int n) const;
00327     bool in(long long int n) const;
00329 
00331 
00332 
00333     ModEvent lq(Space& home, int n);
00335     ModEvent lq(Space& home, long long int n);
00336 
00338     ModEvent le(Space& home, int n);
00340     ModEvent le(Space& home, long long int n);
00341 
00343     ModEvent gq(Space& home, int n);
00345     ModEvent gq(Space& home, long long int n);
00346 
00348     ModEvent gr(Space& home, int n);
00350     ModEvent gr(Space& home, long long int n);
00351 
00353     ModEvent nq(Space& home, int n);
00355     ModEvent nq(Space& home, long long int n);
00356 
00358     ModEvent eq(Space& home, int n);
00360     ModEvent eq(Space& home, long long int n);
00362 
00378 
00379     template<class I>
00380     ModEvent narrow_r(Space& home, I& i, bool depends=true);
00382     template<class I>
00383     ModEvent inter_r(Space& home, I& i, bool depends=true);
00385     template<class I>
00386     ModEvent minus_r(Space& home, I& i, bool depends=true);
00388     template<class I>
00389     ModEvent narrow_v(Space& home, I& i, bool depends=true);
00391     template<class I>
00392     ModEvent inter_v(Space& home, I& i, bool depends=true);
00394     template<class I>
00395     ModEvent minus_v(Space& home, I& i, bool depends=true);
00397 
00399 
00400 
00401     static ModEventDelta med(ModEvent me);
00403 
00405 
00406 
00407     int min(const Delta& d) const;
00409     int max(const Delta& d) const;
00411     unsigned int width(const Delta& d) const;
00413     bool any(const Delta& d) const;
00415   };
00416 
00421   template<class Char, class Traits>
00422   std::basic_ostream<Char,Traits>&
00423   operator <<(std::basic_ostream<Char,Traits>& os, const MinusView& x);
00424 
00425 
00434   class OffsetView : public DerivedView<IntView> {
00435   protected:
00437     int c;
00438     using DerivedView<IntView>::x;
00439   public:
00441 
00442 
00443     OffsetView(void);
00445     OffsetView(const IntView& y, int c);
00447 
00449 
00450 
00451     int offset(void) const;
00453     void offset(int n);
00455     int min(void) const;
00457     int max(void) const;
00459     int med(void) const;
00461     int val(void) const;
00462 #ifdef GECODE_HAS_CBS
00463 
00464     int baseval(int val) const;
00465 #endif
00466 
00468     unsigned int size(void) const;
00470     unsigned int width(void) const;
00472     unsigned int regret_min(void) const;
00474     unsigned int regret_max(void) const;
00476 
00478 
00479 
00480     bool range(void) const;
00481 
00483     bool in(int n) const;
00485     bool in(long long int n) const;
00487 
00489 
00490 
00491     ModEvent lq(Space& home, int n);
00493     ModEvent lq(Space& home, long long int n);
00494 
00496     ModEvent le(Space& home, int n);
00498     ModEvent le(Space& home, long long int n);
00499 
00501     ModEvent gq(Space& home, int n);
00503     ModEvent gq(Space& home, long long int n);
00504 
00506     ModEvent gr(Space& home, int n);
00508     ModEvent gr(Space& home, long long int n);
00509 
00511     ModEvent nq(Space& home, int n);
00513     ModEvent nq(Space& home, long long int n);
00514 
00516     ModEvent eq(Space& home, int n);
00518     ModEvent eq(Space& home, long long int n);
00520 
00536 
00537     template<class I>
00538     ModEvent narrow_r(Space& home, I& i, bool depends=true);
00540     template<class I>
00541     ModEvent inter_r(Space& home, I& i, bool depends=true);
00543     template<class I>
00544     ModEvent minus_r(Space& home, I& i, bool depends=true);
00546     template<class I>
00547     ModEvent narrow_v(Space& home, I& i, bool depends=true);
00549     template<class I>
00550     ModEvent inter_v(Space& home, I& i, bool depends=true);
00552     template<class I>
00553     ModEvent minus_v(Space& home, I& i, bool depends=true);
00555 
00557 
00558 
00559     static ModEventDelta med(ModEvent me);
00561 
00563 
00564 
00565     int min(const Delta& d) const;
00567     int max(const Delta& d) const;
00569     unsigned int width(const Delta& d) const;
00571     bool any(const Delta& d) const;
00573 
00575 
00576 
00577     void update(Space& home, OffsetView& y);
00579   };
00580 
00585   template<class Char, class Traits>
00586   std::basic_ostream<Char,Traits>&
00587   operator <<(std::basic_ostream<Char,Traits>& os, const OffsetView& x);
00588 
00593 
00594   bool same(const OffsetView& x, const OffsetView& y);
00596   bool before(const OffsetView& x, const OffsetView& y);
00598 
00602   template<class View>
00603   class NoOffset {
00604   public:
00606     typedef View ViewType;
00608     View& operator ()(View& x);
00610     void update(const NoOffset&);
00612     int offset(void) const;
00613   };
00614 
00615   template<class View>
00616   forceinline View&
00617   NoOffset<View>::operator ()(View& x) {
00618     return x;
00619   }
00620 
00621   template<class View>
00622   forceinline void
00623   NoOffset<View>::update(const NoOffset&) {}
00624 
00625   template<class View>
00626   forceinline int
00627   NoOffset<View>::offset(void) const {
00628     return 0;
00629   }
00630 
00631 
00635   class Offset {
00636   public:
00638     typedef OffsetView ViewType;
00640     int c;
00642     Offset(int off = 0);
00644     OffsetView operator()(IntView& x);
00646     void update(const Offset& o);
00648     int offset(void) const;
00649   };
00650 
00651   forceinline
00652   Offset::Offset(int off) : c(off) {}
00653 
00654   forceinline void
00655   Offset::update(const Offset& o) { c = o.c; }
00656 
00657   forceinline int
00658   Offset::offset(void) const { return c; }
00659 
00660   forceinline OffsetView
00661   Offset::operator ()(IntView& x) {
00662       return OffsetView(x,c);
00663   }
00664 
00688   template<class Val, class UnsVal>
00689   class ScaleView : public DerivedView<IntView> {
00690   protected:
00691     using DerivedView<IntView>::x;
00693     int a;
00694   public:
00696 
00697 
00698     ScaleView(void);
00700     ScaleView(int b, const IntView& y);
00702 
00704 
00705 
00706     int scale(void) const;
00708     Val min(void) const;
00710     Val max(void) const;
00712     Val med(void) const;
00714     Val val(void) const;
00715 #ifdef GECODE_HAS_CBS
00716 
00717     Val baseval(Val val) const;
00718 #endif
00719 
00721     UnsVal size(void) const;
00723     UnsVal width(void) const;
00725     UnsVal regret_min(void) const;
00727     UnsVal regret_max(void) const;
00729 
00731 
00732 
00733     bool range(void) const;
00735     bool in(Val n) const;
00737 
00739 
00740 
00741     ModEvent lq(Space& home, Val n);
00743     ModEvent le(Space& home, Val n);
00745     ModEvent gq(Space& home, Val n);
00747     ModEvent gr(Space& home, Val n);
00749     ModEvent nq(Space& home, Val n);
00751     ModEvent eq(Space& home, Val n);
00753 
00755 
00756 
00757     static ModEventDelta med(ModEvent me);
00759 
00761 
00762 
00763     Val min(const Delta& d) const;
00765     Val max(const Delta& d) const;
00767     UnsVal width(const Delta& d) const;
00769     bool any(const Delta& d) const;
00771 
00773 
00774 
00775     void update(Space& home, ScaleView<Val,UnsVal>& y);
00777   };
00778 
00783   typedef ScaleView<int,unsigned int> IntScaleView;
00784 
00789   typedef ScaleView<long long int,unsigned long long int> LLongScaleView;
00790 
00795   template<class Char, class Traits>
00796   std::basic_ostream<Char,Traits>&
00797   operator <<(std::basic_ostream<Char,Traits>& os, const IntScaleView& x);
00798 
00803   template<class Char, class Traits>
00804   std::basic_ostream<Char,Traits>&
00805   operator <<(std::basic_ostream<Char,Traits>& os, const LLongScaleView& x);
00806 
00811 
00812   template<class Val, class UnsVal>
00813   bool same(const ScaleView<Val,UnsVal>& x, const ScaleView<Val,UnsVal>& y);
00815   template<class Val, class UnsVal>
00816   bool before(const ScaleView<Val,UnsVal>& x, const ScaleView<Val,UnsVal>& y);
00818 
00819 
00820 
00828   class ConstIntView : public ConstView<IntView> {
00829   protected:
00830     int x;
00831   public:
00833 
00834 
00835     ConstIntView(void);
00837     ConstIntView(int n);
00839 
00841 
00842 
00843     int min(void) const;
00845     int max(void) const;
00847     int med(void) const;
00849     int val(void) const;
00850 
00852     unsigned int size(void) const;
00854     unsigned int width(void) const;
00856     unsigned int regret_min(void) const;
00858     unsigned int regret_max(void) const;
00860 
00862 
00863 
00864     bool range(void) const;
00866     bool in(int n) const;
00868     bool in(long long int n) const;
00870 
00872 
00873 
00874     ModEvent lq(Space& home, int n);
00876     ModEvent lq(Space& home, long long int n);
00877 
00879     ModEvent le(Space& home, int n);
00881     ModEvent le(Space& home, long long int n);
00882 
00884     ModEvent gq(Space& home, int n);
00886     ModEvent gq(Space& home, long long int n);
00887 
00889     ModEvent gr(Space& home, int n);
00891     ModEvent gr(Space& home, long long int n);
00892 
00894     ModEvent nq(Space& home, int n);
00896     ModEvent nq(Space& home, long long int n);
00897 
00899     ModEvent eq(Space& home, int n);
00901     ModEvent eq(Space& home, long long int n);
00903 
00919 
00920     template<class I>
00921     ModEvent narrow_r(Space& home, I& i, bool depends=true);
00923     template<class I>
00924     ModEvent inter_r(Space& home, I& i, bool depends=true);
00926     template<class I>
00927     ModEvent minus_r(Space& home, I& i, bool depends=true);
00929     template<class I>
00930     ModEvent narrow_v(Space& home, I& i, bool depends=true);
00932     template<class I>
00933     ModEvent inter_v(Space& home, I& i, bool depends=true);
00935     template<class I>
00936     ModEvent minus_v(Space& home, I& i, bool depends=true);
00938 
00940 
00941 
00942     int min(const Delta& d) const;
00944     int max(const Delta& d) const;
00946     unsigned int width(const Delta& d) const;
00948     bool any(const Delta& d) const;
00950 
00952 
00953 
00954     void update(Space& home, ConstIntView& y);
00956   };
00957 
00962   template<class Char, class Traits>
00963   std::basic_ostream<Char,Traits>&
00964   operator <<(std::basic_ostream<Char,Traits>& os, const ConstIntView& x);
00965 
00971 
00972   bool same(const ConstIntView& x, const ConstIntView& y);
00974   bool before(const ConstIntView& x, const ConstIntView& y);
00976 
00977 
00985   class ZeroIntView : public ConstView<IntView> {
00986   public:
00988 
00989 
00990     ZeroIntView(void);
00992 
00994 
00995 
00996     int min(void) const;
00998     int max(void) const;
01000     int med(void) const;
01002     int val(void) const;
01003 
01005     unsigned int size(void) const;
01007     unsigned int width(void) const;
01009     unsigned int regret_min(void) const;
01011     unsigned int regret_max(void) const;
01013 
01015 
01016 
01017     bool range(void) const;
01019     bool in(int n) const;
01021     bool in(long long int n) const;
01023 
01025 
01026 
01027     ModEvent lq(Space& home, int n);
01029     ModEvent lq(Space& home, long long int n);
01030 
01032     ModEvent le(Space& home, int n);
01034     ModEvent le(Space& home, long long int n);
01035 
01037     ModEvent gq(Space& home, int n);
01039     ModEvent gq(Space& home, long long int n);
01040 
01042     ModEvent gr(Space& home, int n);
01044     ModEvent gr(Space& home, long long int n);
01045 
01047     ModEvent nq(Space& home, int n);
01049     ModEvent nq(Space& home, long long int n);
01050 
01052     ModEvent eq(Space& home, int n);
01054     ModEvent eq(Space& home, long long int n);
01056 
01072 
01073     template<class I>
01074     ModEvent narrow_r(Space& home, I& i, bool depends=true);
01076     template<class I>
01077     ModEvent inter_r(Space& home, I& i, bool depends=true);
01079     template<class I>
01080     ModEvent minus_r(Space& home, I& i, bool depends=true);
01082     template<class I>
01083     ModEvent narrow_v(Space& home, I& i, bool depends=true);
01085     template<class I>
01086     ModEvent inter_v(Space& home, I& i, bool depends=true);
01088     template<class I>
01089     ModEvent minus_v(Space& home, I& i, bool depends=true);
01091 
01093 
01094 
01095     int min(const Delta& d) const;
01097     int max(const Delta& d) const;
01099     unsigned int width(const Delta& d) const;
01101     bool any(const Delta& d) const;
01103   };
01104 
01109   template<class Char, class Traits>
01110   std::basic_ostream<Char,Traits>&
01111   operator <<(std::basic_ostream<Char,Traits>& os, const ZeroIntView& x);
01112 
01118 
01119   bool same(const ZeroIntView& x, const ZeroIntView& y);
01121 
01122   template<class View> class ViewDiffRanges;
01123 
01134   template<class View>
01135   class CachedView : public DerivedView<View> {
01136     friend class ViewDiffRanges<View>;
01137   protected:
01138     using DerivedView<View>::x;
01140     RangeList* _firstRange;
01142     RangeList* _lastRange;
01144     unsigned int _size;
01145   public:
01147 
01148 
01149     CachedView(void);
01151     explicit CachedView(const View& y);
01153 
01155 
01156 
01157     int min(void) const;
01159     int max(void) const;
01161     int med(void) const;
01163     int val(void) const;
01164 #ifdef GECODE_HAS_CBS
01165 
01166     int baseval(int val) const;
01167 #endif
01168 
01170     unsigned int size(void) const;
01172     unsigned int width(void) const;
01174     unsigned int regret_min(void) const;
01176     unsigned int regret_max(void) const;
01178 
01180 
01181 
01182     bool range(void) const;
01183 
01185     bool in(int n) const;
01187     bool in(long long int n) const;
01189 
01191 
01192 
01193     ModEvent lq(Space& home, int n);
01195     ModEvent lq(Space& home, long long int n);
01196 
01198     ModEvent le(Space& home, int n);
01200     ModEvent le(Space& home, long long int n);
01201 
01203     ModEvent gq(Space& home, int n);
01205     ModEvent gq(Space& home, long long int n);
01206 
01208     ModEvent gr(Space& home, int n);
01210     ModEvent gr(Space& home, long long int n);
01211 
01213     ModEvent nq(Space& home, int n);
01215     ModEvent nq(Space& home, long long int n);
01216 
01218     ModEvent eq(Space& home, int n);
01220     ModEvent eq(Space& home, long long int n);
01222 
01238 
01239     template<class I>
01240     ModEvent narrow_r(Space& home, I& i, bool depends=true);
01242     template<class I>
01243     ModEvent inter_r(Space& home, I& i, bool depends=true);
01245     template<class I>
01246     ModEvent minus_r(Space& home, I& i, bool depends=true);
01248     template<class I>
01249     ModEvent narrow_v(Space& home, I& i, bool depends=true);
01251     template<class I>
01252     ModEvent inter_v(Space& home, I& i, bool depends=true);
01254     template<class I>
01255     ModEvent minus_v(Space& home, I& i, bool depends=true);
01257 
01259 
01260 
01261     static ModEventDelta med(ModEvent me);
01263 
01265 
01266 
01267     int min(const Delta& d) const;
01269     int max(const Delta& d) const;
01271     unsigned int width(const Delta& d) const;
01273     bool any(const Delta& d) const;
01275 
01277 
01278 
01279     void initCache(Space& home, const IntSet& s);
01281     void cache(Space& home);
01283     bool modified(void) const;
01285 
01287 
01288 
01289     void update(Space& home, CachedView<View>& y);
01291   };
01292 
01297   template<class Char, class Traits, class View>
01298   std::basic_ostream<Char,Traits>&
01299   operator <<(std::basic_ostream<Char,Traits>& os, const CachedView<View>& x);
01300 
01305 
01306   template<class View>
01307   bool same(const CachedView<View>& x, const CachedView<View>& y);
01309   template<class View>
01310   bool before(const CachedView<View>& x, const CachedView<View>& y);
01312 
01321   template<class View>
01322   class ViewDiffRanges
01323     : public Iter::Ranges::Diff<Iter::Ranges::RangeList,ViewRanges<View> > {
01324     typedef Iter::Ranges::Diff<Iter::Ranges::RangeList,ViewRanges<View> >
01325       Super;
01326   protected:
01328     Iter::Ranges::RangeList cr;
01330     ViewRanges<View> dr;
01331   public:
01333 
01334 
01335     ViewDiffRanges(void);
01337     ViewDiffRanges(const CachedView<View>& x);
01339     void init(const CachedView<View>& x);
01341   };
01342 
01349   class BoolView : public VarImpView<BoolVar> {
01350   protected:
01351     using VarImpView<BoolVar>::x;
01352   public:
01354 
01355 
01356     BoolView(void);
01358     BoolView(const BoolVar& y);
01360     BoolView(BoolVarImp* y);
01362 
01364 
01365 
01366     static const int BITS = BoolVarImp::BITS;
01368     static const BoolStatus ZERO = BoolVarImp::ZERO;
01370     static const BoolStatus ONE  = BoolVarImp::ONE;
01372     static const BoolStatus NONE = BoolVarImp::NONE;
01374     BoolStatus status(void) const;
01376 
01378 
01379 
01380     int min(void) const;
01382     int max(void) const;
01384     int med(void) const;
01386     int val(void) const;
01387 #ifdef GECODE_HAS_CBS
01388 
01389     int baseval(int val) const;
01390 #endif
01391 
01393     unsigned int size(void) const;
01395     unsigned int width(void) const;
01397     unsigned int regret_min(void) const;
01399     unsigned int regret_max(void) const;
01401 
01403 
01404 
01405     bool range(void) const;
01407     bool in(int n) const;
01409     bool in(long long int n) const;
01411 
01413 
01414 
01415     bool zero(void) const;
01417     bool one(void) const;
01419     bool none(void) const;
01421 
01423 
01424 
01425     ModEvent one(Space& home);
01427     ModEvent zero(Space& home);
01429     ModEvent one_none(Space& home);
01431     ModEvent zero_none(Space& home);
01433 
01435 
01436 
01437     ModEvent lq(Space& home, int n);
01439     ModEvent lq(Space& home, long long int n);
01440 
01442     ModEvent le(Space& home, int n);
01444     ModEvent le(Space& home, long long int n);
01445 
01447     ModEvent gq(Space& home, int n);
01449     ModEvent gq(Space& home, long long int n);
01450 
01452     ModEvent gr(Space& home, int n);
01454     ModEvent gr(Space& home, long long int n);
01455 
01457     ModEvent nq(Space& home, int n);
01459     ModEvent nq(Space& home, long long int n);
01460 
01462     ModEvent eq(Space& home, int n);
01464     ModEvent eq(Space& home, long long int n);
01466 
01482 
01483     template<class I>
01484     ModEvent narrow_r(Space& home, I& i, bool depends=true);
01486     template<class I>
01487     ModEvent inter_r(Space& home, I& i, bool depends=true);
01489     template<class I>
01490     ModEvent minus_r(Space& home, I& i, bool depends=true);
01492     template<class I>
01493     ModEvent narrow_v(Space& home, I& i, bool depends=true);
01495     template<class I>
01496     ModEvent inter_v(Space& home, I& i, bool depends=true);
01498     template<class I>
01499     ModEvent minus_v(Space& home, I& i, bool depends=true);
01501 
01503 
01504 
01505     int min(const Delta& d) const;
01507     int max(const Delta& d) const;
01509     unsigned int width(const Delta& d) const;
01511     bool any(const Delta& d) const;
01513     static bool zero(const Delta& d);
01515     static bool one(const Delta& d);
01517 
01519 
01520 
01521     static ModEventDelta med(ModEvent me);
01523   };
01524 
01529   template<class Char, class Traits>
01530   std::basic_ostream<Char,Traits>&
01531   operator <<(std::basic_ostream<Char,Traits>& os, const BoolView& x);
01532 
01533 
01534 
01543   class NegBoolView : public DerivedView<BoolView> {
01544   protected:
01545     using DerivedView<BoolView>::x;
01546   public:
01548 
01549 
01550     NegBoolView(void);
01552     explicit NegBoolView(const BoolView& y);
01554 
01556 
01557 
01558     static const int BITS = BoolView::BITS;
01560     static const BoolStatus ZERO = BoolView::ONE;
01562     static const BoolStatus ONE  = BoolView::ZERO;
01564     static const BoolStatus NONE = BoolView::NONE;
01566     BoolStatus status(void) const;
01568 
01570 
01571 
01572     bool zero(void) const;
01574     bool one(void) const;
01576     bool none(void) const;
01578 
01580 
01581 
01582     ModEvent one(Space& home);
01584     ModEvent zero(Space& home);
01586     ModEvent one_none(Space& home);
01588     ModEvent zero_none(Space& home);
01590 
01592 
01593 
01594     int min(void) const;
01596     int max(void) const;
01598     int val(void) const;
01599 #ifdef GECODE_HAS_CBS
01600 
01601     int baseval(int val) const;
01602 #endif
01603 
01604 
01606 
01607 
01608     int min(const Delta& d) const;
01610     int max(const Delta& d) const;
01612     unsigned int width(const Delta& d) const;
01614     bool any(const Delta& d) const;
01616     static bool zero(const Delta& d);
01618     static bool one(const Delta& d);
01620   };
01621 
01626   template<class Char, class Traits>
01627   std::basic_ostream<Char,Traits>&
01628   operator <<(std::basic_ostream<Char,Traits>& os, const NegBoolView& x);
01629 
01630 }}
01631 
01632 #include <gecode/int/var/int.hpp>
01633 #include <gecode/int/var/bool.hpp>
01634 
01635 #include <gecode/int/view/int.hpp>
01636 
01637 #include <gecode/int/view/constint.hpp>
01638 #include <gecode/int/view/zero.hpp>
01639 #include <gecode/int/view/minus.hpp>
01640 #include <gecode/int/view/offset.hpp>
01641 #include <gecode/int/view/scale.hpp>
01642 #include <gecode/int/view/cached.hpp>
01643 
01644 #include <gecode/int/view/bool.hpp>
01645 
01646 #include <gecode/int/view/neg-bool.hpp>
01647 
01648 #include <gecode/int/view/print.hpp>
01649 #include <gecode/int/var/print.hpp>
01650 
01651 namespace Gecode { namespace Int {
01652 
01659 
01660   enum RelTest {
01661     RT_FALSE = 0, 
01662     RT_MAYBE = 1, 
01663     RT_TRUE  = 2  
01664   };
01665 
01667   template<class VX, class VY> RelTest rtest_eq_bnd(VX x, VY y);
01669   template<class VX, class VY> RelTest rtest_eq_dom(VX x, VY y);
01671   template<class VX> RelTest rtest_eq_bnd(VX x, int n);
01673   template<class VX> RelTest rtest_eq_dom(VX x, int n);
01674 
01676   template<class VX, class VY> RelTest rtest_nq_bnd(VX x, VY y);
01678   template<class VX, class VY> RelTest rtest_nq_dom(VX x, VY y);
01680   template<class VX> RelTest rtest_nq_bnd(VX x, int n);
01682   template<class VX> RelTest rtest_nq_dom(VX x, int n);
01683 
01685   template<class VX, class VY> RelTest rtest_lq(VX x, VY y);
01687   template<class VX> RelTest rtest_lq(VX x, int n);
01688 
01690   template<class VX, class VY> RelTest rtest_le(VX x, VY y);
01692   template<class VX> RelTest rtest_le(VX x, int n);
01693 
01695   template<class VX, class VY> RelTest rtest_gq(VX x, VY y);
01697   template<class VX> RelTest rtest_gq(VX x, int n);
01698 
01700   template<class VX, class VY> RelTest rtest_gr(VX x, VY y);
01702   template<class VX> RelTest rtest_gr(VX x, int n);
01704 
01705 
01710   enum BoolTest {
01711     BT_NONE, 
01712     BT_SAME, 
01713     BT_COMP  
01714   };
01715 
01721 
01722   BoolTest bool_test(const BoolView& b0, const BoolView& b1);
01724   BoolTest bool_test(const BoolView& b0, const NegBoolView& b1);
01726   BoolTest bool_test(const NegBoolView& b0, const BoolView& b1);
01728   BoolTest bool_test(const NegBoolView& b0, const NegBoolView& b1);
01730 
01731 }}
01732 
01733 #include <gecode/int/view/rel-test.hpp>
01734 #include <gecode/int/view/bool-test.hpp>
01735 
01736 // STATISTICS: int-var