Generated on Sat Jun 2 2018 07:17:44 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 
425 
434  class OffsetView : public DerivedView<IntView> {
435  protected:
437  int c;
439  public:
441 
442  OffsetView(void);
445  OffsetView(const IntView& y, int c);
447 
449 
450  int offset(void) const;
453  void offset(int n);
455  int min(void) const;
457  int max(void) const;
459  int med(void) const;
461  int val(void) const;
462 #ifdef GECODE_HAS_CBS
463  int baseval(int val) const;
465 #endif
466 
468  unsigned int size(void) const;
470  unsigned int width(void) const;
472  unsigned int regret_min(void) const;
474  unsigned int regret_max(void) const;
476 
478 
479  bool range(void) const;
481 
483  bool in(int n) const;
485  bool in(long long int n) const;
487 
489 
490  ModEvent lq(Space& home, int n);
493  ModEvent lq(Space& home, long long int n);
494 
496  ModEvent le(Space& home, int n);
498  ModEvent le(Space& home, long long int n);
499 
501  ModEvent gq(Space& home, int n);
503  ModEvent gq(Space& home, long long int n);
504 
506  ModEvent gr(Space& home, int n);
508  ModEvent gr(Space& home, long long int n);
509 
511  ModEvent nq(Space& home, int n);
513  ModEvent nq(Space& home, long long int n);
514 
516  ModEvent eq(Space& home, int n);
518  ModEvent eq(Space& home, long long int n);
520 
536  template<class I>
538  ModEvent narrow_r(Space& home, I& i, bool depends=true);
540  template<class I>
541  ModEvent inter_r(Space& home, I& i, bool depends=true);
543  template<class I>
544  ModEvent minus_r(Space& home, I& i, bool depends=true);
546  template<class I>
547  ModEvent narrow_v(Space& home, I& i, bool depends=true);
549  template<class I>
550  ModEvent inter_v(Space& home, I& i, bool depends=true);
552  template<class I>
553  ModEvent minus_v(Space& home, I& i, bool depends=true);
555 
557 
558  static ModEventDelta med(ModEvent me);
561 
563 
564  int min(const Delta& d) const;
567  int max(const Delta& d) const;
569  unsigned int width(const Delta& d) const;
571  bool any(const Delta& d) const;
573 
575 
576  void update(Space& home, OffsetView& y);
579  };
580 
585  template<class Char, class Traits>
586  std::basic_ostream<Char,Traits>&
587  operator <<(std::basic_ostream<Char,Traits>& os, const OffsetView& x);
588 
593  bool same(const OffsetView& x, const OffsetView& y);
596  bool before(const OffsetView& x, const OffsetView& y);
598 
602  template<class View>
603  class NoOffset {
604  public:
606  typedef View ViewType;
608  View& operator ()(View& x);
610  void update(const NoOffset&);
612  int offset(void) const;
613  };
614 
615  template<class View>
616  forceinline View&
618  return x;
619  }
620 
621  template<class View>
622  forceinline void
624 
625  template<class View>
626  forceinline int
628  return 0;
629  }
630 
631 
635  class Offset {
636  public:
640  int c;
642  Offset(int off = 0);
646  void update(const Offset& o);
648  int offset(void) const;
649  };
650 
652  Offset::Offset(int off) : c(off) {}
653 
654  forceinline void
655  Offset::update(const Offset& o) { c = o.c; }
656 
657  forceinline int
658  Offset::offset(void) const { return c; }
659 
662  return OffsetView(x,c);
663  }
664 
688  template<class Val, class UnsVal>
689  class ScaleView : public DerivedView<IntView> {
690  protected:
693  int a;
694  public:
696 
697  ScaleView(void);
700  ScaleView(int b, const IntView& y);
702 
704 
705  int scale(void) const;
708  Val min(void) const;
710  Val max(void) const;
712  Val med(void) const;
714  Val val(void) const;
715 #ifdef GECODE_HAS_CBS
716  Val baseval(Val val) const;
718 #endif
719 
721  UnsVal size(void) const;
723  UnsVal width(void) const;
725  UnsVal regret_min(void) const;
727  UnsVal regret_max(void) const;
729 
731 
732  bool range(void) const;
735  bool in(Val n) const;
737 
739 
740  ModEvent lq(Space& home, Val n);
743  ModEvent le(Space& home, Val n);
745  ModEvent gq(Space& home, Val n);
747  ModEvent gr(Space& home, Val n);
749  ModEvent nq(Space& home, Val n);
751  ModEvent eq(Space& home, Val n);
753 
755 
756  static ModEventDelta med(ModEvent me);
759 
761 
762  Val min(const Delta& d) const;
765  Val max(const Delta& d) const;
767  UnsVal width(const Delta& d) const;
769  bool any(const Delta& d) const;
771 
773 
774  void update(Space& home, ScaleView<Val,UnsVal>& y);
777  };
778 
784 
790 
795  template<class Char, class Traits>
796  std::basic_ostream<Char,Traits>&
797  operator <<(std::basic_ostream<Char,Traits>& os, const IntScaleView& x);
798 
803  template<class Char, class Traits>
804  std::basic_ostream<Char,Traits>&
805  operator <<(std::basic_ostream<Char,Traits>& os, const LLongScaleView& x);
806 
811  template<class Val, class UnsVal>
813  bool same(const ScaleView<Val,UnsVal>& x, const ScaleView<Val,UnsVal>& y);
815  template<class Val, class UnsVal>
818 
819 
820 
828  class ConstIntView : public ConstView<IntView> {
829  protected:
830  int x;
831  public:
833 
834  ConstIntView(void);
837  ConstIntView(int n);
839 
841 
842  int min(void) const;
845  int max(void) const;
847  int med(void) const;
849  int val(void) const;
850 
852  unsigned int size(void) const;
854  unsigned int width(void) const;
856  unsigned int regret_min(void) const;
858  unsigned int regret_max(void) const;
860 
862 
863  bool range(void) const;
866  bool in(int n) const;
868  bool in(long long int n) const;
870 
872 
873  ModEvent lq(Space& home, int n);
876  ModEvent lq(Space& home, long long int n);
877 
879  ModEvent le(Space& home, int n);
881  ModEvent le(Space& home, long long int n);
882 
884  ModEvent gq(Space& home, int n);
886  ModEvent gq(Space& home, long long int n);
887 
889  ModEvent gr(Space& home, int n);
891  ModEvent gr(Space& home, long long int n);
892 
894  ModEvent nq(Space& home, int n);
896  ModEvent nq(Space& home, long long int n);
897 
899  ModEvent eq(Space& home, int n);
901  ModEvent eq(Space& home, long long int n);
903 
919  template<class I>
921  ModEvent narrow_r(Space& home, I& i, bool depends=true);
923  template<class I>
924  ModEvent inter_r(Space& home, I& i, bool depends=true);
926  template<class I>
927  ModEvent minus_r(Space& home, I& i, bool depends=true);
929  template<class I>
930  ModEvent narrow_v(Space& home, I& i, bool depends=true);
932  template<class I>
933  ModEvent inter_v(Space& home, I& i, bool depends=true);
935  template<class I>
936  ModEvent minus_v(Space& home, I& i, bool depends=true);
938 
940 
941  int min(const Delta& d) const;
944  int max(const Delta& d) const;
946  unsigned int width(const Delta& d) const;
948  bool any(const Delta& d) const;
950 
952 
953  void update(Space& home, ConstIntView& y);
956  };
957 
962  template<class Char, class Traits>
963  std::basic_ostream<Char,Traits>&
964  operator <<(std::basic_ostream<Char,Traits>& os, const ConstIntView& x);
965 
971  bool same(const ConstIntView& x, const ConstIntView& y);
974  bool before(const ConstIntView& x, const ConstIntView& y);
976 
977 
985  class ZeroIntView : public ConstView<IntView> {
986  public:
988 
989  ZeroIntView(void);
992 
994 
995  int min(void) const;
998  int max(void) const;
1000  int med(void) const;
1002  int val(void) const;
1003 
1005  unsigned int size(void) const;
1007  unsigned int width(void) const;
1009  unsigned int regret_min(void) const;
1011  unsigned int regret_max(void) const;
1013 
1015 
1016  bool range(void) const;
1019  bool in(int n) const;
1021  bool in(long long int n) const;
1023 
1025 
1026  ModEvent lq(Space& home, int n);
1029  ModEvent lq(Space& home, long long int n);
1030 
1032  ModEvent le(Space& home, int n);
1034  ModEvent le(Space& home, long long int n);
1035 
1037  ModEvent gq(Space& home, int n);
1039  ModEvent gq(Space& home, long long int n);
1040 
1042  ModEvent gr(Space& home, int n);
1044  ModEvent gr(Space& home, long long int n);
1045 
1047  ModEvent nq(Space& home, int n);
1049  ModEvent nq(Space& home, long long int n);
1050 
1052  ModEvent eq(Space& home, int n);
1054  ModEvent eq(Space& home, long long int n);
1056 
1072  template<class I>
1074  ModEvent narrow_r(Space& home, I& i, bool depends=true);
1076  template<class I>
1077  ModEvent inter_r(Space& home, I& i, bool depends=true);
1079  template<class I>
1080  ModEvent minus_r(Space& home, I& i, bool depends=true);
1082  template<class I>
1083  ModEvent narrow_v(Space& home, I& i, bool depends=true);
1085  template<class I>
1086  ModEvent inter_v(Space& home, I& i, bool depends=true);
1088  template<class I>
1089  ModEvent minus_v(Space& home, I& i, bool depends=true);
1091 
1093 
1094  int min(const Delta& d) const;
1097  int max(const Delta& d) const;
1099  unsigned int width(const Delta& d) const;
1101  bool any(const Delta& d) const;
1103  };
1104 
1109  template<class Char, class Traits>
1110  std::basic_ostream<Char,Traits>&
1111  operator <<(std::basic_ostream<Char,Traits>& os, const ZeroIntView& x);
1112 
1118  bool same(const ZeroIntView& x, const ZeroIntView& y);
1121 
1122  template<class View> class ViewDiffRanges;
1123 
1134  template<class View>
1135  class CachedView : public DerivedView<View> {
1136  friend class ViewDiffRanges<View>;
1137  protected:
1138  using DerivedView<View>::x;
1144  unsigned int _size;
1145  public:
1147 
1148  CachedView(void);
1151  explicit CachedView(const View& y);
1153 
1155 
1156  int min(void) const;
1159  int max(void) const;
1161  int med(void) const;
1163  int val(void) const;
1164 #ifdef GECODE_HAS_CBS
1165  int baseval(int val) const;
1167 #endif
1168 
1170  unsigned int size(void) const;
1172  unsigned int width(void) const;
1174  unsigned int regret_min(void) const;
1176  unsigned int regret_max(void) const;
1178 
1180 
1181  bool range(void) const;
1183 
1185  bool in(int n) const;
1187  bool in(long long int n) const;
1189 
1191 
1192  ModEvent lq(Space& home, int n);
1195  ModEvent lq(Space& home, long long int n);
1196 
1198  ModEvent le(Space& home, int n);
1200  ModEvent le(Space& home, long long int n);
1201 
1203  ModEvent gq(Space& home, int n);
1205  ModEvent gq(Space& home, long long int n);
1206 
1208  ModEvent gr(Space& home, int n);
1210  ModEvent gr(Space& home, long long int n);
1211 
1213  ModEvent nq(Space& home, int n);
1215  ModEvent nq(Space& home, long long int n);
1216 
1218  ModEvent eq(Space& home, int n);
1220  ModEvent eq(Space& home, long long int n);
1222 
1238  template<class I>
1240  ModEvent narrow_r(Space& home, I& i, bool depends=true);
1242  template<class I>
1243  ModEvent inter_r(Space& home, I& i, bool depends=true);
1245  template<class I>
1246  ModEvent minus_r(Space& home, I& i, bool depends=true);
1248  template<class I>
1249  ModEvent narrow_v(Space& home, I& i, bool depends=true);
1251  template<class I>
1252  ModEvent inter_v(Space& home, I& i, bool depends=true);
1254  template<class I>
1255  ModEvent minus_v(Space& home, I& i, bool depends=true);
1257 
1259 
1260  static ModEventDelta med(ModEvent me);
1263 
1265 
1266  int min(const Delta& d) const;
1269  int max(const Delta& d) const;
1271  unsigned int width(const Delta& d) const;
1273  bool any(const Delta& d) const;
1275 
1277 
1278  void initCache(Space& home, const IntSet& s);
1281  void cache(Space& home);
1283  bool modified(void) const;
1285 
1287 
1288  void update(Space& home, CachedView<View>& y);
1291  };
1292 
1297  template<class Char, class Traits, class View>
1298  std::basic_ostream<Char,Traits>&
1299  operator <<(std::basic_ostream<Char,Traits>& os, const CachedView<View>& x);
1300 
1305  template<class View>
1307  bool same(const CachedView<View>& x, const CachedView<View>& y);
1309  template<class View>
1310  bool before(const CachedView<View>& x, const CachedView<View>& y);
1312 
1321  template<class View>
1322  class ViewDiffRanges
1323  : public Iter::Ranges::Diff<Iter::Ranges::RangeList,ViewRanges<View> > {
1325  Super;
1326  protected:
1331  public:
1333 
1334  ViewDiffRanges(void);
1337  ViewDiffRanges(const CachedView<View>& x);
1339  void init(const CachedView<View>& x);
1341  };
1342 
1349  class BoolView : public VarImpView<BoolVar> {
1350  protected:
1351  using VarImpView<BoolVar>::x;
1352  public:
1354 
1355  BoolView(void);
1358  BoolView(const BoolVar& y);
1360  BoolView(BoolVarImp* y);
1362 
1364 
1365  static const int BITS = BoolVarImp::BITS;
1368  static const BoolStatus ZERO = BoolVarImp::ZERO;
1370  static const BoolStatus ONE = BoolVarImp::ONE;
1372  static const BoolStatus NONE = BoolVarImp::NONE;
1374  BoolStatus status(void) const;
1376 
1378 
1379  int min(void) const;
1382  int max(void) const;
1384  int med(void) const;
1386  int val(void) const;
1387 #ifdef GECODE_HAS_CBS
1388  int baseval(int val) const;
1390 #endif
1391 
1393  unsigned int size(void) const;
1395  unsigned int width(void) const;
1397  unsigned int regret_min(void) const;
1399  unsigned int regret_max(void) const;
1401 
1403 
1404  bool range(void) const;
1407  bool in(int n) const;
1409  bool in(long long int n) const;
1411 
1413 
1414  bool zero(void) const;
1417  bool one(void) const;
1419  bool none(void) const;
1421 
1423 
1424  ModEvent one(Space& home);
1427  ModEvent zero(Space& home);
1429  ModEvent one_none(Space& home);
1431  ModEvent zero_none(Space& home);
1433 
1435 
1436  ModEvent lq(Space& home, int n);
1439  ModEvent lq(Space& home, long long int n);
1440 
1442  ModEvent le(Space& home, int n);
1444  ModEvent le(Space& home, long long int n);
1445 
1447  ModEvent gq(Space& home, int n);
1449  ModEvent gq(Space& home, long long int n);
1450 
1452  ModEvent gr(Space& home, int n);
1454  ModEvent gr(Space& home, long long int n);
1455 
1457  ModEvent nq(Space& home, int n);
1459  ModEvent nq(Space& home, long long int n);
1460 
1462  ModEvent eq(Space& home, int n);
1464  ModEvent eq(Space& home, long long int n);
1466 
1482  template<class I>
1484  ModEvent narrow_r(Space& home, I& i, bool depends=true);
1486  template<class I>
1487  ModEvent inter_r(Space& home, I& i, bool depends=true);
1489  template<class I>
1490  ModEvent minus_r(Space& home, I& i, bool depends=true);
1492  template<class I>
1493  ModEvent narrow_v(Space& home, I& i, bool depends=true);
1495  template<class I>
1496  ModEvent inter_v(Space& home, I& i, bool depends=true);
1498  template<class I>
1499  ModEvent minus_v(Space& home, I& i, bool depends=true);
1501 
1503 
1504  int min(const Delta& d) const;
1507  int max(const Delta& d) const;
1509  unsigned int width(const Delta& d) const;
1511  bool any(const Delta& d) const;
1513  static bool zero(const Delta& d);
1515  static bool one(const Delta& d);
1517 
1519 
1520  static ModEventDelta med(ModEvent me);
1523  };
1524 
1529  template<class Char, class Traits>
1530  std::basic_ostream<Char,Traits>&
1531  operator <<(std::basic_ostream<Char,Traits>& os, const BoolView& x);
1532 
1533 
1534 
1543  class NegBoolView : public DerivedView<BoolView> {
1544  protected:
1546  public:
1548 
1549  NegBoolView(void);
1552  explicit NegBoolView(const BoolView& y);
1554 
1556 
1557  static const int BITS = BoolView::BITS;
1560  static const BoolStatus ZERO = BoolView::ONE;
1562  static const BoolStatus ONE = BoolView::ZERO;
1564  static const BoolStatus NONE = BoolView::NONE;
1566  BoolStatus status(void) const;
1568 
1570 
1571  bool zero(void) const;
1574  bool one(void) const;
1576  bool none(void) const;
1578 
1580 
1581  ModEvent one(Space& home);
1584  ModEvent zero(Space& home);
1586  ModEvent one_none(Space& home);
1588  ModEvent zero_none(Space& home);
1590 
1592 
1593  int min(void) const;
1596  int max(void) const;
1598  int val(void) const;
1599 #ifdef GECODE_HAS_CBS
1600  int baseval(int val) const;
1602 #endif
1603 
1604 
1606 
1607  int min(const Delta& d) const;
1610  int max(const Delta& d) const;
1612  unsigned int width(const Delta& d) const;
1614  bool any(const Delta& d) const;
1616  static bool zero(const Delta& d);
1618  static bool one(const Delta& d);
1620  };
1621 
1626  template<class Char, class Traits>
1627  std::basic_ostream<Char,Traits>&
1628  operator <<(std::basic_ostream<Char,Traits>& os, const NegBoolView& x);
1629 
1630 }}
1631 
1632 #include <gecode/int/var/int.hpp>
1633 #include <gecode/int/var/bool.hpp>
1634 
1635 #include <gecode/int/view/int.hpp>
1636 
1638 #include <gecode/int/view/zero.hpp>
1639 #include <gecode/int/view/minus.hpp>
1640 #include <gecode/int/view/offset.hpp>
1641 #include <gecode/int/view/scale.hpp>
1642 #include <gecode/int/view/cached.hpp>
1643 
1644 #include <gecode/int/view/bool.hpp>
1645 
1647 
1648 #include <gecode/int/view/print.hpp>
1649 #include <gecode/int/var/print.hpp>
1650 
1651 namespace Gecode { namespace Int {
1652 
1659  enum RelTest {
1661  RT_FALSE = 0,
1662  RT_MAYBE = 1,
1663  RT_TRUE = 2
1664  };
1665 
1667  template<class VX, class VY> RelTest rtest_eq_bnd(VX x, VY y);
1669  template<class VX, class VY> RelTest rtest_eq_dom(VX x, VY y);
1671  template<class VX> RelTest rtest_eq_bnd(VX x, int n);
1673  template<class VX> RelTest rtest_eq_dom(VX x, int n);
1674 
1676  template<class VX, class VY> RelTest rtest_nq_bnd(VX x, VY y);
1678  template<class VX, class VY> RelTest rtest_nq_dom(VX x, VY y);
1680  template<class VX> RelTest rtest_nq_bnd(VX x, int n);
1682  template<class VX> RelTest rtest_nq_dom(VX x, int n);
1683 
1685  template<class VX, class VY> RelTest rtest_lq(VX x, VY y);
1687  template<class VX> RelTest rtest_lq(VX x, int n);
1688 
1690  template<class VX, class VY> RelTest rtest_le(VX x, VY y);
1692  template<class VX> RelTest rtest_le(VX x, int n);
1693 
1695  template<class VX, class VY> RelTest rtest_gq(VX x, VY y);
1697  template<class VX> RelTest rtest_gq(VX x, int n);
1698 
1700  template<class VX, class VY> RelTest rtest_gr(VX x, VY y);
1702  template<class VX> RelTest rtest_gr(VX x, int n);
1704 
1705 
1710  enum BoolTest {
1714  };
1715 
1721  BoolTest bool_test(const BoolView& b0, const BoolView& b1);
1724  BoolTest bool_test(const BoolView& b0, const NegBoolView& b1);
1726  BoolTest bool_test(const NegBoolView& b0, const BoolView& b1);
1728  BoolTest bool_test(const NegBoolView& b0, const NegBoolView& b1);
1730 
1731 }}
1732 
1735 
1736 // STATISTICS: int-var
int offset(void) const
Access offset.
Definition: view.hpp:658
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Scale integer view (template)
Definition: view.hpp:689
Relation may hold or not.
Definition: view.hpp:1662
static const int BITS
How many bits does the status have.
Definition: view.hpp:1366
Offset(int off=0)
Constructor with offset off.
Definition: view.hpp:652
OffsetView ViewType
The view type.
Definition: view.hpp:638
Negated Boolean view.
Definition: view.hpp:1543
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:1142
Converter without offsets.
Definition: view.hpp:603
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:693
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
bool before(const CachedView< View > &x, const CachedView< View > &y)
Definition: cached.hpp:406
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:1372
BoolTest
Boolean tests.
Definition: view.hpp:1710
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:627
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:1712
RelTest rtest_lq(VX x, VY y)
Test whether view x is less or equal than view y.
Definition: rel-test.hpp:164
bool same(const CachedView< View > &x, const CachedView< View > &y)
Definition: cached.hpp:401
Gecode::FloatVal c(-8, 8)
View ViewType
The view type.
Definition: view.hpp:606
static const BoolStatus ZERO
Status of domain assigned to zero.
Definition: view.hpp:1368
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
Relation does not hold.
Definition: view.hpp:1661
RelTest
Result of testing relation.
Definition: view.hpp:1660
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:127
void update(const NoOffset &)
Update during cloning.
Definition: view.hpp:623
Integer sets.
Definition: int.hh:170
BoolTest bool_test(const BoolView &b0, const BoolView &b1)
Definition: bool-test.hpp:41
Offset integer view.
Definition: view.hpp:434
void update(const Offset &o)
Update during cloning.
Definition: view.hpp:655
OffsetView operator()(IntView &x)
Return OffsetRefView for x.
Definition: view.hpp:661
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:1713
Converter with fixed offset.
Definition: view.hpp:635
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:985
Boolean integer variables.
Definition: int.hh:488
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:828
int c
The offset.
Definition: view.hpp:640
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
Integer view for integer variables.
Definition: view.hpp:129
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:765
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:783
unsigned int _size
Size of cached domain.
Definition: view.hpp:1144
Minus integer view.
Definition: view.hpp:282
Integer variables.
Definition: int.hh:347
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:1135
View & operator()(View &x)
Pass through x.
Definition: view.hpp:617
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:765
No sharing.
Definition: view.hpp:1711
Lists of ranges (intervals)
Definition: range-list.hpp:49
static const BoolStatus ONE
Status of domain assigned to one.
Definition: view.hpp:1370
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:789
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:1663
void update(IntSet &y, Space &home, IntSet &py)
Definition: rel.hpp:103
Iter::Ranges::RangeList cr
Cached domain iterator.
Definition: view.hpp:1328
Range iterator for cached integer views
Definition: view.hpp:1122
RangeList * _firstRange
First cached range.
Definition: view.hpp:1140
ViewRanges< View > dr
Current domain iterator.
Definition: view.hpp:1330
Boolean view for Boolean variables.
Definition: view.hpp:1349