Generated on Mon May 10 06:46:35 2010 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: 2009-11-04 17:06:58 +0100 (Wed, 04 Nov 2009) $ by $Author: tack $
00011  *     $Revision: 10046 $
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 {
00118 
00119   namespace Int {
00120 
00137     class IntView : public VarViewBase<IntVarImp> {
00138     protected:
00139       using VarViewBase<IntVarImp>::varimp;
00140     public:
00142 
00143 
00144       IntView(void);
00146       IntView(const IntVar& x);
00148       IntView(IntVarImp* x);
00150 
00152 
00153 
00154       int min(void) const;
00156       int max(void) const;
00158       int med(void) const;
00160       int val(void) const;
00161 
00163       unsigned int size(void) const;
00165       unsigned int width(void) const;
00167       unsigned int regret_min(void) const;
00169       unsigned int regret_max(void) const;
00171 
00173 
00174 
00175       bool range(void) const;
00177       bool assigned(void) const;
00178 
00180       bool in(int n) const;
00182       bool in(double n) const;
00184 
00186 
00187 
00188       ModEvent lq(Space& home, int n);
00190       ModEvent lq(Space& home, double n);
00191 
00193       ModEvent le(Space& home, int n);
00195       ModEvent le(Space& home, double n);
00196 
00198       ModEvent gq(Space& home, int n);
00200       ModEvent gq(Space& home, double n);
00201 
00203       ModEvent gr(Space& home, int n);
00205       ModEvent gr(Space& home, double n);
00207       ModEvent nq(Space& home, int n);
00209       ModEvent nq(Space& home, double n);
00210 
00212       ModEvent eq(Space& home, int n);
00214       ModEvent eq(Space& home, double n);
00216 
00232 
00233       template<class I>
00234       ModEvent narrow_r(Space& home, I& i, bool depends=true);
00236       template<class I>
00237       ModEvent inter_r(Space& home, I& i, bool depends=true);
00239       template<class I>
00240       ModEvent minus_r(Space& home, I& i, bool depends=true);
00242       template<class I>
00243       ModEvent narrow_v(Space& home, I& i, bool depends=true);
00245       template<class I>
00246       ModEvent inter_v(Space& home, I& i, bool depends=true);
00248       template<class I>
00249       ModEvent minus_v(Space& home, I& i, bool depends=true);
00251 
00253 
00254 
00255       static ModEvent modevent(const Delta& d);
00257       int min(const Delta& d) const;
00259       int max(const Delta& d) const;
00261       bool any(const Delta& d) const;
00263 
00265 
00266 
00267       static ModEventDelta med(ModEvent me);
00269 
00271 
00272 
00273       void update(Space& home, bool share, IntView& x);
00275     };
00276 
00281     template<class Char, class Traits>
00282     std::basic_ostream<Char,Traits>&
00283     operator <<(std::basic_ostream<Char,Traits>& os, const IntView& x);
00284 
00285   }
00286 
00293   template<>
00294   class ViewVarImpTraits<Int::IntView> {
00295   public:
00297     typedef Int::IntVarImp VarImp;
00298   };
00299 
00305   template<>
00306   class VarViewTraits<IntVar> {
00307   public:
00309     typedef Int::IntView View;
00310   };
00311 
00312   namespace Int {
00313 
00321     class MinusView : public DerivedViewBase<IntView> {
00322     protected:
00323       using DerivedViewBase<IntView>::view;
00324     public:
00326 
00327 
00328       MinusView(void);
00330       explicit MinusView(const IntView& x);
00332       void init(const IntView& x);
00334 
00336 
00337 
00338       int min(void) const;
00340       int max(void) const;
00342       int med(void) const;
00344       int val(void) const;
00345 
00347       unsigned int size(void) const;
00349       unsigned int width(void) const;
00351       unsigned int regret_min(void) const;
00353       unsigned int regret_max(void) const;
00355 
00357 
00358 
00359       bool range(void) const;
00361       bool assigned(void) const;
00362 
00364       bool in(int n) const;
00366       bool in(double n) const;
00368 
00370 
00371 
00372       ModEvent lq(Space& home, int n);
00374       ModEvent lq(Space& home, double n);
00376       ModEvent le(Space& home, int n);
00378       ModEvent le(Space& home, double n);
00380       ModEvent gq(Space& home, int n);
00382       ModEvent gq(Space& home, double n);
00384       ModEvent gr(Space& home, int n);
00386       ModEvent gr(Space& home, double n);
00388       ModEvent nq(Space& home, int n);
00390       ModEvent nq(Space& home, double n);
00392       ModEvent eq(Space& home, int n);
00394       ModEvent eq(Space& home, double n);
00396 
00412 
00413       template<class I>
00414       ModEvent narrow_r(Space& home, I& i, bool depends=true);
00416       template<class I>
00417       ModEvent inter_r(Space& home, I& i, bool depends=true);
00419       template<class I>
00420       ModEvent minus_r(Space& home, I& i, bool depends=true);
00422       template<class I>
00423       ModEvent narrow_v(Space& home, I& i, bool depends=true);
00425       template<class I>
00426       ModEvent inter_v(Space& home, I& i, bool depends=true);
00428       template<class I>
00429       ModEvent minus_v(Space& home, I& i, bool depends=true);
00431 
00433 
00434 
00435       static void schedule(Space& home, Propagator& p, ModEvent me);
00437       static ModEvent me(const ModEventDelta& med);
00439       static ModEventDelta med(ModEvent me);
00441 
00443 
00444 
00451       void subscribe(Space& home, Propagator& p, PropCond pc, bool process=true);
00453       void cancel(Space& home, Propagator& p, PropCond pc);
00455       void subscribe(Space& home, Advisor& a);
00457       void cancel(Space& home, Advisor& a);
00459 
00461 
00462 
00463       static ModEvent modevent(const Delta& d);
00465       int min(const Delta& d) const;
00467       int max(const Delta& d) const;
00469       bool any(const Delta& d) const;
00471 
00473 
00474 
00475       void update(Space& home, bool share, MinusView& x);
00477     };
00478 
00483     template<class Char, class Traits>
00484     std::basic_ostream<Char,Traits>&
00485     operator <<(std::basic_ostream<Char,Traits>& os, const MinusView& x);
00486 
00487   }
00488 
00493 
00494   bool same(const Int::MinusView& x, const Int::MinusView& y);
00496   bool before(const Int::MinusView& x, const Int::MinusView& y);
00498 
00505   template<>
00506   class ViewVarImpTraits<Int::MinusView> {
00507   public:
00509     typedef Int::IntVarImp VarImp;
00510   };
00511 
00512 
00513   namespace Int {
00514 
00523     class OffsetView : public DerivedViewBase<IntView> {
00524     protected:
00526       int c;
00527       using DerivedViewBase<IntView>::view;
00528     public:
00530 
00531 
00532       OffsetView(void);
00534       OffsetView(const IntView& x, int c);
00536       void init(const IntView& x, int c);
00538       int offset(void) const;
00540 
00542 
00543 
00544       int min(void) const;
00546       int max(void) const;
00548       int med(void) const;
00550       int val(void) const;
00551 
00553       unsigned int size(void) const;
00555       unsigned int width(void) const;
00557       unsigned int regret_min(void) const;
00559       unsigned int regret_max(void) const;
00561 
00563 
00564 
00565       bool range(void) const;
00567       bool assigned(void) const;
00568 
00570       bool in(int n) const;
00572       bool in(double n) const;
00574 
00576 
00577 
00578       ModEvent lq(Space& home, int n);
00580       ModEvent lq(Space& home, double n);
00582       ModEvent le(Space& home, int n);
00584       ModEvent le(Space& home, double n);
00586       ModEvent gq(Space& home, int n);
00588       ModEvent gq(Space& home, double n);
00590       ModEvent gr(Space& home, int n);
00592       ModEvent gr(Space& home, double n);
00594       ModEvent nq(Space& home, int n);
00596       ModEvent nq(Space& home, double n);
00598       ModEvent eq(Space& home, int n);
00600       ModEvent eq(Space& home, double n);
00602 
00618 
00619       template<class I>
00620       ModEvent narrow_r(Space& home, I& i, bool depends=true);
00622       template<class I>
00623       ModEvent inter_r(Space& home, I& i, bool depends=true);
00625       template<class I>
00626       ModEvent minus_r(Space& home, I& i, bool depends=true);
00628       template<class I>
00629       ModEvent narrow_v(Space& home, I& i, bool depends=true);
00631       template<class I>
00632       ModEvent inter_v(Space& home, I& i, bool depends=true);
00634       template<class I>
00635       ModEvent minus_v(Space& home, I& i, bool depends=true);
00637 
00639 
00640 
00641       static void schedule(Space& home, Propagator& p, ModEvent me);
00643       static ModEvent me(const ModEventDelta& med);
00645       static ModEventDelta med(ModEvent me);
00647 
00649 
00650 
00657       void subscribe(Space& home, Propagator& p, PropCond pc, bool process=true);
00659       void cancel(Space& home, Propagator& p, PropCond pc);
00661       void subscribe(Space& home, Advisor& a);
00663       void cancel(Space& home, Advisor& a);
00665 
00667 
00668 
00669       static ModEvent modevent(const Delta& d);
00671       int min(const Delta& d) const;
00673       int max(const Delta& d) const;
00675       bool any(const Delta& d) const;
00677 
00679 
00680 
00681       void update(Space& home, bool share, OffsetView& x);
00683     };
00684 
00689     template<class Char, class Traits>
00690     std::basic_ostream<Char,Traits>&
00691     operator <<(std::basic_ostream<Char,Traits>& os, const OffsetView& x);
00692 
00693   }
00694 
00699 
00700   bool same(const Int::OffsetView& x, const Int::OffsetView& y);
00702   bool before(const Int::OffsetView& x, const Int::OffsetView& y);
00704 
00711   template<>
00712   class ViewVarImpTraits<Int::OffsetView> {
00713   public:
00715     typedef Int::IntVarImp VarImp;
00716   };
00717 
00718 
00719 
00720   namespace Int {
00721 
00747     template<class Val, class UnsVal>
00748     class ScaleView : public DerivedViewBase<IntView> {
00749     protected:
00751       int a;
00752       using DerivedViewBase<IntView>::view;
00753 
00755 
00756 
00757       int floor_div(double x) const;
00759       int ceil_div(double x) const;
00761       int exact_div(double x, bool& exact) const;
00762 #if GECODE_INT_RND_TWDS_ZERO
00763 
00764       int floor_div(int) const;
00766       int ceil_div(int) const;
00768       int exact_div(int, bool&) const;
00769 #endif
00770 
00771 
00772     public:
00774 
00775 
00776       ScaleView(void);
00778       ScaleView(int b, const IntView& y);
00780       void init(int b, const IntView& y);
00782       int scale(void) const;
00784 
00785 
00787 
00788 
00789       Val min(void) const;
00791       Val max(void) const;
00793       Val med(void) const;
00795       Val val(void) const;
00796 
00798       UnsVal size(void) const;
00800       UnsVal width(void) const;
00802       UnsVal regret_min(void) const;
00804       UnsVal regret_max(void) const;
00806 
00808 
00809 
00810       bool range(void) const;
00812       bool assigned(void) const;
00814       bool in(Val n) const;
00816 
00818 
00819 
00820       ModEvent lq(Space& home, Val n);
00822       ModEvent le(Space& home, Val n);
00824       ModEvent gq(Space& home, Val n);
00826       ModEvent gr(Space& home, Val n);
00828       ModEvent nq(Space& home, Val n);
00830       ModEvent eq(Space& home, Val n);
00832 
00834 
00835 
00836       static void schedule(Space& home, Propagator& p, ModEvent me);
00838       static ModEvent me(const ModEventDelta& med);
00840       static ModEventDelta med(ModEvent me);
00842 
00844 
00845 
00852       void subscribe(Space& home, Propagator& p, PropCond pc, bool process=true);
00854       void cancel(Space& home, Propagator& p, PropCond pc);
00856       void subscribe(Space& home, Advisor& a);
00858       void cancel(Space& home, Advisor& a);
00860 
00862 
00863 
00864       static ModEvent modevent(const Delta& d);
00866       Val min(const Delta& d) const;
00868       Val max(const Delta& d) const;
00870       bool any(const Delta& d) const;
00872 
00874 
00875 
00876       void update(Space& home, bool share, ScaleView<Val,UnsVal>& x);
00878     };
00879 
00884     typedef ScaleView<int,unsigned int> IntScaleView;
00885 
00890     typedef ScaleView<double,double> DoubleScaleView;
00891 
00896     template<class Char, class Traits>
00897     std::basic_ostream<Char,Traits>&
00898     operator <<(std::basic_ostream<Char,Traits>& os, const IntScaleView& x);
00899 
00904     template<class Char, class Traits>
00905     std::basic_ostream<Char,Traits>&
00906     operator <<(std::basic_ostream<Char,Traits>& os, const DoubleScaleView& x);
00907 
00908   }
00909 
00914 
00915   template<class Val, class UnsVal>
00916   bool same(const Int::ScaleView<Val,UnsVal>& x,
00917             const Int::ScaleView<Val,UnsVal>& y);
00919   template<class Val, class UnsVal>
00920   bool before(const Int::ScaleView<Val,UnsVal>& x,
00921               const Int::ScaleView<Val,UnsVal>& y);
00923 
00924 
00931   template<class Val, class UnsVal>
00932   class ViewVarImpTraits<Int::ScaleView<Val,UnsVal> > {
00933   public:
00935     typedef Int::IntVarImp VarImp;
00936   };
00937 
00938 
00939 
00940   namespace Int {
00941 
00949     class ConstIntView : public ConstViewBase {
00950     protected:
00951       int x;
00952     public:
00954 
00955 
00956       ConstIntView(void);
00958       ConstIntView(int n);
00960       void init(int n);
00962 
00964 
00965 
00966       int min(void) const;
00968       int max(void) const;
00970       int med(void) const;
00972       int val(void) const;
00973 
00975       unsigned int size(void) const;
00977       unsigned int width(void) const;
00979       unsigned int regret_min(void) const;
00981       unsigned int regret_max(void) const;
00983 
00985 
00986 
00987       bool range(void) const;
00989       bool assigned(void) const;
00990 
00992       bool in(int n) const;
00994       bool in(double n) const;
00996 
00998 
00999 
01000       ModEvent lq(Space& home, int n);
01002       ModEvent lq(Space& home, double n);
01004       ModEvent le(Space& home, int n);
01006       ModEvent le(Space& home, double n);
01008       ModEvent gq(Space& home, int n);
01010       ModEvent gq(Space& home, double n);
01012       ModEvent gr(Space& home, int n);
01014       ModEvent gr(Space& home, double n);
01016       ModEvent nq(Space& home, int n);
01018       ModEvent nq(Space& home, double n);
01020       ModEvent eq(Space& home, int n);
01022       ModEvent eq(Space& home, double n);
01024 
01040 
01041       template<class I>
01042       ModEvent narrow_r(Space& home, I& i, bool depends=true);
01044       template<class I>
01045       ModEvent inter_r(Space& home, I& i, bool depends=true);
01047       template<class I>
01048       ModEvent minus_r(Space& home, I& i, bool depends=true);
01050       template<class I>
01051       ModEvent narrow_v(Space& home, I& i, bool depends=true);
01053       template<class I>
01054       ModEvent inter_v(Space& home, I& i, bool depends=true);
01056       template<class I>
01057       ModEvent minus_v(Space& home, I& i, bool depends=true);
01059 
01061 
01062 
01063       static void schedule(Space& home, Propagator& p, ModEvent me);
01065       static ModEvent me(const ModEventDelta& med);
01067       static ModEventDelta med(ModEvent me);
01069 
01071 
01072 
01079       void subscribe(Space& home, Propagator& p, PropCond pc, bool process=true);
01081       void cancel(Space& home, Propagator& p, PropCond pc);
01083       void subscribe(Space& home, Advisor& a);
01085       void cancel(Space& home, Advisor& a);
01087 
01089 
01090 
01091       static ModEvent modevent(const Delta& d);
01093       int min(const Delta& d) const;
01095       int max(const Delta& d) const;
01097       bool any(const Delta& d) const;
01099 
01101 
01102 
01103       void update(Space& home, bool share, ConstIntView& x);
01105     };
01106 
01111     template<class Char, class Traits>
01112     std::basic_ostream<Char,Traits>&
01113     operator <<(std::basic_ostream<Char,Traits>& os, const ConstIntView& x);
01114 
01115   }
01116 
01122 
01123   bool same(const Int::ConstIntView& x, const Int::ConstIntView& y);
01125   bool before(const Int::ConstIntView& x, const Int::ConstIntView& y);
01127 
01134   template<>
01135   class ViewVarImpTraits<Int::ConstIntView> {
01136   public:
01138     typedef VarImpBase VarImp;
01139   };
01140 
01141   namespace Int {
01142 
01150     class ZeroIntView : public ConstViewBase {
01151     public:
01153 
01154 
01155       ZeroIntView(void);
01157       void init(void);
01159 
01161 
01162 
01163       int min(void) const;
01165       int max(void) const;
01167       int med(void) const;
01169       int val(void) const;
01170 
01172       unsigned int size(void) const;
01174       unsigned int width(void) const;
01176       unsigned int regret_min(void) const;
01178       unsigned int regret_max(void) const;
01180 
01182 
01183 
01184       bool range(void) const;
01186       bool assigned(void) const;
01187 
01189       bool in(int n) const;
01191       bool in(double n) const;
01193 
01195 
01196 
01197       ModEvent lq(Space& home, int n);
01199       ModEvent lq(Space& home, double n);
01201       ModEvent le(Space& home, int n);
01203       ModEvent le(Space& home, double n);
01205       ModEvent gq(Space& home, int n);
01207       ModEvent gq(Space& home, double n);
01209       ModEvent gr(Space& home, int n);
01211       ModEvent gr(Space& home, double n);
01213       ModEvent nq(Space& home, int n);
01215       ModEvent nq(Space& home, double n);
01217       ModEvent eq(Space& home, int n);
01219       ModEvent eq(Space& home, double n);
01221 
01237 
01238       template<class I>
01239       ModEvent narrow_r(Space& home, I& i, bool depends=true);
01241       template<class I>
01242       ModEvent inter_r(Space& home, I& i, bool depends=true);
01244       template<class I>
01245       ModEvent minus_r(Space& home, I& i, bool depends=true);
01247       template<class I>
01248       ModEvent narrow_v(Space& home, I& i, bool depends=true);
01250       template<class I>
01251       ModEvent inter_v(Space& home, I& i, bool depends=true);
01253       template<class I>
01254       ModEvent minus_v(Space& home, I& i, bool depends=true);
01256 
01258 
01259 
01260       static void schedule(Space& home, Propagator& p, ModEvent me);
01262       static ModEvent me(const ModEventDelta& med);
01264       static ModEventDelta med(ModEvent me);
01266 
01268 
01269 
01276       void subscribe(Space& home, Propagator& p, PropCond pc, bool process=true);
01278       void cancel(Space& home, Propagator& p, PropCond pc);
01280       void subscribe(Space& home, Advisor& a);
01282       void cancel(Space& home, Advisor& a);
01284 
01286 
01287 
01288       static ModEvent modevent(const Delta& d);
01290       int min(const Delta& d) const;
01292       int max(const Delta& d) const;
01294       bool any(const Delta& d) const;
01296 
01298 
01299 
01300       void update(Space& home, bool share, ZeroIntView& x);
01302     };
01303 
01308     template<class Char, class Traits>
01309     std::basic_ostream<Char,Traits>&
01310     operator <<(std::basic_ostream<Char,Traits>& os, const ZeroIntView& x);
01311 
01312   }
01313 
01319 
01320   bool same(const Int::ZeroIntView& x, const Int::ZeroIntView& y);
01322   bool before(const Int::ZeroIntView& x, const Int::ZeroIntView& y);
01324 
01331   template<>
01332   class ViewVarImpTraits<Int::ZeroIntView> {
01333   public:
01335     typedef VarImpBase VarImp;
01336   };
01337 
01338   namespace Int {
01339 
01346     class BoolView : public VarViewBase<BoolVarImp> {
01347     protected:
01348       using VarViewBase<BoolVarImp>::varimp;
01349     public:
01351 
01352 
01353       BoolView(void);
01355       BoolView(const BoolVar& x);
01357       BoolView(BoolVarImp* x);
01359 
01361 
01362 
01363       static const int BITS = BoolVarImp::BITS;
01365       static const BoolStatus ZERO = BoolVarImp::ZERO;
01367       static const BoolStatus ONE  = BoolVarImp::ONE;
01369       static const BoolStatus NONE = BoolVarImp::NONE;
01371       BoolStatus status(void) const;
01373 
01375 
01376 
01377       int min(void) const;
01379       int max(void) const;
01381       int med(void) const;
01383       int val(void) const;
01384 
01386       unsigned int size(void) const;
01388       unsigned int width(void) const;
01390       unsigned int regret_min(void) const;
01392       unsigned int regret_max(void) const;
01394 
01396 
01397 
01398       bool range(void) const;
01400       bool assigned(void) const;
01401 
01403       bool in(int n) const;
01405       bool in(double n) const;
01407 
01409 
01410 
01411       bool zero(void) const;
01413       bool one(void) const;
01415       bool none(void) const;
01417 
01419 
01420 
01421       ModEvent one(Space& home);
01423       ModEvent zero(Space& home);
01425       ModEvent one_none(Space& home);
01427       ModEvent zero_none(Space& home);
01429 
01431 
01432 
01433       ModEvent lq(Space& home, int n);
01435       ModEvent lq(Space& home, double n);
01436 
01438       ModEvent le(Space& home, int n);
01440       ModEvent le(Space& home, double n);
01441 
01443       ModEvent gq(Space& home, int n);
01445       ModEvent gq(Space& home, double n);
01446 
01448       ModEvent gr(Space& home, int n);
01450       ModEvent gr(Space& home, double n);
01451 
01453       ModEvent nq(Space& home, int n);
01455       ModEvent nq(Space& home, double n);
01456 
01458       ModEvent eq(Space& home, int n);
01460       ModEvent eq(Space& home, double n);
01462 
01478 
01479       template<class I>
01480       ModEvent narrow_r(Space& home, I& i, bool depends=true);
01482       template<class I>
01483       ModEvent inter_r(Space& home, I& i, bool depends=true);
01485       template<class I>
01486       ModEvent minus_r(Space& home, I& i, bool depends=true);
01488       template<class I>
01489       ModEvent narrow_v(Space& home, I& i, bool depends=true);
01491       template<class I>
01492       ModEvent inter_v(Space& home, I& i, bool depends=true);
01494       template<class I>
01495       ModEvent minus_v(Space& home, I& i, bool depends=true);
01497 
01499 
01500 
01501       static ModEvent modevent(const Delta& d);
01503       int min(const Delta& d) const;
01505       int max(const Delta& d) const;
01507       bool any(const Delta& d) const;
01509       static bool zero(const Delta& d);
01511       static bool one(const Delta& d);
01513 
01515 
01516 
01517       static ModEventDelta med(ModEvent me);
01519 
01521 
01522 
01523       void update(Space& home, bool share, BoolView& x);
01525     };
01526 
01531     template<class Char, class Traits>
01532     std::basic_ostream<Char,Traits>&
01533     operator <<(std::basic_ostream<Char,Traits>& os, const BoolView& x);
01534 
01535   }
01536 
01543   template<>
01544   class ViewVarImpTraits<Int::BoolView> {
01545   public:
01547     typedef Int::BoolVarImp VarImp;
01548   };
01549 
01555   template<>
01556   class VarViewTraits<BoolVar> {
01557   public:
01559     typedef Int::BoolView View;
01560   };
01561 
01562   namespace Int {
01563 
01572     class NegBoolView : public DerivedViewBase<BoolView> {
01573     protected:
01574       using DerivedViewBase<BoolView>::view;
01575     public:
01577 
01578 
01579       NegBoolView(void);
01581       explicit NegBoolView(const BoolView& b);
01583       void init(const BoolView& b);
01585 
01587 
01588 
01589       static const int BITS = BoolView::BITS;
01591       static const BoolStatus ZERO = BoolView::ONE;
01593       static const BoolStatus ONE  = BoolView::ZERO;
01595       static const BoolStatus NONE = BoolView::NONE;
01597       BoolStatus status(void) const;
01599 
01601 
01602 
01603       bool zero(void) const;
01605       bool one(void) const;
01607       bool none(void) const;
01609 
01611 
01612 
01613       ModEvent one(Space& home);
01615       ModEvent zero(Space& home);
01617       ModEvent one_none(Space& home);
01619       ModEvent zero_none(Space& home);
01621 
01623 
01624 
01625       int min(void) const;
01627       int max(void) const;
01629       int val(void) const;
01631 
01633 
01634 
01635       bool assigned(void) const;
01637 
01639 
01640 
01641       static void schedule(Space& home, Propagator& p, ModEvent me);
01643       static ModEvent me(const ModEventDelta& med);
01645       static ModEventDelta med(ModEvent me);
01647 
01649 
01650 
01657       void subscribe(Space& home, Propagator& p, PropCond pc, bool process=true);
01659       void cancel(Space& home, Propagator& p, PropCond pc);
01661       void subscribe(Space& home, Advisor& a);
01663       void cancel(Space& home, Advisor& a);
01665 
01667 
01668 
01669       static ModEvent modevent(const Delta& d);
01671       int min(const Delta& d) const;
01673       int max(const Delta& d) const;
01675       bool any(const Delta& d) const;
01677       static bool zero(const Delta& d);
01679       static bool one(const Delta& d);
01681 
01683 
01684 
01685       void update(Space& home, bool share, NegBoolView& x);
01687     };
01688 
01693     template<class Char, class Traits>
01694     std::basic_ostream<Char,Traits>&
01695     operator <<(std::basic_ostream<Char,Traits>& os, const NegBoolView& x);
01696 
01697 
01698   }
01699 
01704 
01705   bool same(const Int::NegBoolView& x, const Int::NegBoolView& y);
01707   bool before(const Int::NegBoolView& x, const Int::NegBoolView& y);
01709 
01716   template<>
01717   class ViewVarImpTraits<Int::NegBoolView> {
01718   public:
01720     typedef Int::BoolVarImp VarImp;
01721   };
01722 
01723 }
01724 
01725 #include <gecode/int/var/int.hpp>
01726 #include <gecode/int/var/bool.hpp>
01727 
01728 #include <gecode/int/view/int.hpp>
01729 
01730 #include <gecode/int/view/constint.hpp>
01731 #include <gecode/int/view/zero.hpp>
01732 #include <gecode/int/view/minus.hpp>
01733 #include <gecode/int/view/offset.hpp>
01734 #include <gecode/int/view/scale.hpp>
01735 
01736 #include <gecode/int/view/bool.hpp>
01737 
01738 #include <gecode/int/view/neg-bool.hpp>
01739 
01740 #include <gecode/int/view/print.hpp>
01741 #include <gecode/int/var/print.hpp>
01742 
01743 namespace Gecode {
01744 
01745   namespace Int {
01746 
01753 
01754     enum RelTest {
01755       RT_FALSE = 0, 
01756       RT_MAYBE = 1, 
01757       RT_TRUE  = 2  
01758     };
01759 
01761     template<class View> RelTest rtest_eq_bnd(View x, View y);
01763     template<class View> RelTest rtest_eq_dom(View x, View y);
01765     template<class View> RelTest rtest_eq_bnd(View x, int n);
01767     template<class View> RelTest rtest_eq_dom(View x, int n);
01768 
01770     template<class View> RelTest rtest_nq_bnd(View x, View y);
01772     template<class View> RelTest rtest_nq_dom(View x, View y);
01774     template<class View> RelTest rtest_nq_bnd(View x, int n);
01776     template<class View> RelTest rtest_nq_dom(View x, int n);
01777 
01779     template<class View> RelTest rtest_lq(View x, View y);
01781     template<class View> RelTest rtest_lq(View x, int n);
01782 
01784     template<class View> RelTest rtest_le(View x, View y);
01786     template<class View> RelTest rtest_le(View x, int n);
01787 
01789     template<class View> RelTest rtest_gq(View x, View y);
01791     template<class View> RelTest rtest_gq(View x, int n);
01792 
01794     template<class View> RelTest rtest_gr(View x, View y);
01796     template<class View> RelTest rtest_gr(View x, int n);
01798 
01799 
01804     enum BoolTest {
01805       BT_NONE, 
01806       BT_SAME, 
01807       BT_COMP  
01808     };
01809 
01815 
01816     BoolTest bool_test(const BoolView& b0, const BoolView& b1);
01818     BoolTest bool_test(const BoolView& b0, const NegBoolView& b1);
01820     BoolTest bool_test(const NegBoolView& b0, const BoolView& b1);
01822     BoolTest bool_test(const NegBoolView& b0, const NegBoolView& b1);
01824 
01825   }
01826 
01827 }
01828 
01829 #include <gecode/int/view/rel-test.hpp>
01830 #include <gecode/int/view/bool-test.hpp>
01831 
01832 // STATISTICS: int-var