Generated on Tue Jan 19 2021 06:15:49 for Gecode by doxygen 1.8.13
view.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Contributing authors:
7  * Samuel Gagnon <samuel.gagnon92@gmail.com>
8  *
9  * Copyright:
10  * Christian Schulte, 2005
11  * Samuel Gagnon, 2018
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #include <iostream>
39 
40 namespace Gecode { namespace Int {
41 
53  template<class View>
54  class ViewRanges {
55  public:
57 
58  ViewRanges(void);
61  ViewRanges(const View& x);
63  void init(const View& x);
65 
67 
68  bool operator ()(void) const;
71  void operator ++(void);
73 
75 
76  int min(void) const;
79  int max(void) const;
81  unsigned int width(void) const;
83  };
84 
93  template<class View>
94  class ViewValues : public Iter::Ranges::ToValues<ViewRanges<View> > {
95  public:
97 
98  ViewValues(void);
101  ViewValues(const View& x);
103  void init(const View& x);
105  };
106 
107 }}
108 
109 #include <gecode/int/view/iter.hpp>
110 
111 namespace Gecode { namespace Int {
112 
129  class IntView : public VarImpView<IntVar> {
130  protected:
131  using VarImpView<IntVar>::x;
132  public:
134 
135  IntView(void);
138  IntView(const IntVar& y);
140  IntView(IntVarImp* y);
142 
144 
145  int min(void) const;
148  int max(void) const;
150  int med(void) const;
152  int val(void) const;
153 #ifdef GECODE_HAS_CBS
154  int baseval(int val) const;
156 #endif
157 
159  unsigned int size(void) const;
161  unsigned int width(void) const;
163  unsigned int regret_min(void) const;
165  unsigned int regret_max(void) const;
167 
169 
170  bool range(void) const;
172 
174  bool in(int n) const;
176  bool in(long long int n) const;
178 
180 
181  ModEvent lq(Space& home, int n);
184  ModEvent lq(Space& home, long long int n);
185 
187  ModEvent le(Space& home, int n);
189  ModEvent le(Space& home, long long int n);
190 
192  ModEvent gq(Space& home, int n);
194  ModEvent gq(Space& home, long long int n);
195 
197  ModEvent gr(Space& home, int n);
199  ModEvent gr(Space& home, long long int n);
200 
202  ModEvent nq(Space& home, int n);
204  ModEvent nq(Space& home, long long int n);
205 
207  ModEvent eq(Space& home, int n);
209  ModEvent eq(Space& home, long long int n);
211 
227  template<class I>
229  ModEvent narrow_r(Space& home, I& i, bool depends=true);
231  template<class I>
232  ModEvent inter_r(Space& home, I& i, bool depends=true);
234  template<class I>
235  ModEvent minus_r(Space& home, I& i, bool depends=true);
237  template<class I>
238  ModEvent narrow_v(Space& home, I& i, bool depends=true);
240  template<class I>
241  ModEvent inter_v(Space& home, I& i, bool depends=true);
243  template<class I>
244  ModEvent minus_v(Space& home, I& i, bool depends=true);
246 
248 
249  int min(const Delta& d) const;
252  int max(const Delta& d) const;
254  unsigned int width(const Delta& d) const;
256  bool any(const Delta& d) const;
258 
260 
261  static ModEventDelta med(ModEvent me);
264  };
265 
270  template<class Char, class Traits>
271  std::basic_ostream<Char,Traits>&
272  operator <<(std::basic_ostream<Char,Traits>& os, const IntView& x);
273 
274 
282  class MinusView : public DerivedView<IntView> {
283  protected:
285  public:
287 
288  MinusView(void);
291  explicit MinusView(const IntView& y);
293 
295 
296  int min(void) const;
299  int max(void) const;
301  int med(void) const;
303  int val(void) const;
304 #ifdef GECODE_HAS_CBS
305  int baseval(int val) const;
307 #endif
308 
310  unsigned int size(void) const;
312  unsigned int width(void) const;
314  unsigned int regret_min(void) const;
316  unsigned int regret_max(void) const;
318 
320 
321  bool range(void) const;
323 
325  bool in(int n) const;
327  bool in(long long int n) const;
329 
331 
332  ModEvent lq(Space& home, int n);
335  ModEvent lq(Space& home, long long int n);
336 
338  ModEvent le(Space& home, int n);
340  ModEvent le(Space& home, long long int n);
341 
343  ModEvent gq(Space& home, int n);
345  ModEvent gq(Space& home, long long int n);
346 
348  ModEvent gr(Space& home, int n);
350  ModEvent gr(Space& home, long long int n);
351 
353  ModEvent nq(Space& home, int n);
355  ModEvent nq(Space& home, long long int n);
356 
358  ModEvent eq(Space& home, int n);
360  ModEvent eq(Space& home, long long int n);
362 
378  template<class I>
380  ModEvent narrow_r(Space& home, I& i, bool depends=true);
382  template<class I>
383  ModEvent inter_r(Space& home, I& i, bool depends=true);
385  template<class I>
386  ModEvent minus_r(Space& home, I& i, bool depends=true);
388  template<class I>
389  ModEvent narrow_v(Space& home, I& i, bool depends=true);
391  template<class I>
392  ModEvent inter_v(Space& home, I& i, bool depends=true);
394  template<class I>
395  ModEvent minus_v(Space& home, I& i, bool depends=true);
397 
399 
400  static ModEventDelta med(ModEvent me);
403 
405 
406  int min(const Delta& d) const;
409  int max(const Delta& d) const;
411  unsigned int width(const Delta& d) const;
413  bool any(const Delta& d) const;
415  };
416 
421  template<class Char, class Traits>
422  std::basic_ostream<Char,Traits>&
423  operator <<(std::basic_ostream<Char,Traits>& os, const MinusView& x);
424 
429  bool operator ==(const MinusView& x, const MinusView& y);
432  bool operator !=(const MinusView& x, const MinusView& y);
434 
443  class OffsetView : public DerivedView<IntView> {
444  protected:
446  int c;
448  public:
450 
451  OffsetView(void);
454  OffsetView(const IntView& y, int c);
456 
458 
459  int offset(void) const;
462  void offset(int n);
464  int min(void) const;
466  int max(void) const;
468  int med(void) const;
470  int val(void) const;
471 #ifdef GECODE_HAS_CBS
472  int baseval(int val) const;
474 #endif
475 
477  unsigned int size(void) const;
479  unsigned int width(void) const;
481  unsigned int regret_min(void) const;
483  unsigned int regret_max(void) const;
485 
487 
488  bool range(void) const;
490 
492  bool in(int n) const;
494  bool in(long long int n) const;
496 
498 
499  ModEvent lq(Space& home, int n);
502  ModEvent lq(Space& home, long long int n);
503 
505  ModEvent le(Space& home, int n);
507  ModEvent le(Space& home, long long int n);
508 
510  ModEvent gq(Space& home, int n);
512  ModEvent gq(Space& home, long long int n);
513 
515  ModEvent gr(Space& home, int n);
517  ModEvent gr(Space& home, long long int n);
518 
520  ModEvent nq(Space& home, int n);
522  ModEvent nq(Space& home, long long int n);
523 
525  ModEvent eq(Space& home, int n);
527  ModEvent eq(Space& home, long long int n);
529 
545  template<class I>
547  ModEvent narrow_r(Space& home, I& i, bool depends=true);
549  template<class I>
550  ModEvent inter_r(Space& home, I& i, bool depends=true);
552  template<class I>
553  ModEvent minus_r(Space& home, I& i, bool depends=true);
555  template<class I>
556  ModEvent narrow_v(Space& home, I& i, bool depends=true);
558  template<class I>
559  ModEvent inter_v(Space& home, I& i, bool depends=true);
561  template<class I>
562  ModEvent minus_v(Space& home, I& i, bool depends=true);
564 
566 
567  static ModEventDelta med(ModEvent me);
570 
572 
573  int min(const Delta& d) const;
576  int max(const Delta& d) const;
578  unsigned int width(const Delta& d) const;
580  bool any(const Delta& d) const;
582 
584 
585  void update(Space& home, OffsetView& y);
588 
590 
591  bool operator <(const OffsetView& y) const;
594  };
595 
600  template<class Char, class Traits>
601  std::basic_ostream<Char,Traits>&
602  operator <<(std::basic_ostream<Char,Traits>& os, const OffsetView& x);
603 
608  bool operator ==(const OffsetView& x, const OffsetView& y);
611  bool operator !=(const OffsetView& x, const OffsetView& y);
613 
617  template<class View>
618  class NoOffset {
619  public:
621  typedef View ViewType;
623  View& operator ()(View& x);
625  void update(const NoOffset&);
627  int offset(void) const;
628  };
629 
630  template<class View>
631  forceinline View&
633  return x;
634  }
635 
636  template<class View>
637  forceinline void
639 
640  template<class View>
641  forceinline int
643  return 0;
644  }
645 
646 
650  class Offset {
651  public:
655  int c;
657  Offset(int off = 0);
661  void update(const Offset& o);
663  int offset(void) const;
664  };
665 
667  Offset::Offset(int off) : c(off) {}
668 
669  forceinline void
670  Offset::update(const Offset& o) { c = o.c; }
671 
672  forceinline int
673  Offset::offset(void) const { return c; }
674 
677  return OffsetView(x,c);
678  }
679 
703  template<class Val, class UnsVal>
704  class ScaleView : public DerivedView<IntView> {
705  protected:
708  int a;
709  public:
711 
712  ScaleView(void);
715  ScaleView(int b, const IntView& y);
717 
719 
720  int scale(void) const;
723  Val min(void) const;
725  Val max(void) const;
727  Val med(void) const;
729  Val val(void) const;
730 #ifdef GECODE_HAS_CBS
731  Val baseval(Val val) const;
733 #endif
734 
736  UnsVal size(void) const;
738  UnsVal width(void) const;
740  UnsVal regret_min(void) const;
742  UnsVal regret_max(void) const;
744 
746 
747  bool range(void) const;
750  bool in(Val n) const;
752 
754 
755  ModEvent lq(Space& home, Val n);
758  ModEvent le(Space& home, Val n);
760  ModEvent gq(Space& home, Val n);
762  ModEvent gr(Space& home, Val n);
764  ModEvent nq(Space& home, Val n);
766  ModEvent eq(Space& home, Val n);
768 
770 
771  static ModEventDelta med(ModEvent me);
774 
776 
777  Val min(const Delta& d) const;
780  Val max(const Delta& d) const;
782  UnsVal width(const Delta& d) const;
784  bool any(const Delta& d) const;
786 
788 
789  void update(Space& home, ScaleView<Val,UnsVal>& y);
792 
794 
795  bool operator <(const ScaleView<Val,UnsVal>& y) const;
798  };
799 
805 
811 
816  template<class Char, class Traits>
817  std::basic_ostream<Char,Traits>&
818  operator <<(std::basic_ostream<Char,Traits>& os, const IntScaleView& x);
819 
824  template<class Char, class Traits>
825  std::basic_ostream<Char,Traits>&
826  operator <<(std::basic_ostream<Char,Traits>& os, const LLongScaleView& x);
827 
832  template<class Val, class UnsVal>
834  bool operator ==(const ScaleView<Val,UnsVal>& x,
835  const ScaleView<Val,UnsVal>& y);
837  template<class Val, class UnsVal>
838  bool operator !=(const ScaleView<Val,UnsVal>& x,
839  const ScaleView<Val,UnsVal>& y);
841 
842 
843 
851  class ConstIntView : public ConstView<IntView> {
852  protected:
853  int x;
854  public:
856 
857  ConstIntView(void);
860  ConstIntView(int n);
862 
864 
865  int min(void) const;
868  int max(void) const;
870  int med(void) const;
872  int val(void) const;
873 
875  unsigned int size(void) const;
877  unsigned int width(void) const;
879  unsigned int regret_min(void) const;
881  unsigned int regret_max(void) const;
883 
885 
886  bool range(void) const;
889  bool in(int n) const;
891  bool in(long long int n) const;
893 
895 
896  ModEvent lq(Space& home, int n);
899  ModEvent lq(Space& home, long long int n);
900 
902  ModEvent le(Space& home, int n);
904  ModEvent le(Space& home, long long int n);
905 
907  ModEvent gq(Space& home, int n);
909  ModEvent gq(Space& home, long long int n);
910 
912  ModEvent gr(Space& home, int n);
914  ModEvent gr(Space& home, long long int n);
915 
917  ModEvent nq(Space& home, int n);
919  ModEvent nq(Space& home, long long int n);
920 
922  ModEvent eq(Space& home, int n);
924  ModEvent eq(Space& home, long long int n);
926 
942  template<class I>
944  ModEvent narrow_r(Space& home, I& i, bool depends=true);
946  template<class I>
947  ModEvent inter_r(Space& home, I& i, bool depends=true);
949  template<class I>
950  ModEvent minus_r(Space& home, I& i, bool depends=true);
952  template<class I>
953  ModEvent narrow_v(Space& home, I& i, bool depends=true);
955  template<class I>
956  ModEvent inter_v(Space& home, I& i, bool depends=true);
958  template<class I>
959  ModEvent minus_v(Space& home, I& i, bool depends=true);
961 
963 
964  int min(const Delta& d) const;
967  int max(const Delta& d) const;
969  unsigned int width(const Delta& d) const;
971  bool any(const Delta& d) const;
973 
975 
976  void update(Space& home, ConstIntView& y);
979 
981 
982  bool operator <(const ConstIntView& y) const;
985  };
986 
991  template<class Char, class Traits>
992  std::basic_ostream<Char,Traits>&
993  operator <<(std::basic_ostream<Char,Traits>& os, const ConstIntView& x);
994 
1000  bool operator ==(const ConstIntView& x, const ConstIntView& y);
1003  bool operator !=(const ConstIntView& x, const ConstIntView& y);
1005 
1006 
1014  class ZeroIntView : public ConstView<IntView> {
1015  public:
1017 
1018  ZeroIntView(void);
1021 
1023 
1024  int min(void) const;
1027  int max(void) const;
1029  int med(void) const;
1031  int val(void) const;
1032 
1034  unsigned int size(void) const;
1036  unsigned int width(void) const;
1038  unsigned int regret_min(void) const;
1040  unsigned int regret_max(void) const;
1042 
1044 
1045  bool range(void) const;
1048  bool in(int n) const;
1050  bool in(long long int n) const;
1052 
1054 
1055  ModEvent lq(Space& home, int n);
1058  ModEvent lq(Space& home, long long int n);
1059 
1061  ModEvent le(Space& home, int n);
1063  ModEvent le(Space& home, long long int n);
1064 
1066  ModEvent gq(Space& home, int n);
1068  ModEvent gq(Space& home, long long int n);
1069 
1071  ModEvent gr(Space& home, int n);
1073  ModEvent gr(Space& home, long long int n);
1074 
1076  ModEvent nq(Space& home, int n);
1078  ModEvent nq(Space& home, long long int n);
1079 
1081  ModEvent eq(Space& home, int n);
1083  ModEvent eq(Space& home, long long int n);
1085 
1101  template<class I>
1103  ModEvent narrow_r(Space& home, I& i, bool depends=true);
1105  template<class I>
1106  ModEvent inter_r(Space& home, I& i, bool depends=true);
1108  template<class I>
1109  ModEvent minus_r(Space& home, I& i, bool depends=true);
1111  template<class I>
1112  ModEvent narrow_v(Space& home, I& i, bool depends=true);
1114  template<class I>
1115  ModEvent inter_v(Space& home, I& i, bool depends=true);
1117  template<class I>
1118  ModEvent minus_v(Space& home, I& i, bool depends=true);
1120 
1122 
1123  int min(const Delta& d) const;
1126  int max(const Delta& d) const;
1128  unsigned int width(const Delta& d) const;
1130  bool any(const Delta& d) const;
1132  };
1133 
1138  template<class Char, class Traits>
1139  std::basic_ostream<Char,Traits>&
1140  operator <<(std::basic_ostream<Char,Traits>& os, const ZeroIntView& x);
1141 
1147  bool operator ==(const ZeroIntView& x, const ZeroIntView& y);
1150  bool operator !=(const ZeroIntView& x, const ZeroIntView& y);
1152 
1153  template<class View> class ViewDiffRanges;
1154 
1165  template<class View>
1166  class CachedView : public DerivedView<View> {
1167  friend class ViewDiffRanges<View>;
1168  protected:
1169  using DerivedView<View>::x;
1175  unsigned int _size;
1176  public:
1178 
1179  CachedView(void);
1182  explicit CachedView(const View& y);
1184 
1186 
1187  int min(void) const;
1190  int max(void) const;
1192  int med(void) const;
1194  int val(void) const;
1195 #ifdef GECODE_HAS_CBS
1196  int baseval(int val) const;
1198 #endif
1199 
1201  unsigned int size(void) const;
1203  unsigned int width(void) const;
1205  unsigned int regret_min(void) const;
1207  unsigned int regret_max(void) const;
1209 
1211 
1212  bool range(void) const;
1214 
1216  bool in(int n) const;
1218  bool in(long long int n) const;
1220 
1222 
1223  ModEvent lq(Space& home, int n);
1226  ModEvent lq(Space& home, long long int n);
1227 
1229  ModEvent le(Space& home, int n);
1231  ModEvent le(Space& home, long long int n);
1232 
1234  ModEvent gq(Space& home, int n);
1236  ModEvent gq(Space& home, long long int n);
1237 
1239  ModEvent gr(Space& home, int n);
1241  ModEvent gr(Space& home, long long int n);
1242 
1244  ModEvent nq(Space& home, int n);
1246  ModEvent nq(Space& home, long long int n);
1247 
1249  ModEvent eq(Space& home, int n);
1251  ModEvent eq(Space& home, long long int n);
1253 
1269  template<class I>
1271  ModEvent narrow_r(Space& home, I& i, bool depends=true);
1273  template<class I>
1274  ModEvent inter_r(Space& home, I& i, bool depends=true);
1276  template<class I>
1277  ModEvent minus_r(Space& home, I& i, bool depends=true);
1279  template<class I>
1280  ModEvent narrow_v(Space& home, I& i, bool depends=true);
1282  template<class I>
1283  ModEvent inter_v(Space& home, I& i, bool depends=true);
1285  template<class I>
1286  ModEvent minus_v(Space& home, I& i, bool depends=true);
1288 
1290 
1291  static ModEventDelta med(ModEvent me);
1294 
1296 
1297  int min(const Delta& d) const;
1300  int max(const Delta& d) const;
1302  unsigned int width(const Delta& d) const;
1304  bool any(const Delta& d) const;
1306 
1308 
1309  void initCache(Space& home, const IntSet& s);
1312  void cache(Space& home);
1314  bool modified(void) const;
1316 
1318 
1319  void update(Space& home, CachedView<View>& y);
1322  };
1323 
1328  template<class Char, class Traits, class View>
1329  std::basic_ostream<Char,Traits>&
1330  operator <<(std::basic_ostream<Char,Traits>& os, const CachedView<View>& x);
1331 
1336  template<class View>
1338  bool operator ==(const CachedView<View>& x, const CachedView<View>& y);
1340  template<class View>
1341  bool operator !=(const CachedView<View>& x, const CachedView<View>& y);
1343 
1352  template<class View>
1353  class ViewDiffRanges
1354  : public Iter::Ranges::Diff<Iter::Ranges::RangeList,ViewRanges<View> > {
1356  Super;
1357  protected:
1362  public:
1364 
1365  ViewDiffRanges(void);
1368  ViewDiffRanges(const CachedView<View>& x);
1370  void init(const CachedView<View>& x);
1372  };
1373 
1380  class BoolView : public VarImpView<BoolVar> {
1381  protected:
1382  using VarImpView<BoolVar>::x;
1383  public:
1385 
1386  BoolView(void);
1389  BoolView(const BoolVar& y);
1391  BoolView(BoolVarImp* y);
1393 
1395 
1396  static const int BITS = BoolVarImp::BITS;
1399  static const BoolStatus ZERO = BoolVarImp::ZERO;
1401  static const BoolStatus ONE = BoolVarImp::ONE;
1403  static const BoolStatus NONE = BoolVarImp::NONE;
1405  BoolStatus status(void) const;
1407 
1409 
1410  int min(void) const;
1413  int max(void) const;
1415  int med(void) const;
1417  int val(void) const;
1418 #ifdef GECODE_HAS_CBS
1419  int baseval(int val) const;
1421 #endif
1422 
1424  unsigned int size(void) const;
1426  unsigned int width(void) const;
1428  unsigned int regret_min(void) const;
1430  unsigned int regret_max(void) const;
1432 
1434 
1435  bool range(void) const;
1438  bool in(int n) const;
1440  bool in(long long int n) const;
1442 
1444 
1445  bool zero(void) const;
1448  bool one(void) const;
1450  bool none(void) const;
1452 
1454 
1455  ModEvent one(Space& home);
1458  ModEvent zero(Space& home);
1460  ModEvent one_none(Space& home);
1462  ModEvent zero_none(Space& home);
1464 
1466 
1467  ModEvent lq(Space& home, int n);
1470  ModEvent lq(Space& home, long long int n);
1471 
1473  ModEvent le(Space& home, int n);
1475  ModEvent le(Space& home, long long int n);
1476 
1478  ModEvent gq(Space& home, int n);
1480  ModEvent gq(Space& home, long long int n);
1481 
1483  ModEvent gr(Space& home, int n);
1485  ModEvent gr(Space& home, long long int n);
1486 
1488  ModEvent nq(Space& home, int n);
1490  ModEvent nq(Space& home, long long int n);
1491 
1493  ModEvent eq(Space& home, int n);
1495  ModEvent eq(Space& home, long long int n);
1497 
1513  template<class I>
1515  ModEvent narrow_r(Space& home, I& i, bool depends=true);
1517  template<class I>
1518  ModEvent inter_r(Space& home, I& i, bool depends=true);
1520  template<class I>
1521  ModEvent minus_r(Space& home, I& i, bool depends=true);
1523  template<class I>
1524  ModEvent narrow_v(Space& home, I& i, bool depends=true);
1526  template<class I>
1527  ModEvent inter_v(Space& home, I& i, bool depends=true);
1529  template<class I>
1530  ModEvent minus_v(Space& home, I& i, bool depends=true);
1532 
1534 
1535  int min(const Delta& d) const;
1538  int max(const Delta& d) const;
1540  unsigned int width(const Delta& d) const;
1542  bool any(const Delta& d) const;
1544  static bool zero(const Delta& d);
1546  static bool one(const Delta& d);
1548 
1550 
1551  static ModEventDelta med(ModEvent me);
1554  };
1555 
1560  template<class Char, class Traits>
1561  std::basic_ostream<Char,Traits>&
1562  operator <<(std::basic_ostream<Char,Traits>& os, const BoolView& x);
1563 
1564 
1565 
1574  class NegBoolView : public DerivedView<BoolView> {
1575  protected:
1577  public:
1579 
1580  NegBoolView(void);
1583  explicit NegBoolView(const BoolView& y);
1585 
1587 
1588  static const int BITS = BoolView::BITS;
1591  static const BoolStatus ZERO = BoolView::ONE;
1593  static const BoolStatus ONE = BoolView::ZERO;
1595  static const BoolStatus NONE = BoolView::NONE;
1597  BoolStatus status(void) const;
1599 
1601 
1602  bool zero(void) const;
1605  bool one(void) const;
1607  bool none(void) const;
1609 
1611 
1612  ModEvent one(Space& home);
1615  ModEvent zero(Space& home);
1617  ModEvent one_none(Space& home);
1619  ModEvent zero_none(Space& home);
1621 
1623 
1624  int min(void) const;
1627  int max(void) const;
1629  int val(void) const;
1630 #ifdef GECODE_HAS_CBS
1631  int baseval(int val) const;
1633 #endif
1634 
1635 
1637 
1638  int min(const Delta& d) const;
1641  int max(const Delta& d) const;
1643  unsigned int width(const Delta& d) const;
1645  bool any(const Delta& d) const;
1647  static bool zero(const Delta& d);
1649  static bool one(const Delta& d);
1651  };
1652 
1657  bool operator ==(const NegBoolView& x, const NegBoolView& y);
1660  bool operator !=(const NegBoolView& x, const NegBoolView& y);
1662 
1667  template<class Char, class Traits>
1668  std::basic_ostream<Char,Traits>&
1669  operator <<(std::basic_ostream<Char,Traits>& os, const NegBoolView& x);
1670 
1671 }}
1672 
1673 #include <gecode/int/var/int.hpp>
1674 #include <gecode/int/var/bool.hpp>
1675 
1676 #include <gecode/int/view/int.hpp>
1677 
1679 #include <gecode/int/view/zero.hpp>
1680 #include <gecode/int/view/minus.hpp>
1681 #include <gecode/int/view/offset.hpp>
1682 #include <gecode/int/view/scale.hpp>
1683 #include <gecode/int/view/cached.hpp>
1684 
1685 #include <gecode/int/view/bool.hpp>
1686 
1688 
1689 #include <gecode/int/view/print.hpp>
1690 #include <gecode/int/var/print.hpp>
1691 
1692 namespace Gecode { namespace Int {
1693 
1700  enum RelTest {
1702  RT_FALSE = 0,
1703  RT_MAYBE = 1,
1704  RT_TRUE = 2
1705  };
1706 
1708  template<class VX, class VY> RelTest rtest_eq_bnd(VX x, VY y);
1710  template<class VX, class VY> RelTest rtest_eq_dom(VX x, VY y);
1712  template<class VX> RelTest rtest_eq_bnd(VX x, int n);
1714  template<class VX> RelTest rtest_eq_dom(VX x, int n);
1715 
1717  template<class VX, class VY> RelTest rtest_nq_bnd(VX x, VY y);
1719  template<class VX, class VY> RelTest rtest_nq_dom(VX x, VY y);
1721  template<class VX> RelTest rtest_nq_bnd(VX x, int n);
1723  template<class VX> RelTest rtest_nq_dom(VX x, int n);
1724 
1726  template<class VX, class VY> RelTest rtest_lq(VX x, VY y);
1728  template<class VX> RelTest rtest_lq(VX x, int n);
1729 
1731  template<class VX, class VY> RelTest rtest_le(VX x, VY y);
1733  template<class VX> RelTest rtest_le(VX x, int n);
1734 
1736  template<class VX, class VY> RelTest rtest_gq(VX x, VY y);
1738  template<class VX> RelTest rtest_gq(VX x, int n);
1739 
1741  template<class VX, class VY> RelTest rtest_gr(VX x, VY y);
1743  template<class VX> RelTest rtest_gr(VX x, int n);
1745 
1746 
1751  enum BoolTest {
1755  };
1756 
1762  BoolTest bool_test(const BoolView& b0, const BoolView& b1);
1765  BoolTest bool_test(const BoolView& b0, const NegBoolView& b1);
1767  BoolTest bool_test(const NegBoolView& b0, const BoolView& b1);
1769  BoolTest bool_test(const NegBoolView& b0, const NegBoolView& b1);
1771 
1772 }}
1773 
1776 
1777 // STATISTICS: int-var
int offset(void) const
Access offset.
Definition: view.hpp:673
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Scale integer view (template)
Definition: view.hpp:704
Relation may hold or not.
Definition: view.hpp:1703
static const int BITS
How many bits does the status have.
Definition: view.hpp:1397
bool operator==(const CachedView< View > &x, const CachedView< View > &y)
Definition: cached.hpp:401
Offset(int off=0)
Constructor with offset off.
Definition: view.hpp:667
OffsetView ViewType
The view type.
Definition: view.hpp:653
Negated Boolean view.
Definition: view.hpp:1574
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
Definition: linear.cpp:46
RelTest rtest_eq_dom(VX x, VY y)
Test whether views x and y are equal (use full domain information)
Definition: rel-test.hpp:65
RangeList * _lastRange
Last cached range.
Definition: view.hpp:1173
Converter without offsets.
Definition: view.hpp:618
unsigned int BoolStatus
Type for status of a Boolean variable.
Definition: var-imp.hpp:484
RelTest rtest_gq(VX x, VY y)
Test whether view x is greater or equal than view y.
Definition: rel-test.hpp:196
int a
Scale factor.
Definition: view.hpp:708
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:49
bool any(const View &x)
Test whether x is neither positive nor negative.
Definition: mult.hpp:53
static const BoolStatus NONE
Status of domain not yet assigned.
Definition: var-imp.hpp:525
ViewRanges(void)
Default constructor.
Range iterator for range lists
int ModEvent
Type for modification events.
Definition: core.hpp:62
static const BoolStatus NONE
Status of domain not yet assigned.
Definition: view.hpp:1403
BoolTest
Boolean tests.
Definition: view.hpp:1751
Value iterator for integer views.
Definition: view.hpp:94
#define forceinline
Definition: config.hpp:185
RelTest rtest_le(VX x, VY y)
Test whether view x is less than view y.
Definition: rel-test.hpp:180
int offset(void) const
Access offset.
Definition: view.hpp:642
Base-class for constant views.
Definition: view.hpp:45
Computation spaces.
Definition: core.hpp:1701
void init(const View &x)
Initialize with ranges for view x.
Base-class for derived views.
Definition: view.hpp:230
Range iterator for integer views.
Definition: view.hpp:54
Boolean variable implementation.
Definition: var-imp.hpp:491
Gecode::IntSet d(v, 7)
static const BoolStatus ONE
Status of domain assigned to one.
Definition: var-imp.hpp:523
Same variable.
Definition: view.hpp:1753
RelTest rtest_lq(VX x, VY y)
Test whether view x is less or equal than view y.
Definition: rel-test.hpp:164
Gecode::FloatVal c(-8, 8)
View ViewType
The view type.
Definition: view.hpp:621
static const BoolStatus ZERO
Status of domain assigned to zero.
Definition: view.hpp:1399
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
Gecode::IntArgs i({1, 2, 3, 4})
Relation does not hold.
Definition: view.hpp:1702
RelTest
Result of testing relation.
Definition: view.hpp:1701
struct Gecode::@593::NNF::@62::@63 b
For binary nodes (and, or, eqv)
Value iterator from range iterator.
unsigned int size(I &i)
Size of all ranges of range iterator i.
int min(void) const
Return smallest value of range.
void range(Home home, const IntVarArgs &x, SetVar y, SetVar z)
Post constraint .
Definition: minimodel.hh:2026
Base-class for variable implementation views.
Definition: view.hpp:133
void update(const NoOffset &)
Update during cloning.
Definition: view.hpp:638
Integer sets.
Definition: int.hh:174
BoolTest bool_test(const BoolView &b0, const BoolView &b1)
Definition: bool-test.hpp:41
Offset integer view.
Definition: view.hpp:443
void update(const Offset &o)
Update during cloning.
Definition: view.hpp:670
OffsetView operator()(IntView &x)
Return OffsetRefView for x.
Definition: view.hpp:676
RelTest rtest_nq_dom(VX x, VY y)
Test whether views x and y are different (use full domain information)
Definition: rel-test.hpp:126
Same variable but complement.
Definition: view.hpp:1754
Converter with fixed offset.
Definition: view.hpp:650
RelTest rtest_eq_bnd(VX x, VY y)
Test whether views x and y are equal (use bounds information)
Definition: rel-test.hpp:43
Zero integer view.
Definition: view.hpp:1014
Boolean integer variables.
Definition: int.hh:512
static const BoolStatus ZERO
Status of domain assigned to zero.
Definition: var-imp.hpp:521
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:67
Constant integer view.
Definition: view.hpp:851
int c
The offset.
Definition: view.hpp:655
bool operator!=(const CachedView< View > &x, const CachedView< View > &y)
Definition: cached.hpp:406
Integer view for integer variables.
Definition: view.hpp:129
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:767
Integer variable implementation.
Definition: var-imp.hpp:89
Generic domain change information to be supplied to advisors.
Definition: core.hpp:203
ScaleView< int, unsigned int > IntScaleView
Integer-precision integer scale view.
Definition: view.hpp:804
unsigned int _size
Size of cached domain.
Definition: view.hpp:1175
Minus integer view.
Definition: view.hpp:282
Integer variables.
Definition: int.hh:371
bool operator()(void) const
Test whether iterator is still at a range or done.
RelTest rtest_nq_bnd(VX x, VY y)
Test whether views x and y are different (use bounds information)
Definition: rel-test.hpp:104
Cached integer view.
Definition: view.hpp:1166
View & operator()(View &x)
Pass through x.
Definition: view.hpp:632
void operator++(void)
Move iterator to next range (if possible)
int max(void) const
Return largest value of range.
Post propagator for SetVar x
Definition: set.hh:767
No sharing.
Definition: view.hpp:1752
bool operator<(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:226
Lists of ranges (intervals)
Definition: range-list.hpp:49
static const BoolStatus ONE
Status of domain assigned to one.
Definition: view.hpp:1401
Gecode toplevel namespace
Range iterator for computing set difference.
Definition: ranges-diff.hpp:43
RelTest rtest_gr(VX x, VY y)
Test whether view x is greater than view y.
Definition: rel-test.hpp:212
ScaleView< long long int, unsigned long long int > LLongScaleView
Long long-precision integer scale view.
Definition: view.hpp:810
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
static const int BITS
How many bits does the status have.
Definition: var-imp.hpp:519
Relation does hold.
Definition: view.hpp:1704
void update(IntSet &y, Space &home, IntSet &py)
Definition: rel.hpp:103
Iter::Ranges::RangeList cr
Cached domain iterator.
Definition: view.hpp:1359
Range iterator for cached integer views
Definition: view.hpp:1153
RangeList * _firstRange
First cached range.
Definition: view.hpp:1171
ViewRanges< View > dr
Current domain iterator.
Definition: view.hpp:1361
Boolean view for Boolean variables.
Definition: view.hpp:1380