00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
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
00429
00430 bool operator ==(const MinusView& x, const MinusView& y);
00432 bool operator !=(const MinusView& x, const MinusView& y);
00434
00443 class OffsetView : public DerivedView<IntView> {
00444 protected:
00446 int c;
00447 using DerivedView<IntView>::x;
00448 public:
00450
00451
00452 OffsetView(void);
00454 OffsetView(const IntView& y, int c);
00456
00458
00459
00460 int offset(void) const;
00462 void offset(int n);
00464 int min(void) const;
00466 int max(void) const;
00468 int med(void) const;
00470 int val(void) const;
00471 #ifdef GECODE_HAS_CBS
00472
00473 int baseval(int val) const;
00474 #endif
00475
00477 unsigned int size(void) const;
00479 unsigned int width(void) const;
00481 unsigned int regret_min(void) const;
00483 unsigned int regret_max(void) const;
00485
00487
00488
00489 bool range(void) const;
00490
00492 bool in(int n) const;
00494 bool in(long long int n) const;
00496
00498
00499
00500 ModEvent lq(Space& home, int n);
00502 ModEvent lq(Space& home, long long int n);
00503
00505 ModEvent le(Space& home, int n);
00507 ModEvent le(Space& home, long long int n);
00508
00510 ModEvent gq(Space& home, int n);
00512 ModEvent gq(Space& home, long long int n);
00513
00515 ModEvent gr(Space& home, int n);
00517 ModEvent gr(Space& home, long long int n);
00518
00520 ModEvent nq(Space& home, int n);
00522 ModEvent nq(Space& home, long long int n);
00523
00525 ModEvent eq(Space& home, int n);
00527 ModEvent eq(Space& home, long long int n);
00529
00545
00546 template<class I>
00547 ModEvent narrow_r(Space& home, I& i, bool depends=true);
00549 template<class I>
00550 ModEvent inter_r(Space& home, I& i, bool depends=true);
00552 template<class I>
00553 ModEvent minus_r(Space& home, I& i, bool depends=true);
00555 template<class I>
00556 ModEvent narrow_v(Space& home, I& i, bool depends=true);
00558 template<class I>
00559 ModEvent inter_v(Space& home, I& i, bool depends=true);
00561 template<class I>
00562 ModEvent minus_v(Space& home, I& i, bool depends=true);
00564
00566
00567
00568 static ModEventDelta med(ModEvent me);
00570
00572
00573
00574 int min(const Delta& d) const;
00576 int max(const Delta& d) const;
00578 unsigned int width(const Delta& d) const;
00580 bool any(const Delta& d) const;
00582
00584
00585
00586 void update(Space& home, OffsetView& y);
00588
00590
00591
00592 bool operator <(const OffsetView& y) const;
00594 };
00595
00600 template<class Char, class Traits>
00601 std::basic_ostream<Char,Traits>&
00602 operator <<(std::basic_ostream<Char,Traits>& os, const OffsetView& x);
00603
00608
00609 bool operator ==(const OffsetView& x, const OffsetView& y);
00611 bool operator !=(const OffsetView& x, const OffsetView& y);
00613
00617 template<class View>
00618 class NoOffset {
00619 public:
00621 typedef View ViewType;
00623 View& operator ()(View& x);
00625 void update(const NoOffset&);
00627 int offset(void) const;
00628 };
00629
00630 template<class View>
00631 forceinline View&
00632 NoOffset<View>::operator ()(View& x) {
00633 return x;
00634 }
00635
00636 template<class View>
00637 forceinline void
00638 NoOffset<View>::update(const NoOffset&) {}
00639
00640 template<class View>
00641 forceinline int
00642 NoOffset<View>::offset(void) const {
00643 return 0;
00644 }
00645
00646
00650 class Offset {
00651 public:
00653 typedef OffsetView ViewType;
00655 int c;
00657 Offset(int off = 0);
00659 OffsetView operator()(IntView& x);
00661 void update(const Offset& o);
00663 int offset(void) const;
00664 };
00665
00666 forceinline
00667 Offset::Offset(int off) : c(off) {}
00668
00669 forceinline void
00670 Offset::update(const Offset& o) { c = o.c; }
00671
00672 forceinline int
00673 Offset::offset(void) const { return c; }
00674
00675 forceinline OffsetView
00676 Offset::operator ()(IntView& x) {
00677 return OffsetView(x,c);
00678 }
00679
00703 template<class Val, class UnsVal>
00704 class ScaleView : public DerivedView<IntView> {
00705 protected:
00706 using DerivedView<IntView>::x;
00708 int a;
00709 public:
00711
00712
00713 ScaleView(void);
00715 ScaleView(int b, const IntView& y);
00717
00719
00720
00721 int scale(void) const;
00723 Val min(void) const;
00725 Val max(void) const;
00727 Val med(void) const;
00729 Val val(void) const;
00730 #ifdef GECODE_HAS_CBS
00731
00732 Val baseval(Val val) const;
00733 #endif
00734
00736 UnsVal size(void) const;
00738 UnsVal width(void) const;
00740 UnsVal regret_min(void) const;
00742 UnsVal regret_max(void) const;
00744
00746
00747
00748 bool range(void) const;
00750 bool in(Val n) const;
00752
00754
00755
00756 ModEvent lq(Space& home, Val n);
00758 ModEvent le(Space& home, Val n);
00760 ModEvent gq(Space& home, Val n);
00762 ModEvent gr(Space& home, Val n);
00764 ModEvent nq(Space& home, Val n);
00766 ModEvent eq(Space& home, Val n);
00768
00770
00771
00772 static ModEventDelta med(ModEvent me);
00774
00776
00777
00778 Val min(const Delta& d) const;
00780 Val max(const Delta& d) const;
00782 UnsVal width(const Delta& d) const;
00784 bool any(const Delta& d) const;
00786
00788
00789
00790 void update(Space& home, ScaleView<Val,UnsVal>& y);
00792
00794
00795
00796 bool operator <(const ScaleView<Val,UnsVal>& y) const;
00798 };
00799
00804 typedef ScaleView<int,unsigned int> IntScaleView;
00805
00810 typedef ScaleView<long long int,unsigned long long int> LLongScaleView;
00811
00816 template<class Char, class Traits>
00817 std::basic_ostream<Char,Traits>&
00818 operator <<(std::basic_ostream<Char,Traits>& os, const IntScaleView& x);
00819
00824 template<class Char, class Traits>
00825 std::basic_ostream<Char,Traits>&
00826 operator <<(std::basic_ostream<Char,Traits>& os, const LLongScaleView& x);
00827
00832
00833 template<class Val, class UnsVal>
00834 bool operator ==(const ScaleView<Val,UnsVal>& x,
00835 const ScaleView<Val,UnsVal>& y);
00837 template<class Val, class UnsVal>
00838 bool operator !=(const ScaleView<Val,UnsVal>& x,
00839 const ScaleView<Val,UnsVal>& y);
00841
00842
00843
00851 class ConstIntView : public ConstView<IntView> {
00852 protected:
00853 int x;
00854 public:
00856
00857
00858 ConstIntView(void);
00860 ConstIntView(int n);
00862
00864
00865
00866 int min(void) const;
00868 int max(void) const;
00870 int med(void) const;
00872 int val(void) const;
00873
00875 unsigned int size(void) const;
00877 unsigned int width(void) const;
00879 unsigned int regret_min(void) const;
00881 unsigned int regret_max(void) const;
00883
00885
00886
00887 bool range(void) const;
00889 bool in(int n) const;
00891 bool in(long long int n) const;
00893
00895
00896
00897 ModEvent lq(Space& home, int n);
00899 ModEvent lq(Space& home, long long int n);
00900
00902 ModEvent le(Space& home, int n);
00904 ModEvent le(Space& home, long long int n);
00905
00907 ModEvent gq(Space& home, int n);
00909 ModEvent gq(Space& home, long long int n);
00910
00912 ModEvent gr(Space& home, int n);
00914 ModEvent gr(Space& home, long long int n);
00915
00917 ModEvent nq(Space& home, int n);
00919 ModEvent nq(Space& home, long long int n);
00920
00922 ModEvent eq(Space& home, int n);
00924 ModEvent eq(Space& home, long long int n);
00926
00942
00943 template<class I>
00944 ModEvent narrow_r(Space& home, I& i, bool depends=true);
00946 template<class I>
00947 ModEvent inter_r(Space& home, I& i, bool depends=true);
00949 template<class I>
00950 ModEvent minus_r(Space& home, I& i, bool depends=true);
00952 template<class I>
00953 ModEvent narrow_v(Space& home, I& i, bool depends=true);
00955 template<class I>
00956 ModEvent inter_v(Space& home, I& i, bool depends=true);
00958 template<class I>
00959 ModEvent minus_v(Space& home, I& i, bool depends=true);
00961
00963
00964
00965 int min(const Delta& d) const;
00967 int max(const Delta& d) const;
00969 unsigned int width(const Delta& d) const;
00971 bool any(const Delta& d) const;
00973
00975
00976
00977 void update(Space& home, ConstIntView& y);
00979
00981
00982
00983 bool operator <(const ConstIntView& y) const;
00985 };
00986
00991 template<class Char, class Traits>
00992 std::basic_ostream<Char,Traits>&
00993 operator <<(std::basic_ostream<Char,Traits>& os, const ConstIntView& x);
00994
01000
01001 bool operator ==(const ConstIntView& x, const ConstIntView& y);
01003 bool operator !=(const ConstIntView& x, const ConstIntView& y);
01005
01006
01014 class ZeroIntView : public ConstView<IntView> {
01015 public:
01017
01018
01019 ZeroIntView(void);
01021
01023
01024
01025 int min(void) const;
01027 int max(void) const;
01029 int med(void) const;
01031 int val(void) const;
01032
01034 unsigned int size(void) const;
01036 unsigned int width(void) const;
01038 unsigned int regret_min(void) const;
01040 unsigned int regret_max(void) const;
01042
01044
01045
01046 bool range(void) const;
01048 bool in(int n) const;
01050 bool in(long long int n) const;
01052
01054
01055
01056 ModEvent lq(Space& home, int n);
01058 ModEvent lq(Space& home, long long int n);
01059
01061 ModEvent le(Space& home, int n);
01063 ModEvent le(Space& home, long long int n);
01064
01066 ModEvent gq(Space& home, int n);
01068 ModEvent gq(Space& home, long long int n);
01069
01071 ModEvent gr(Space& home, int n);
01073 ModEvent gr(Space& home, long long int n);
01074
01076 ModEvent nq(Space& home, int n);
01078 ModEvent nq(Space& home, long long int n);
01079
01081 ModEvent eq(Space& home, int n);
01083 ModEvent eq(Space& home, long long int n);
01085
01101
01102 template<class I>
01103 ModEvent narrow_r(Space& home, I& i, bool depends=true);
01105 template<class I>
01106 ModEvent inter_r(Space& home, I& i, bool depends=true);
01108 template<class I>
01109 ModEvent minus_r(Space& home, I& i, bool depends=true);
01111 template<class I>
01112 ModEvent narrow_v(Space& home, I& i, bool depends=true);
01114 template<class I>
01115 ModEvent inter_v(Space& home, I& i, bool depends=true);
01117 template<class I>
01118 ModEvent minus_v(Space& home, I& i, bool depends=true);
01120
01122
01123
01124 int min(const Delta& d) const;
01126 int max(const Delta& d) const;
01128 unsigned int width(const Delta& d) const;
01130 bool any(const Delta& d) const;
01132 };
01133
01138 template<class Char, class Traits>
01139 std::basic_ostream<Char,Traits>&
01140 operator <<(std::basic_ostream<Char,Traits>& os, const ZeroIntView& x);
01141
01147
01148 bool operator ==(const ZeroIntView& x, const ZeroIntView& y);
01150 bool operator !=(const ZeroIntView& x, const ZeroIntView& y);
01152
01153 template<class View> class ViewDiffRanges;
01154
01165 template<class View>
01166 class CachedView : public DerivedView<View> {
01167 friend class ViewDiffRanges<View>;
01168 protected:
01169 using DerivedView<View>::x;
01171 RangeList* _firstRange;
01173 RangeList* _lastRange;
01175 unsigned int _size;
01176 public:
01178
01179
01180 CachedView(void);
01182 explicit CachedView(const View& y);
01184
01186
01187
01188 int min(void) const;
01190 int max(void) const;
01192 int med(void) const;
01194 int val(void) const;
01195 #ifdef GECODE_HAS_CBS
01196
01197 int baseval(int val) const;
01198 #endif
01199
01201 unsigned int size(void) const;
01203 unsigned int width(void) const;
01205 unsigned int regret_min(void) const;
01207 unsigned int regret_max(void) const;
01209
01211
01212
01213 bool range(void) const;
01214
01216 bool in(int n) const;
01218 bool in(long long int n) const;
01220
01222
01223
01224 ModEvent lq(Space& home, int n);
01226 ModEvent lq(Space& home, long long int n);
01227
01229 ModEvent le(Space& home, int n);
01231 ModEvent le(Space& home, long long int n);
01232
01234 ModEvent gq(Space& home, int n);
01236 ModEvent gq(Space& home, long long int n);
01237
01239 ModEvent gr(Space& home, int n);
01241 ModEvent gr(Space& home, long long int n);
01242
01244 ModEvent nq(Space& home, int n);
01246 ModEvent nq(Space& home, long long int n);
01247
01249 ModEvent eq(Space& home, int n);
01251 ModEvent eq(Space& home, long long int n);
01253
01269
01270 template<class I>
01271 ModEvent narrow_r(Space& home, I& i, bool depends=true);
01273 template<class I>
01274 ModEvent inter_r(Space& home, I& i, bool depends=true);
01276 template<class I>
01277 ModEvent minus_r(Space& home, I& i, bool depends=true);
01279 template<class I>
01280 ModEvent narrow_v(Space& home, I& i, bool depends=true);
01282 template<class I>
01283 ModEvent inter_v(Space& home, I& i, bool depends=true);
01285 template<class I>
01286 ModEvent minus_v(Space& home, I& i, bool depends=true);
01288
01290
01291
01292 static ModEventDelta med(ModEvent me);
01294
01296
01297
01298 int min(const Delta& d) const;
01300 int max(const Delta& d) const;
01302 unsigned int width(const Delta& d) const;
01304 bool any(const Delta& d) const;
01306
01308
01309
01310 void initCache(Space& home, const IntSet& s);
01312 void cache(Space& home);
01314 bool modified(void) const;
01316
01318
01319
01320 void update(Space& home, CachedView<View>& y);
01322 };
01323
01328 template<class Char, class Traits, class View>
01329 std::basic_ostream<Char,Traits>&
01330 operator <<(std::basic_ostream<Char,Traits>& os, const CachedView<View>& x);
01331
01336
01337 template<class View>
01338 bool operator ==(const CachedView<View>& x, const CachedView<View>& y);
01340 template<class View>
01341 bool operator !=(const CachedView<View>& x, const CachedView<View>& y);
01343
01352 template<class View>
01353 class ViewDiffRanges
01354 : public Iter::Ranges::Diff<Iter::Ranges::RangeList,ViewRanges<View> > {
01355 typedef Iter::Ranges::Diff<Iter::Ranges::RangeList,ViewRanges<View> >
01356 Super;
01357 protected:
01359 Iter::Ranges::RangeList cr;
01361 ViewRanges<View> dr;
01362 public:
01364
01365
01366 ViewDiffRanges(void);
01368 ViewDiffRanges(const CachedView<View>& x);
01370 void init(const CachedView<View>& x);
01372 };
01373
01380 class BoolView : public VarImpView<BoolVar> {
01381 protected:
01382 using VarImpView<BoolVar>::x;
01383 public:
01385
01386
01387 BoolView(void);
01389 BoolView(const BoolVar& y);
01391 BoolView(BoolVarImp* y);
01393
01395
01396
01397 static const int BITS = BoolVarImp::BITS;
01399 static const BoolStatus ZERO = BoolVarImp::ZERO;
01401 static const BoolStatus ONE = BoolVarImp::ONE;
01403 static const BoolStatus NONE = BoolVarImp::NONE;
01405 BoolStatus status(void) const;
01407
01409
01410
01411 int min(void) const;
01413 int max(void) const;
01415 int med(void) const;
01417 int val(void) const;
01418 #ifdef GECODE_HAS_CBS
01419
01420 int baseval(int val) const;
01421 #endif
01422
01424 unsigned int size(void) const;
01426 unsigned int width(void) const;
01428 unsigned int regret_min(void) const;
01430 unsigned int regret_max(void) const;
01432
01434
01435
01436 bool range(void) const;
01438 bool in(int n) const;
01440 bool in(long long int n) const;
01442
01444
01445
01446 bool zero(void) const;
01448 bool one(void) const;
01450 bool none(void) const;
01452
01454
01455
01456 ModEvent one(Space& home);
01458 ModEvent zero(Space& home);
01460 ModEvent one_none(Space& home);
01462 ModEvent zero_none(Space& home);
01464
01466
01467
01468 ModEvent lq(Space& home, int n);
01470 ModEvent lq(Space& home, long long int n);
01471
01473 ModEvent le(Space& home, int n);
01475 ModEvent le(Space& home, long long int n);
01476
01478 ModEvent gq(Space& home, int n);
01480 ModEvent gq(Space& home, long long int n);
01481
01483 ModEvent gr(Space& home, int n);
01485 ModEvent gr(Space& home, long long int n);
01486
01488 ModEvent nq(Space& home, int n);
01490 ModEvent nq(Space& home, long long int n);
01491
01493 ModEvent eq(Space& home, int n);
01495 ModEvent eq(Space& home, long long int n);
01497
01513
01514 template<class I>
01515 ModEvent narrow_r(Space& home, I& i, bool depends=true);
01517 template<class I>
01518 ModEvent inter_r(Space& home, I& i, bool depends=true);
01520 template<class I>
01521 ModEvent minus_r(Space& home, I& i, bool depends=true);
01523 template<class I>
01524 ModEvent narrow_v(Space& home, I& i, bool depends=true);
01526 template<class I>
01527 ModEvent inter_v(Space& home, I& i, bool depends=true);
01529 template<class I>
01530 ModEvent minus_v(Space& home, I& i, bool depends=true);
01532
01534
01535
01536 int min(const Delta& d) const;
01538 int max(const Delta& d) const;
01540 unsigned int width(const Delta& d) const;
01542 bool any(const Delta& d) const;
01544 static bool zero(const Delta& d);
01546 static bool one(const Delta& d);
01548
01550
01551
01552 static ModEventDelta med(ModEvent me);
01554 };
01555
01560 template<class Char, class Traits>
01561 std::basic_ostream<Char,Traits>&
01562 operator <<(std::basic_ostream<Char,Traits>& os, const BoolView& x);
01563
01564
01565
01574 class NegBoolView : public DerivedView<BoolView> {
01575 protected:
01576 using DerivedView<BoolView>::x;
01577 public:
01579
01580
01581 NegBoolView(void);
01583 explicit NegBoolView(const BoolView& y);
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;
01630 #ifdef GECODE_HAS_CBS
01631
01632 int baseval(int val) const;
01633 #endif
01634
01635
01637
01638
01639 int min(const Delta& d) const;
01641 int max(const Delta& d) const;
01643 unsigned int width(const Delta& d) const;
01645 bool any(const Delta& d) const;
01647 static bool zero(const Delta& d);
01649 static bool one(const Delta& d);
01651 };
01652
01657
01658 bool operator ==(const NegBoolView& x, const NegBoolView& y);
01660 bool operator !=(const NegBoolView& x, const NegBoolView& y);
01662
01667 template<class Char, class Traits>
01668 std::basic_ostream<Char,Traits>&
01669 operator <<(std::basic_ostream<Char,Traits>& os, const NegBoolView& x);
01670
01671 }}
01672
01673 #include <gecode/int/var/int.hpp>
01674 #include <gecode/int/var/bool.hpp>
01675
01676 #include <gecode/int/view/int.hpp>
01677
01678 #include <gecode/int/view/constint.hpp>
01679 #include <gecode/int/view/zero.hpp>
01680 #include <gecode/int/view/minus.hpp>
01681 #include <gecode/int/view/offset.hpp>
01682 #include <gecode/int/view/scale.hpp>
01683 #include <gecode/int/view/cached.hpp>
01684
01685 #include <gecode/int/view/bool.hpp>
01686
01687 #include <gecode/int/view/neg-bool.hpp>
01688
01689 #include <gecode/int/view/print.hpp>
01690 #include <gecode/int/var/print.hpp>
01691
01692 namespace Gecode { namespace Int {
01693
01700
01701 enum RelTest {
01702 RT_FALSE = 0,
01703 RT_MAYBE = 1,
01704 RT_TRUE = 2
01705 };
01706
01708 template<class VX, class VY> RelTest rtest_eq_bnd(VX x, VY y);
01710 template<class VX, class VY> RelTest rtest_eq_dom(VX x, VY y);
01712 template<class VX> RelTest rtest_eq_bnd(VX x, int n);
01714 template<class VX> RelTest rtest_eq_dom(VX x, int n);
01715
01717 template<class VX, class VY> RelTest rtest_nq_bnd(VX x, VY y);
01719 template<class VX, class VY> RelTest rtest_nq_dom(VX x, VY y);
01721 template<class VX> RelTest rtest_nq_bnd(VX x, int n);
01723 template<class VX> RelTest rtest_nq_dom(VX x, int n);
01724
01726 template<class VX, class VY> RelTest rtest_lq(VX x, VY y);
01728 template<class VX> RelTest rtest_lq(VX x, int n);
01729
01731 template<class VX, class VY> RelTest rtest_le(VX x, VY y);
01733 template<class VX> RelTest rtest_le(VX x, int n);
01734
01736 template<class VX, class VY> RelTest rtest_gq(VX x, VY y);
01738 template<class VX> RelTest rtest_gq(VX x, int n);
01739
01741 template<class VX, class VY> RelTest rtest_gr(VX x, VY y);
01743 template<class VX> RelTest rtest_gr(VX x, int n);
01745
01746
01751 enum BoolTest {
01752 BT_NONE,
01753 BT_SAME,
01754 BT_COMP
01755 };
01756
01762
01763 BoolTest bool_test(const BoolView& b0, const BoolView& b1);
01765 BoolTest bool_test(const BoolView& b0, const NegBoolView& b1);
01767 BoolTest bool_test(const NegBoolView& b0, const BoolView& b1);
01769 BoolTest bool_test(const NegBoolView& b0, const NegBoolView& b1);
01771
01772 }}
01773
01774 #include <gecode/int/view/rel-test.hpp>
01775 #include <gecode/int/view/bool-test.hpp>
01776
01777