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 #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.icc"
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 IntView(Space* home, const Reflection::VarMap& vars,
00151 Reflection::Arg* arg);
00153
00155
00156
00157 int min(void) const;
00159 int max(void) const;
00161 int med(void) const;
00163 int val(void) const;
00164
00166 unsigned int size(void) const;
00168 unsigned int width(void) const;
00170 unsigned int regret_min(void) const;
00172 unsigned int regret_max(void) const;
00174
00176
00177
00178 bool range(void) const;
00180 bool assigned(void) const;
00181
00183 bool in(int n) const;
00185 bool in(double n) const;
00187
00189
00190
00191 ModEvent lq(Space* home, int n);
00193 ModEvent lq(Space* home, double n);
00194
00196 ModEvent le(Space* home, int n);
00198 ModEvent le(Space* home, double n);
00199
00201 ModEvent gq(Space* home, int n);
00203 ModEvent gq(Space* home, double n);
00204
00206 ModEvent gr(Space* home, int n);
00208 ModEvent gr(Space* home, double n);
00210 ModEvent nq(Space* home, int n);
00212 ModEvent nq(Space* home, double n);
00213
00215 ModEvent eq(Space* home, int n);
00217 ModEvent eq(Space* home, double n);
00219
00235
00236 template <class I>
00237 ModEvent narrow_r(Space* home, I& i, bool depends=true);
00239 template <class I>
00240 ModEvent inter_r(Space* home, I& i, bool depends=true);
00242 template <class I>
00243 ModEvent minus_r(Space* home, I& i, bool depends=true);
00245 template <class I>
00246 ModEvent narrow_v(Space* home, I& i, bool depends=true);
00248 template <class I>
00249 ModEvent inter_v(Space* home, I& i, bool depends=true);
00251 template <class I>
00252 ModEvent minus_v(Space* home, I& i, bool depends=true);
00254
00256
00257
00258 static ModEvent modevent(const Delta* d);
00260 int min(const Delta* d) const;
00262 int max(const Delta* d) const;
00264 bool any(const Delta* d) const;
00266
00268
00269
00270 static ModEventDelta med(ModEvent me);
00272
00274
00275
00276 void update(Space* home, bool share, IntView& x);
00278
00280
00281
00282 Reflection::Arg* spec(const Space* home, Reflection::VarMap& m) const;
00283 static Support::Symbol type(void);
00285
00286 };
00287
00288 }
00289
00296 template<>
00297 class ViewVarImpTraits<Int::IntView> {
00298 public:
00300 typedef Int::IntVarImp VarImp;
00301 };
00302
00308 template<>
00309 class VarViewTraits<IntVar> {
00310 public:
00312 typedef Int::IntView View;
00313 };
00314
00320 template<>
00321 class DomainSize<Int::IntView> {
00322 public:
00324 static int size(const Int::IntView& iv) { return iv.size(); }
00325 };
00326
00327 namespace Int {
00328
00336 class MinusView : public DerivedViewBase<IntView> {
00337 protected:
00338 using DerivedViewBase<IntView>::view;
00339 public:
00341
00342
00343 MinusView(void);
00345 MinusView(const IntView& x);
00347 MinusView(Space* home, const Reflection::VarMap& vars,
00348 Reflection::Arg* arg);
00350 void init(const IntView& x);
00352
00354
00355
00356 int min(void) const;
00358 int max(void) const;
00360 int med(void) const;
00362 int val(void) const;
00363
00365 unsigned int size(void) const;
00367 unsigned int width(void) const;
00369 unsigned int regret_min(void) const;
00371 unsigned int regret_max(void) const;
00373
00375
00376
00377 bool range(void) const;
00379 bool assigned(void) const;
00380
00382 bool in(int n) const;
00384 bool in(double n) const;
00386
00388
00389
00390 ModEvent lq(Space* home, int n);
00392 ModEvent lq(Space* home, double n);
00394 ModEvent le(Space* home, int n);
00396 ModEvent le(Space* home, double n);
00398 ModEvent gq(Space* home, int n);
00400 ModEvent gq(Space* home, double n);
00402 ModEvent gr(Space* home, int n);
00404 ModEvent gr(Space* home, double n);
00406 ModEvent nq(Space* home, int n);
00408 ModEvent nq(Space* home, double n);
00410 ModEvent eq(Space* home, int n);
00412 ModEvent eq(Space* home, double n);
00414
00430
00431 template <class I>
00432 ModEvent narrow_r(Space* home, I& i, bool depends=true);
00434 template <class I>
00435 ModEvent inter_r(Space* home, I& i, bool depends=true);
00437 template <class I>
00438 ModEvent minus_r(Space* home, I& i, bool depends=true);
00440 template <class I>
00441 ModEvent narrow_v(Space* home, I& i, bool depends=true);
00443 template <class I>
00444 ModEvent inter_v(Space* home, I& i, bool depends=true);
00446 template <class I>
00447 ModEvent minus_v(Space* home, I& i, bool depends=true);
00449
00451
00452
00453 static void schedule(Space* home, Propagator* p, ModEvent me);
00455 static ModEvent me(ModEventDelta med);
00457 static ModEventDelta med(ModEvent me);
00459
00461
00462
00469 void subscribe(Space* home, Propagator* p, PropCond pc, bool process=true);
00471 void cancel(Space* home, Propagator* p, PropCond pc);
00473 void subscribe(Space* home, Advisor* a);
00475 void cancel(Space* home, Advisor* a);
00477
00479
00480
00481 static ModEvent modevent(const Delta* d);
00483 int min(const Delta* d) const;
00485 int max(const Delta* d) const;
00487 bool any(const Delta* d) const;
00489
00491
00492
00493 void update(Space* home, bool share, MinusView& x);
00495
00497
00498
00499 Reflection::Arg* spec(const Space* home, Reflection::VarMap& m) const;
00500 static Support::Symbol type(void);
00502 };
00503
00504 }
00505
00510
00511 bool same(const Int::MinusView& x, const Int::MinusView& y);
00513 bool before(const Int::MinusView& x, const Int::MinusView& y);
00515
00522 template<>
00523 class ViewVarImpTraits<Int::MinusView> {
00524 public:
00526 typedef Int::IntVarImp VarImp;
00527 };
00528
00529
00530 namespace Int {
00531
00540 class OffsetView : public DerivedViewBase<IntView> {
00541 protected:
00543 int c;
00544 using DerivedViewBase<IntView>::view;
00545 public:
00547
00548
00549 OffsetView(void);
00551 OffsetView(const IntView& x, int c);
00553 OffsetView(Space* home, const Reflection::VarMap& vars,
00554 Reflection::Arg* arg);
00556 void init(const IntView& x, int c);
00558 int offset(void) const;
00560
00562
00563
00564 int min(void) const;
00566 int max(void) const;
00568 int med(void) const;
00570 int val(void) const;
00571
00573 unsigned int size(void) const;
00575 unsigned int width(void) const;
00577 unsigned int regret_min(void) const;
00579 unsigned int regret_max(void) const;
00581
00583
00584
00585 bool range(void) const;
00587 bool assigned(void) const;
00588
00590 bool in(int n) const;
00592 bool in(double n) const;
00594
00596
00597
00598 ModEvent lq(Space* home, int n);
00600 ModEvent lq(Space* home, double n);
00602 ModEvent le(Space* home, int n);
00604 ModEvent le(Space* home, double n);
00606 ModEvent gq(Space* home, int n);
00608 ModEvent gq(Space* home, double n);
00610 ModEvent gr(Space* home, int n);
00612 ModEvent gr(Space* home, double n);
00614 ModEvent nq(Space* home, int n);
00616 ModEvent nq(Space* home, double n);
00618 ModEvent eq(Space* home, int n);
00620 ModEvent eq(Space* home, double n);
00622
00638
00639 template <class I>
00640 ModEvent narrow_r(Space* home, I& i, bool depends=true);
00642 template <class I>
00643 ModEvent inter_r(Space* home, I& i, bool depends=true);
00645 template <class I>
00646 ModEvent minus_r(Space* home, I& i, bool depends=true);
00648 template <class I>
00649 ModEvent narrow_v(Space* home, I& i, bool depends=true);
00651 template <class I>
00652 ModEvent inter_v(Space* home, I& i, bool depends=true);
00654 template <class I>
00655 ModEvent minus_v(Space* home, I& i, bool depends=true);
00657
00659
00660
00661 static void schedule(Space* home, Propagator* p, ModEvent me);
00663 static ModEvent me(ModEventDelta med);
00665 static ModEventDelta med(ModEvent me);
00667
00669
00670
00677 void subscribe(Space* home, Propagator* p, PropCond pc, bool process=true);
00679 void cancel(Space* home, Propagator* p, PropCond pc);
00681 void subscribe(Space* home, Advisor* a);
00683 void cancel(Space* home, Advisor* a);
00685
00687
00688
00689 static ModEvent modevent(const Delta* d);
00691 int min(const Delta* d) const;
00693 int max(const Delta* d) const;
00695 bool any(const Delta* d) const;
00697
00699
00700
00701 void update(Space* home, bool share, OffsetView& x);
00703
00705
00706
00707 Reflection::Arg* spec(const Space* home, Reflection::VarMap& m) const;
00708 static Support::Symbol type(void);
00710 };
00711
00712 }
00713
00718
00719 bool same(const Int::OffsetView& x, const Int::OffsetView& y);
00721 bool before(const Int::OffsetView& x, const Int::OffsetView& y);
00723
00730 template<>
00731 class ViewVarImpTraits<Int::OffsetView> {
00732 public:
00734 typedef Int::IntVarImp VarImp;
00735 };
00736
00737
00738
00739 namespace Int {
00740
00766 template <class Val, class UnsVal>
00767 class ScaleView : public DerivedViewBase<IntView> {
00768 protected:
00770 int a;
00771 using DerivedViewBase<IntView>::view;
00772
00774
00775
00776 int floor_div(double x) const;
00778 int ceil_div(double x) const;
00780 int exact_div(double x, bool& exact) const;
00781 #if GECODE_INT_RND_TWDS_ZERO
00783 int floor_div(int) const;
00785 int ceil_div(int) const;
00787 int exact_div(int, bool&) const;
00788 #endif
00789
00790
00791 public:
00793
00794
00795 ScaleView(void);
00797 ScaleView(int b, const IntView& y);
00799 ScaleView(Space* home, const Reflection::VarMap& vars,
00800 Reflection::Arg* arg);
00802 void init(int b, const IntView& y);
00804 int scale(void) const;
00806
00807
00809
00810
00811 Val min(void) const;
00813 Val max(void) const;
00815 Val med(void) const;
00817 Val val(void) const;
00818
00820 UnsVal size(void) const;
00822 UnsVal width(void) const;
00824 UnsVal regret_min(void) const;
00826 UnsVal regret_max(void) const;
00828
00830
00831
00832 bool range(void) const;
00834 bool assigned(void) const;
00836 bool in(Val n) const;
00838
00840
00841
00842 ModEvent lq(Space* home, Val n);
00844 ModEvent le(Space* home, Val n);
00846 ModEvent gq(Space* home, Val n);
00848 ModEvent gr(Space* home, Val n);
00850 ModEvent nq(Space* home, Val n);
00852 ModEvent eq(Space* home, Val n);
00854
00856
00857
00858 static void schedule(Space* home, Propagator* p, ModEvent me);
00860 static ModEvent me(ModEventDelta med);
00862 static ModEventDelta med(ModEvent me);
00864
00866
00867
00874 void subscribe(Space* home, Propagator* p, PropCond pc, bool process=true);
00876 void cancel(Space* home, Propagator* p, PropCond pc);
00878 void subscribe(Space* home, Advisor* a);
00880 void cancel(Space* home, Advisor* a);
00882
00884
00885
00886 static ModEvent modevent(const Delta* d);
00888 Val min(const Delta* d) const;
00890 Val max(const Delta* d) const;
00892 bool any(const Delta* d) const;
00894
00896
00897
00898 void update(Space* home, bool share, ScaleView<Val,UnsVal>& x);
00900
00902
00903
00904 Reflection::Arg* spec(const Space* home, Reflection::VarMap& m) const;
00905 static Support::Symbol type(void);
00907 };
00908
00913 typedef ScaleView<int,unsigned int> IntScaleView;
00914
00919 typedef ScaleView<double,double> DoubleScaleView;
00920
00921 }
00922
00927
00928 template <class Val, class UnsVal>
00929 bool same(const Int::ScaleView<Val,UnsVal>& x,
00930 const Int::ScaleView<Val,UnsVal>& y);
00932 template <class Val, class UnsVal>
00933 bool before(const Int::ScaleView<Val,UnsVal>& x,
00934 const Int::ScaleView<Val,UnsVal>& y);
00936
00937
00944 template <class Val, class UnsVal>
00945 class ViewVarImpTraits<Int::ScaleView<Val,UnsVal> > {
00946 public:
00948 typedef Int::IntVarImp VarImp;
00949 };
00950
00951
00952
00953 namespace Int {
00954
00962 class ConstIntView : public ConstViewBase {
00963 protected:
00964 int x;
00965 public:
00967
00968
00969 ConstIntView(void);
00971 ConstIntView(int n);
00973 void init(int n);
00975 ConstIntView(Space* home, const Reflection::VarMap& vars,
00976 Reflection::Arg* arg);
00978
00980
00981
00982 int min(void) const;
00984 int max(void) const;
00986 int med(void) const;
00988 int val(void) const;
00989
00991 unsigned int size(void) const;
00993 unsigned int width(void) const;
00995 unsigned int regret_min(void) const;
00997 unsigned int regret_max(void) const;
00999
01001
01002
01003 bool range(void) const;
01005 bool assigned(void) const;
01006
01008 bool in(int n) const;
01010 bool in(double n) const;
01012
01014
01015
01016 ModEvent lq(Space* home, int n);
01018 ModEvent lq(Space* home, double n);
01020 ModEvent le(Space* home, int n);
01022 ModEvent le(Space* home, double n);
01024 ModEvent gq(Space* home, int n);
01026 ModEvent gq(Space* home, double n);
01028 ModEvent gr(Space* home, int n);
01030 ModEvent gr(Space* home, double n);
01032 ModEvent nq(Space* home, int n);
01034 ModEvent nq(Space* home, double n);
01036 ModEvent eq(Space* home, int n);
01038 ModEvent eq(Space* home, double n);
01040
01056
01057 template <class I>
01058 ModEvent narrow_r(Space* home, I& i, bool depends=true);
01060 template <class I>
01061 ModEvent inter_r(Space* home, I& i, bool depends=true);
01063 template <class I>
01064 ModEvent minus_r(Space* home, I& i, bool depends=true);
01066 template <class I>
01067 ModEvent narrow_v(Space* home, I& i, bool depends=true);
01069 template <class I>
01070 ModEvent inter_v(Space* home, I& i, bool depends=true);
01072 template <class I>
01073 ModEvent minus_v(Space* home, I& i, bool depends=true);
01075
01077
01078
01079 static void schedule(Space* home, Propagator* p, ModEvent me);
01081 static ModEvent me(ModEventDelta med);
01083 static ModEventDelta med(ModEvent me);
01085
01087
01088
01095 void subscribe(Space* home, Propagator* p, PropCond pc, bool process=true);
01097 void cancel(Space* home, Propagator* p, PropCond pc);
01099 void subscribe(Space* home, Advisor* a);
01101 void cancel(Space* home, Advisor* a);
01103
01105
01106
01107 static ModEvent modevent(const Delta* d);
01109 int min(const Delta* d) const;
01111 int max(const Delta* d) const;
01113 bool any(const Delta* d) const;
01115
01117
01118
01119 void update(Space* home, bool share, ConstIntView& x);
01121
01123
01124
01125 Reflection::Arg* spec(const Space* home, Reflection::VarMap& m) const;
01126 static Support::Symbol type(void);
01128 };
01129
01130 }
01131
01137
01138 bool same(const Int::ConstIntView& x, const Int::ConstIntView& y);
01140 bool before(const Int::ConstIntView& x, const Int::ConstIntView& y);
01142
01149 template<>
01150 class ViewVarImpTraits<Int::ConstIntView> {
01151 public:
01153 typedef VarImpBase VarImp;
01154 };
01155
01156 namespace Int {
01157
01165 class ZeroIntView : public ConstViewBase {
01166 public:
01168
01169
01170 ZeroIntView(void);
01172 void init(void);
01174 ZeroIntView(Space* home, const Reflection::VarMap& vars,
01175 Reflection::Arg* arg);
01177
01179
01180
01181 int min(void) const;
01183 int max(void) const;
01185 int med(void) const;
01187 int val(void) const;
01188
01190 unsigned int size(void) const;
01192 unsigned int width(void) const;
01194 unsigned int regret_min(void) const;
01196 unsigned int regret_max(void) const;
01198
01200
01201
01202 bool range(void) const;
01204 bool assigned(void) const;
01205
01207 bool in(int n) const;
01209 bool in(double n) const;
01211
01213
01214
01215 ModEvent lq(Space* home, int n);
01217 ModEvent lq(Space* home, double n);
01219 ModEvent le(Space* home, int n);
01221 ModEvent le(Space* home, double n);
01223 ModEvent gq(Space* home, int n);
01225 ModEvent gq(Space* home, double n);
01227 ModEvent gr(Space* home, int n);
01229 ModEvent gr(Space* home, double n);
01231 ModEvent nq(Space* home, int n);
01233 ModEvent nq(Space* home, double n);
01235 ModEvent eq(Space* home, int n);
01237 ModEvent eq(Space* home, double n);
01239
01255
01256 template <class I>
01257 ModEvent narrow_r(Space* home, I& i, bool depends=true);
01259 template <class I>
01260 ModEvent inter_r(Space* home, I& i, bool depends=true);
01262 template <class I>
01263 ModEvent minus_r(Space* home, I& i, bool depends=true);
01265 template <class I>
01266 ModEvent narrow_v(Space* home, I& i, bool depends=true);
01268 template <class I>
01269 ModEvent inter_v(Space* home, I& i, bool depends=true);
01271 template <class I>
01272 ModEvent minus_v(Space* home, I& i, bool depends=true);
01274
01276
01277
01278 static void schedule(Space* home, Propagator* p, ModEvent me);
01280 static ModEvent me(ModEventDelta med);
01282 static ModEventDelta med(ModEvent me);
01284
01286
01287
01294 void subscribe(Space* home, Propagator* p, PropCond pc, bool process=true);
01296 void cancel(Space* home, Propagator* p, PropCond pc);
01298 void subscribe(Space* home, Advisor* a);
01300 void cancel(Space* home, Advisor* a);
01302
01304
01305
01306 static ModEvent modevent(const Delta* d);
01308 int min(const Delta* d) const;
01310 int max(const Delta* d) const;
01312 bool any(const Delta* d) const;
01314
01316
01317
01318 void update(Space* home, bool share, ZeroIntView& x);
01320
01322
01323
01324 Reflection::Arg* spec(const Space* home, Reflection::VarMap& m) const;
01325 static Support::Symbol type(void);
01327 };
01328
01329 }
01330
01336
01337 bool same(const Int::ZeroIntView& x, const Int::ZeroIntView& y);
01339 bool before(const Int::ZeroIntView& x, const Int::ZeroIntView& y);
01341
01348 template<>
01349 class ViewVarImpTraits<Int::ZeroIntView> {
01350 public:
01352 typedef VarImpBase VarImp;
01353 };
01354
01355 namespace Int {
01356
01363 class BoolView : public VarViewBase<BoolVarImp> {
01364 protected:
01365 using VarViewBase<BoolVarImp>::varimp;
01366 public:
01368
01369
01370 BoolView(void);
01372 BoolView(const BoolVar& x);
01374 BoolView(BoolVarImp* x);
01376 BoolView(Space* home, const Reflection::VarMap& vars,
01377 Reflection::Arg* arg);
01379
01381
01382
01383 static const int BITS = BoolVarImp::BITS;
01385 static const BoolStatus ZERO = BoolVarImp::ZERO;
01387 static const BoolStatus ONE = BoolVarImp::ONE;
01389 static const BoolStatus NONE = BoolVarImp::NONE;
01391 BoolStatus status(void) const;
01393
01395
01396
01397 int min(void) const;
01399 int max(void) const;
01401 int med(void) const;
01403 int val(void) const;
01404
01406 unsigned int size(void) const;
01408 unsigned int width(void) const;
01410 unsigned int regret_min(void) const;
01412 unsigned int regret_max(void) const;
01414
01416
01417
01418 bool range(void) const;
01420 bool assigned(void) const;
01421
01423 bool in(int n) const;
01425 bool in(double n) const;
01427
01429
01430
01431 bool zero(void) const;
01433 bool one(void) const;
01435 bool none(void) const;
01437
01439
01440
01441 ModEvent one(Space* home);
01443 ModEvent zero(Space* home);
01445 ModEvent one_none(Space* home);
01447 ModEvent zero_none(Space* home);
01449
01451
01452
01453 ModEvent lq(Space* home, int n);
01455 ModEvent lq(Space* home, double n);
01456
01458 ModEvent le(Space* home, int n);
01460 ModEvent le(Space* home, double n);
01461
01463 ModEvent gq(Space* home, int n);
01465 ModEvent gq(Space* home, double n);
01466
01468 ModEvent gr(Space* home, int n);
01470 ModEvent gr(Space* home, double n);
01471
01473 ModEvent nq(Space* home, int n);
01475 ModEvent nq(Space* home, double n);
01476
01478 ModEvent eq(Space* home, int n);
01480 ModEvent eq(Space* home, double n);
01482
01498
01499 template <class I>
01500 ModEvent narrow_r(Space* home, I& i, bool depends=true);
01502 template <class I>
01503 ModEvent inter_r(Space* home, I& i, bool depends=true);
01505 template <class I>
01506 ModEvent minus_r(Space* home, I& i, bool depends=true);
01508 template <class I>
01509 ModEvent narrow_v(Space* home, I& i, bool depends=true);
01511 template <class I>
01512 ModEvent inter_v(Space* home, I& i, bool depends=true);
01514 template <class I>
01515 ModEvent minus_v(Space* home, I& i, bool depends=true);
01517
01519
01520
01521 static ModEvent modevent(const Delta* d);
01523 int min(const Delta* d) const;
01525 int max(const Delta* d) const;
01527 bool any(const Delta* d) const;
01529
01531
01532
01533 static ModEventDelta med(ModEvent me);
01535
01537
01538
01539 void update(Space* home, bool share, BoolView& x);
01541
01543
01544
01545 Reflection::Arg* spec(const Space* home, Reflection::VarMap& m) const;
01546 static Support::Symbol type(void);
01548 };
01549
01550 }
01551
01558 template<>
01559 class ViewVarImpTraits<Int::BoolView> {
01560 public:
01562 typedef Int::BoolVarImp VarImp;
01563 };
01564
01570 template<>
01571 class VarViewTraits<BoolVar> {
01572 public:
01574 typedef Int::BoolView View;
01575 };
01576
01582 template<>
01583 class DomainSize<Int::BoolView> {
01584 public:
01586 static int size(const Int::BoolView& iv) { return iv.size(); }
01587 };
01588
01589 namespace Int {
01590
01599 class NegBoolView : public DerivedViewBase<BoolView> {
01600 protected:
01601 using DerivedViewBase<BoolView>::view;
01602 public:
01604
01605
01606 NegBoolView(void);
01608 NegBoolView(const BoolView& b);
01610 void init(const BoolView& b);
01612 NegBoolView(Space* home, const Reflection::VarMap& vars,
01613 Reflection::Arg* arg);
01615
01617
01618
01619 static const int BITS = BoolView::BITS;
01621 static const BoolStatus ZERO = BoolView::ONE;
01623 static const BoolStatus ONE = BoolView::ZERO;
01625 static const BoolStatus NONE = BoolView::NONE;
01627 BoolStatus status(void) const;
01629
01631
01632
01633 bool zero(void) const;
01635 bool one(void) const;
01637 bool none(void) const;
01639
01641
01642
01643 ModEvent one(Space* home);
01645 ModEvent zero(Space* home);
01647 ModEvent one_none(Space* home);
01649 ModEvent zero_none(Space* home);
01651
01653
01654
01655 int min(void) const;
01657 int max(void) const;
01659 int val(void) const;
01661
01663
01664
01665 bool assigned(void) const;
01667
01669
01670
01671 static void schedule(Space* home, Propagator* p, ModEvent me);
01673 static ModEvent me(ModEventDelta med);
01675 static ModEventDelta med(ModEvent me);
01677
01679
01680
01687 void subscribe(Space* home, Propagator* p, PropCond pc, bool process=true);
01689 void cancel(Space* home, Propagator* p, PropCond pc);
01691 void subscribe(Space* home, Advisor* a);
01693 void cancel(Space* home, Advisor* a);
01695
01697
01698
01699 static ModEvent modevent(const Delta* d);
01701 int min(const Delta* d) const;
01703 int max(const Delta* d) const;
01705 bool any(const Delta* d) const;
01707
01709
01710
01711 void update(Space* home, bool share, NegBoolView& x);
01713
01715
01716
01717 Reflection::Arg* spec(const Space* home, Reflection::VarMap& m) const;
01718 static Support::Symbol type(void);
01720 };
01721
01726 enum BoolTest {
01727 BT_NONE,
01728 BT_SAME,
01729 BT_COMP
01730 };
01731
01737
01738 BoolTest bool_test(const BoolView& b0, const BoolView& b1);
01740 BoolTest bool_test(const BoolView& b0, const NegBoolView& b1);
01742 BoolTest bool_test(const NegBoolView& b0, const BoolView& b1);
01744 BoolTest bool_test(const NegBoolView& b0, const NegBoolView& b1);
01746
01747 }
01748
01753
01754 bool same(const Int::NegBoolView& x, const Int::NegBoolView& y);
01756 bool before(const Int::NegBoolView& x, const Int::NegBoolView& y);
01758
01765 template<>
01766 class ViewVarImpTraits<Int::NegBoolView> {
01767 public:
01769 typedef Int::BoolVarImp VarImp;
01770 };
01771
01772 }
01773
01774 #include "gecode/int/var/int.icc"
01775 #include "gecode/int/var/bool.icc"
01776
01777 #include "gecode/int/view/int.icc"
01778 #include "gecode/int/view/bool.icc"
01779
01780 #include "gecode/int/view/constint.icc"
01781 #include "gecode/int/view/zero.icc"
01782
01783 #include "gecode/int/view/minus.icc"
01784 #include "gecode/int/view/offset.icc"
01785 #include "gecode/int/view/scale.icc"
01786
01791 GECODE_INT_EXPORT std::ostream&
01792 operator<<(std::ostream&, const Gecode::Int::IntView&);
01797 GECODE_INT_EXPORT std::ostream&
01798 operator<<(std::ostream&, const Gecode::Int::MinusView&);
01803 GECODE_INT_EXPORT std::ostream&
01804 operator<<(std::ostream&, const Gecode::Int::OffsetView&);
01809 GECODE_INT_EXPORT std::ostream&
01810 operator<<(std::ostream&, const Gecode::Int::ConstIntView&);
01815 GECODE_INT_EXPORT std::ostream&
01816 operator<<(std::ostream&, const Gecode::Int::ZeroIntView&);
01821 GECODE_INT_EXPORT std::ostream&
01822 operator<<(std::ostream&, const Gecode::Int::IntScaleView&);
01827 GECODE_INT_EXPORT std::ostream&
01828 operator<<(std::ostream&, const Gecode::Int::DoubleScaleView&);
01829
01834 GECODE_INT_EXPORT std::ostream&
01835 operator<<(std::ostream&, const Gecode::Int::BoolView&);
01840 GECODE_INT_EXPORT std::ostream&
01841 operator<<(std::ostream&, const Gecode::Int::NegBoolView&);
01842
01843
01844 inline std::ostream&
01845 operator<<(std::ostream& os, const Gecode::IntVar& x) {
01846 Gecode::Int::IntView vx(x);
01847 return os << vx;
01848 }
01849
01850 inline std::ostream&
01851 operator<<(std::ostream& os, const Gecode::BoolVar& x) {
01852 Gecode::Int::BoolView vx(x);
01853 return os << vx;
01854 }
01855
01856 namespace Gecode {
01857
01858 namespace Int {
01859
01866
01867 enum RelTest {
01868 RT_FALSE = 0,
01869 RT_MAYBE = 1,
01870 RT_TRUE = 2
01871 };
01872
01874 template <class View> RelTest rtest_eq_bnd(View x, View y);
01876 template <class View> RelTest rtest_eq_dom(View x, View y);
01878 template <class View> RelTest rtest_eq_bnd(View x, int n);
01880 template <class View> RelTest rtest_eq_dom(View x, int n);
01881
01883 template <class View> RelTest rtest_nq_bnd(View x, View y);
01885 template <class View> RelTest rtest_nq_dom(View x, View y);
01887 template <class View> RelTest rtest_nq_bnd(View x, int n);
01889 template <class View> RelTest rtest_nq_dom(View x, int n);
01890
01892 template <class View> RelTest rtest_lq(View x, View y);
01894 template <class View> RelTest rtest_lq(View x, int n);
01895
01897 template <class View> RelTest rtest_le(View x, View y);
01899 template <class View> RelTest rtest_le(View x, int n);
01900
01902 template <class View> RelTest rtest_gq(View x, View y);
01904 template <class View> RelTest rtest_gq(View x, int n);
01905
01907 template <class View> RelTest rtest_gr(View x, View y);
01909 template <class View> RelTest rtest_gr(View x, int n);
01911
01912 }
01913
01914 }
01915
01916 #include "gecode/int/view/rtest.icc"
01917
01918