Generated on Tue Jan 26 2021 00:00:00 for Gecode by doxygen 1.9.1
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
155  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 
228  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
306  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 
379  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 
430  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
473  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 
546  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 
609  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
732  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 
833  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 
943  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 
1001  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 
1102  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 
1148  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
1197  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 
1270  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 
1337  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>
1354  : public Iter::Ranges::Diff<Iter::Ranges::RangeList,ViewRanges<View> > {
1356  Super;
1357  protected:
1362  public:
1364 
1365  ViewDiffRanges(void);
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;
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
1420  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 
1514  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;
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  ModEvent lq(Space& home, int n);
1627  ModEvent lq(Space& home, long long int n);
1628 
1630  ModEvent le(Space& home, int n);
1632  ModEvent le(Space& home, long long int n);
1633 
1635  ModEvent gq(Space& home, int n);
1637  ModEvent gq(Space& home, long long int n);
1638 
1640  ModEvent gr(Space& home, int n);
1642  ModEvent gr(Space& home, long long int n);
1643 
1645  ModEvent nq(Space& home, int n);
1647  ModEvent nq(Space& home, long long int n);
1648 
1650  ModEvent eq(Space& home, int n);
1652  ModEvent eq(Space& home, long long int n);
1654 
1656 
1657  int min(void) const;
1660  int max(void) const;
1662  int val(void) const;
1663 #ifdef GECODE_HAS_CBS
1665  int baseval(int val) const;
1666 #endif
1668 
1670 
1671  int min(const Delta& d) const;
1674  int max(const Delta& d) const;
1676  unsigned int width(const Delta& d) const;
1678  bool any(const Delta& d) const;
1680  static bool zero(const Delta& d);
1682  static bool one(const Delta& d);
1684  };
1685 
1691  bool operator ==(const NegBoolView& x, const NegBoolView& y);
1693  bool operator !=(const NegBoolView& x, const NegBoolView& y);
1695 
1700  template<class Char, class Traits>
1701  std::basic_ostream<Char,Traits>&
1702  operator <<(std::basic_ostream<Char,Traits>& os, const NegBoolView& x);
1703 
1704 }}
1705 
1706 #include <gecode/int/var/int.hpp>
1707 #include <gecode/int/var/bool.hpp>
1708 
1709 #include <gecode/int/view/int.hpp>
1710 
1712 #include <gecode/int/view/zero.hpp>
1713 #include <gecode/int/view/minus.hpp>
1714 #include <gecode/int/view/offset.hpp>
1715 #include <gecode/int/view/scale.hpp>
1716 #include <gecode/int/view/cached.hpp>
1717 
1718 #include <gecode/int/view/bool.hpp>
1719 
1721 
1722 #include <gecode/int/view/print.hpp>
1723 #include <gecode/int/var/print.hpp>
1724 
1725 namespace Gecode { namespace Int {
1726 
1734  enum RelTest {
1735  RT_FALSE = 0,
1736  RT_MAYBE = 1,
1737  RT_TRUE = 2
1738  };
1739 
1741  template<class VX, class VY> RelTest rtest_eq_bnd(VX x, VY y);
1743  template<class VX, class VY> RelTest rtest_eq_dom(VX x, VY y);
1745  template<class VX> RelTest rtest_eq_bnd(VX x, int n);
1747  template<class VX> RelTest rtest_eq_dom(VX x, int n);
1748 
1750  template<class VX, class VY> RelTest rtest_nq_bnd(VX x, VY y);
1752  template<class VX, class VY> RelTest rtest_nq_dom(VX x, VY y);
1754  template<class VX> RelTest rtest_nq_bnd(VX x, int n);
1756  template<class VX> RelTest rtest_nq_dom(VX x, int n);
1757 
1759  template<class VX, class VY> RelTest rtest_lq(VX x, VY y);
1761  template<class VX> RelTest rtest_lq(VX x, int n);
1762 
1764  template<class VX, class VY> RelTest rtest_le(VX x, VY y);
1766  template<class VX> RelTest rtest_le(VX x, int n);
1767 
1769  template<class VX, class VY> RelTest rtest_gq(VX x, VY y);
1771  template<class VX> RelTest rtest_gq(VX x, int n);
1772 
1774  template<class VX, class VY> RelTest rtest_gr(VX x, VY y);
1776  template<class VX> RelTest rtest_gr(VX x, int n);
1778 
1779 
1784  enum BoolTest {
1787  BT_COMP
1788  };
1789 
1796  BoolTest bool_test(const BoolView& b0, const BoolView& b1);
1798  BoolTest bool_test(const BoolView& b0, const NegBoolView& b1);
1800  BoolTest bool_test(const NegBoolView& b0, const BoolView& b1);
1802  BoolTest bool_test(const NegBoolView& b0, const NegBoolView& b1);
1804 
1805 }}
1806 
1809 
1810 // STATISTICS: int-var
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:249
Boolean integer variables.
Definition: int.hh:512
Base-class for constant views.
Definition: view.hpp:45
Generic domain change information to be supplied to advisors.
Definition: core.hpp:204
Base-class for derived views.
Definition: view.hpp:230
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
Definition: view.hpp:639
Integer sets.
Definition: int.hh:174
Integer variables.
Definition: int.hh:371
Boolean variable implementation.
Definition: var-imp.hpp:491
static const int BITS
How many bits does the status have.
Definition: var-imp.hpp:519
static const BoolStatus NONE
Status of domain not yet assigned.
Definition: var-imp.hpp:525
static const BoolStatus ZERO
Status of domain assigned to zero.
Definition: var-imp.hpp:521
static const BoolStatus ONE
Status of domain assigned to one.
Definition: var-imp.hpp:523
Boolean view for Boolean variables.
Definition: view.hpp:1380
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: bool.hpp:125
bool in(int n) const
Test whether n is contained in domain.
Definition: bool.hpp:111
BoolView(void)
Default constructor.
Definition: bool.hpp:45
int max(void) const
Return maximum of domain.
Definition: bool.hpp:66
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition: bool.hpp:273
static const BoolStatus NONE
Status of domain not yet assigned.
Definition: view.hpp:1403
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value)
Definition: bool.hpp:97
static const BoolStatus ONE
Status of domain assigned to one.
Definition: view.hpp:1401
ModEvent narrow_r(Space &home, I &i, bool depends=true)
Replace domain by ranges described by i.
Definition: bool.hpp:185
int min(void) const
Return minimum of domain.
Definition: bool.hpp:62
ModEvent inter_r(Space &home, I &i, bool depends=true)
Intersect domain with ranges described by i.
Definition: bool.hpp:190
bool range(void) const
Test whether domain is a range.
Definition: bool.hpp:107
ModEvent zero_none(Space &home)
Assign not yet assigned view to zero.
Definition: bool.hpp:238
unsigned int size(void) const
Return size (cardinality) of domain.
Definition: bool.hpp:85
ModEvent narrow_v(Space &home, I &i, bool depends=true)
Replace domain by values described by i.
Definition: bool.hpp:200
bool none(void) const
Test whether view is not yet assigned.
Definition: bool.hpp:228
ModEvent inter_v(Space &home, I &i, bool depends=true)
Intersect domain with values described by i.
Definition: bool.hpp:205
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition: bool.hpp:161
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: bool.hpp:143
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition: bool.hpp:134
BoolStatus status(void) const
Return current domain status.
Definition: bool.hpp:58
bool zero(void) const
Test whether view is assigned to be zero.
Definition: bool.hpp:220
ModEvent one_none(Space &home)
Assign not yet assigned view to one.
Definition: bool.hpp:242
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition: bool.hpp:152
static const int BITS
How many bits does the status have.
Definition: view.hpp:1397
int med(void) const
Return median of domain (greatest element not greater than the median)
Definition: bool.hpp:70
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: bool.hpp:170
bool one(void) const
Test whether view is assigned to be one.
Definition: bool.hpp:224
ModEvent minus_r(Space &home, I &i, bool depends=true)
Remove from domain the ranges described by i.
Definition: bool.hpp:195
int val(void) const
Return assigned value (only if assigned)
Definition: bool.hpp:74
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value)
Definition: bool.hpp:93
static const BoolStatus ZERO
Status of domain assigned to zero.
Definition: view.hpp:1399
ModEvent minus_v(Space &home, I &i, bool depends=true)
Remove from domain the values described by i.
Definition: bool.hpp:210
unsigned int width(void) const
Return width of domain (distance between maximum and minimum)
Definition: bool.hpp:89
Cached integer view.
Definition: view.hpp:1166
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: cached.hpp:154
unsigned int size(void) const
Return size (cardinality) of domain.
Definition: cached.hpp:93
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition: cached.hpp:269
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition: cached.hpp:144
int med(void) const
Return median of domain (greatest element not greater than the median)
Definition: cached.hpp:70
unsigned int width(void) const
Return width of domain (distance between maximum and minimum)
Definition: cached.hpp:88
ModEvent inter_v(Space &home, I &i, bool depends=true)
Intersect domain with values described by i.
Definition: cached.hpp:225
ModEvent narrow_r(Space &home, I &i, bool depends=true)
Replace domain by ranges described by i.
Definition: cached.hpp:201
ModEvent minus_v(Space &home, I &i, bool depends=true)
Remove from domain the values described by i.
Definition: cached.hpp:231
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: cached.hpp:184
RangeList * _firstRange
First cached range.
Definition: view.hpp:1171
RangeList * _lastRange
Last cached range.
Definition: view.hpp:1173
ModEvent minus_r(Space &home, I &i, bool depends=true)
Remove from domain the ranges described by i.
Definition: cached.hpp:213
bool in(int n) const
Test whether n is contained in domain.
Definition: cached.hpp:118
void initCache(Space &home, const IntSet &s)
Initialize cache to set s.
Definition: cached.hpp:307
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value)
Definition: cached.hpp:103
ModEvent narrow_v(Space &home, I &i, bool depends=true)
Replace domain by values described by i.
Definition: cached.hpp:219
unsigned int _size
Size of cached domain.
Definition: view.hpp:1175
bool range(void) const
Test whether domain is a range.
Definition: cached.hpp:113
int val(void) const
Return assigned value (only if assigned)
Definition: cached.hpp:75
void cache(Space &home)
Update cache to current domain.
Definition: cached.hpp:319
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: cached.hpp:134
ModEvent inter_r(Space &home, I &i, bool depends=true)
Intersect domain with ranges described by i.
Definition: cached.hpp:207
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition: cached.hpp:164
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value)
Definition: cached.hpp:98
int min(void) const
Return minimum of domain.
Definition: cached.hpp:60
bool modified(void) const
Check whether cache differs from current domain.
Definition: cached.hpp:336
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition: cached.hpp:174
void update(Space &home, CachedView< View > &y)
Update this view to be a clone of view y.
Definition: cached.hpp:281
int max(void) const
Return maximum of domain.
Definition: cached.hpp:65
CachedView(void)
Default constructor.
Definition: cached.hpp:46
Constant integer view.
Definition: view.hpp:851
ModEvent narrow_r(Space &home, I &i, bool depends=true)
Replace domain by ranges described by i.
Definition: constint.hpp:168
ModEvent inter_v(Space &home, I &i, bool depends=true)
Intersect domain with values described by i.
Definition: constint.hpp:192
bool range(void) const
Test whether domain is a range.
Definition: constint.hpp:89
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: constint.hpp:152
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition: constint.hpp:134
ModEvent inter_r(Space &home, I &i, bool depends=true)
Intersect domain with ranges described by i.
Definition: constint.hpp:173
bool operator<(const ConstIntView &y) const
Whether this view comes before view y (arbitray order)
Definition: constint.hpp:245
ModEvent minus_r(Space &home, I &i, bool depends=true)
Remove from domain the ranges described by i.
Definition: constint.hpp:180
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value)
Definition: constint.hpp:75
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value)
Definition: constint.hpp:79
bool in(int n) const
Test whether n is contained in domain.
Definition: constint.hpp:93
unsigned int size(void) const
Return size (cardinality) of domain.
Definition: constint.hpp:67
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: constint.hpp:107
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition: constint.hpp:143
int min(void) const
Return minimum of domain.
Definition: constint.hpp:50
int max(void) const
Return maximum of domain.
Definition: constint.hpp:54
unsigned int width(void) const
Return width of domain (distance between maximum and minimum)
Definition: constint.hpp:71
void update(Space &home, ConstIntView &y)
Update this view to be a clone of view y.
Definition: constint.hpp:234
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition: constint.hpp:116
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: constint.hpp:125
ModEvent narrow_v(Space &home, I &i, bool depends=true)
Replace domain by values described by i.
Definition: constint.hpp:187
ModEvent minus_v(Space &home, I &i, bool depends=true)
Remove from domain the values described by i.
Definition: constint.hpp:199
ConstIntView(void)
Default constructor.
Definition: constint.hpp:41
int val(void) const
Return assigned value (only if assigned)
Definition: constint.hpp:62
int med(void) const
Return median of domain (greatest element not greater than the median)
Definition: constint.hpp:58
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition: constint.hpp:223
Integer variable implementation.
Definition: var-imp.hpp:89
Integer view for integer variables.
Definition: view.hpp:129
unsigned int size(void) const
Return size (cardinality) of domain.
Definition: int.hpp:81
ModEvent inter_r(Space &home, I &i, bool depends=true)
Intersect domain with ranges described by i.
Definition: int.hpp:186
int min(void) const
Return minimum of domain.
Definition: int.hpp:58
unsigned int width(void) const
Return width of domain (distance between maximum and minimum)
Definition: int.hpp:85
bool range(void) const
Test whether domain is a range.
Definition: int.hpp:103
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition: int.hpp:148
ModEvent narrow_v(Space &home, I &i, bool depends=true)
Replace domain by values described by i.
Definition: int.hpp:196
bool in(int n) const
Test whether n is contained in domain.
Definition: int.hpp:107
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: int.hpp:121
int med(void) const
Return median of domain (greatest element not greater than the median)
Definition: int.hpp:66
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition: int.hpp:130
ModEvent inter_v(Space &home, I &i, bool depends=true)
Intersect domain with values described by i.
Definition: int.hpp:201
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: int.hpp:139
ModEvent minus_v(Space &home, I &i, bool depends=true)
Remove from domain the values described by i.
Definition: int.hpp:206
IntView(void)
Default constructor.
Definition: int.hpp:45
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value)
Definition: int.hpp:89
ModEvent minus_r(Space &home, I &i, bool depends=true)
Remove from domain the ranges described by i.
Definition: int.hpp:191
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value)
Definition: int.hpp:93
int val(void) const
Return assigned value (only if assigned)
Definition: int.hpp:70
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition: int.hpp:230
int max(void) const
Return maximum of domain.
Definition: int.hpp:62
ModEvent narrow_r(Space &home, I &i, bool depends=true)
Replace domain by ranges described by i.
Definition: int.hpp:181
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition: int.hpp:157
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: int.hpp:166
Minus integer view.
Definition: view.hpp:282
ModEvent narrow_v(Space &home, I &i, bool depends=true)
Replace domain by values described by i.
Definition: minus.hpp:196
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: minus.hpp:160
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition: minus.hpp:151
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value)
Definition: minus.hpp:87
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition: minus.hpp:124
unsigned int width(void) const
Return width of domain (distance between maximum and minimum)
Definition: minus.hpp:75
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition: minus.hpp:142
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: minus.hpp:115
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value)
Definition: minus.hpp:83
ModEvent minus_r(Space &home, I &i, bool depends=true)
Remove from domain the ranges described by i.
Definition: minus.hpp:189
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: minus.hpp:133
ModEvent inter_v(Space &home, I &i, bool depends=true)
Intersect domain with values described by i.
Definition: minus.hpp:203
int max(void) const
Return maximum of domain.
Definition: minus.hpp:60
int min(void) const
Return minimum of domain.
Definition: minus.hpp:56
ModEvent inter_r(Space &home, I &i, bool depends=true)
Intersect domain with ranges described by i.
Definition: minus.hpp:182
bool in(int n) const
Test whether n is contained in domain.
Definition: minus.hpp:101
bool range(void) const
Test whether domain is a range.
Definition: minus.hpp:97
unsigned int size(void) const
Return size (cardinality) of domain.
Definition: minus.hpp:79
ModEvent narrow_r(Space &home, I &i, bool depends=true)
Replace domain by ranges described by i.
Definition: minus.hpp:175
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition: minus.hpp:244
ModEvent minus_v(Space &home, I &i, bool depends=true)
Remove from domain the values described by i.
Definition: minus.hpp:210
MinusView(void)
Default constructor.
Definition: minus.hpp:45
int med(void) const
Return median of domain.
Definition: minus.hpp:297
int val(void) const
Return assigned value (only if assigned)
Definition: minus.hpp:64
Negated Boolean view.
Definition: view.hpp:1574
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition: neg-bool.hpp:129
BoolStatus status(void) const
Return current domain status.
Definition: neg-bool.hpp:61
bool zero(void) const
Test whether view is assigned to be zero.
Definition: neg-bool.hpp:65
bool one(void) const
Test whether view is assigned to be one.
Definition: neg-bool.hpp:69
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: neg-bool.hpp:121
bool none(void) const
Test whether view is not yet assigned.
Definition: neg-bool.hpp:73
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition: neg-bool.hpp:113
unsigned int width(const Delta &d) const
Return width of values just pruned.
Definition: neg-bool.hpp:190
ModEvent one_none(Space &home)
Assign not yet assigned view to one.
Definition: neg-bool.hpp:87
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition: neg-bool.hpp:194
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: neg-bool.hpp:105
static const BoolStatus ONE
Status of domain assigned to one.
Definition: view.hpp:1593
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition: neg-bool.hpp:137
int max(void) const
Return maximum of domain.
Definition: neg-bool.hpp:162
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: neg-bool.hpp:145
int min(void) const
Return minimum of domain.
Definition: neg-bool.hpp:158
static const BoolStatus NONE
Status of domain not yet assigned.
Definition: view.hpp:1595
ModEvent zero_none(Space &home)
Assign not yet assigned view to zero.
Definition: neg-bool.hpp:83
NegBoolView(void)
Default constructor.
Definition: neg-bool.hpp:50
int val(void) const
Return assigned value (only if assigned)
Definition: neg-bool.hpp:166
static const int BITS
How many bits does the status have.
Definition: view.hpp:1589
static const BoolStatus ZERO
Status of domain assigned to zero.
Definition: view.hpp:1591
Converter without offsets.
Definition: view.hpp:618
View ViewType
The view type.
Definition: view.hpp:621
void update(const NoOffset &)
Update during cloning.
int offset(void) const
Access offset.
View & operator()(View &x)
Pass through x.
Offset integer view.
Definition: view.hpp:443
int min(void) const
Return minimum of domain.
Definition: offset.hpp:64
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition: offset.hpp:154
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: offset.hpp:127
int val(void) const
Return assigned value (only if assigned)
Definition: offset.hpp:76
void update(Space &home, OffsetView &y)
Update this view to be a clone of view y.
Definition: offset.hpp:262
ModEvent inter_r(Space &home, I &i, bool depends=true)
Intersect domain with ranges described by i.
Definition: offset.hpp:193
int med(void) const
Return median of domain (greatest element not greater than the median)
Definition: offset.hpp:72
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value)
Definition: offset.hpp:95
ModEvent narrow_v(Space &home, I &i, bool depends=true)
Replace domain by values described by i.
Definition: offset.hpp:205
unsigned int size(void) const
Return size (cardinality) of domain.
Definition: offset.hpp:91
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value)
Definition: offset.hpp:99
ModEvent minus_v(Space &home, I &i, bool depends=true)
Remove from domain the values described by i.
Definition: offset.hpp:217
int offset(void) const
Return offset.
Definition: offset.hpp:56
int max(void) const
Return maximum of domain.
Definition: offset.hpp:68
unsigned int width(void) const
Return width of domain (distance between maximum and minimum)
Definition: offset.hpp:87
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition: offset.hpp:251
OffsetView(void)
Default constructor.
Definition: offset.hpp:45
bool in(int n) const
Test whether n is contained in domain.
Definition: offset.hpp:112
bool operator<(const OffsetView &y) const
Whether this view comes before view y (arbitray order)
Definition: offset.hpp:273
ModEvent minus_r(Space &home, I &i, bool depends=true)
Remove from domain the ranges described by i.
Definition: offset.hpp:199
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: offset.hpp:145
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition: offset.hpp:136
ModEvent inter_v(Space &home, I &i, bool depends=true)
Intersect domain with values described by i.
Definition: offset.hpp:211
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition: offset.hpp:163
bool range(void) const
Test whether domain is a range.
Definition: offset.hpp:108
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: offset.hpp:172
ModEvent narrow_r(Space &home, I &i, bool depends=true)
Replace domain by ranges described by i.
Definition: offset.hpp:187
Converter with fixed offset.
Definition: view.hpp:650
int c
The offset.
Definition: view.hpp:655
Offset(int off=0)
Constructor with offset off.
OffsetView ViewType
The view type.
Definition: view.hpp:653
void update(const Offset &o)
Update during cloning.
OffsetView operator()(IntView &x)
Return OffsetRefView for x.
int offset(void) const
Access offset.
Scale integer view (template)
Definition: view.hpp:704
Val val(void) const
Return assigned value (only if assigned)
Definition: scale.hpp:85
ModEvent gq(Space &home, Val n)
Restrict domain values to be greater or equal than n.
Definition: scale.hpp:159
int scale(void) const
Return scale factor of scale view.
Definition: scale.hpp:62
bool in(Val n) const
Test whether n is contained in domain.
Definition: scale.hpp:132
bool range(void) const
Test whether domain is a range.
Definition: scale.hpp:127
void update(Space &home, ScaleView< Val, UnsVal > &y)
Update this view to be a clone of view y.
Definition: scale.hpp:228
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition: scale.hpp:216
ModEvent le(Space &home, Val n)
Restrict domain values to be less than n.
Definition: scale.hpp:152
UnsVal regret_max(void) const
Return regret of domain maximum (distance to next smaller value)
Definition: scale.hpp:116
UnsVal width(void) const
Return width of domain (distance between maximum and minimum)
Definition: scale.hpp:104
Val max(void) const
Return maximum of domain.
Definition: scale.hpp:73
int a
Scale factor.
Definition: view.hpp:708
Val med(void) const
Return median of domain (greatest element not greater than the median)
Definition: scale.hpp:79
ModEvent gr(Space &home, Val n)
Restrict domain values to be greater than n.
Definition: scale.hpp:165
bool operator<(const ScaleView< Val, UnsVal > &y) const
Whether this view comes before view y (arbitray order)
Definition: scale.hpp:240
Val min(void) const
Return minimum of domain.
Definition: scale.hpp:67
ModEvent eq(Space &home, Val n)
Restrict domain values to be equal to n.
Definition: scale.hpp:178
ModEvent nq(Space &home, Val n)
Restrict domain values to be different from n.
Definition: scale.hpp:172
UnsVal regret_min(void) const
Return regret of domain minimum (distance to next larger value)
Definition: scale.hpp:110
ModEvent lq(Space &home, Val n)
Restrict domain values to be less or equal than n.
Definition: scale.hpp:145
UnsVal size(void) const
Return size (cardinality) of domain.
Definition: scale.hpp:98
ScaleView(void)
Default constructor.
Definition: scale.hpp:48
Range iterator for cached integer views
Definition: view.hpp:1354
void init(const CachedView< View > &x)
Initialize with ranges for view x.
Definition: cached.hpp:389
ViewRanges< View > dr
Current domain iterator.
Definition: view.hpp:1361
Iter::Ranges::RangeList cr
Cached domain iterator.
Definition: view.hpp:1359
ViewDiffRanges(void)
Default constructor.
Definition: cached.hpp:378
Range iterator for integer views.
Definition: view.hpp:54
ViewRanges(const View &x)
Initialize with ranges for view x.
int max(void) const
Return largest value of range.
bool operator()(void) const
Test whether iterator is still at a range or done.
int min(void) const
Return smallest value of range.
void init(const View &x)
Initialize with ranges for view x.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
void operator++(void)
Move iterator to next range (if possible)
ViewRanges(void)
Default constructor.
Value iterator for integer views.
Definition: view.hpp:94
void init(const View &x)
Initialize with values x.
Definition: iter.hpp:53
ViewValues(void)
Default constructor.
Definition: iter.hpp:42
Zero integer view.
Definition: view.hpp:1014
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: zero.hpp:123
ZeroIntView(void)
Default constructor.
Definition: zero.hpp:41
int med(void) const
Return median of domain (greatest element not greater than the median)
Definition: zero.hpp:56
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value)
Definition: zero.hpp:73
ModEvent minus_r(Space &home, I &i, bool depends=true)
Remove from domain the ranges described by i.
Definition: zero.hpp:178
ModEvent inter_v(Space &home, I &i, bool depends=true)
Intersect domain with values described by i.
Definition: zero.hpp:190
int max(void) const
Return maximum of domain.
Definition: zero.hpp:52
ModEvent narrow_r(Space &home, I &i, bool depends=true)
Replace domain by ranges described by i.
Definition: zero.hpp:166
ModEvent minus_v(Space &home, I &i, bool depends=true)
Remove from domain the values described by i.
Definition: zero.hpp:197
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition: zero.hpp:220
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value)
Definition: zero.hpp:77
bool range(void) const
Test whether domain is a range.
Definition: zero.hpp:87
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: zero.hpp:105
ModEvent inter_r(Space &home, I &i, bool depends=true)
Intersect domain with ranges described by i.
Definition: zero.hpp:171
ModEvent narrow_v(Space &home, I &i, bool depends=true)
Replace domain by values described by i.
Definition: zero.hpp:185
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition: zero.hpp:132
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition: zero.hpp:114
int val(void) const
Return assigned value (only if assigned)
Definition: zero.hpp:60
unsigned int size(void) const
Return size (cardinality) of domain.
Definition: zero.hpp:65
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: zero.hpp:150
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition: zero.hpp:141
unsigned int width(void) const
Return width of domain (distance between maximum and minimum)
Definition: zero.hpp:69
bool in(int n) const
Test whether n is contained in domain.
Definition: zero.hpp:91
int min(void) const
Return minimum of domain.
Definition: zero.hpp:48
Range iterator for computing set difference.
Definition: ranges-diff.hpp:43
Range iterator for range lists
Value iterator from range iterator.
Lists of ranges (intervals)
Definition: range-list.hpp:49
Computation spaces.
Definition: core.hpp:1742
Base-class for variable implementation views.
Definition: view.hpp:133
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
Definition: view.hpp:552
int ModEvent
Type for modification events.
Definition: core.hpp:62
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:767
ScaleView< long long int, unsigned long long int > LLongScaleView
Long long-precision integer scale view.
Definition: view.hpp:810
ScaleView< int, unsigned int > IntScaleView
Integer-precision integer scale view.
Definition: view.hpp:804
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
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
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
RelTest rtest_eq_bnd(VX x, VY y)
Test whether views x and y are equal (use bounds information)
Definition: rel-test.hpp:43
RelTest rtest_lq(VX x, VY y)
Test whether view x is less or equal than view y.
Definition: rel-test.hpp:164
RelTest rtest_le(VX x, VY y)
Test whether view x is less than view y.
Definition: rel-test.hpp:180
bool operator==(const CachedView< View > &x, const CachedView< View > &y)
Definition: cached.hpp:401
BoolTest bool_test(const BoolView &b0, const BoolView &b1)
Definition: bool-test.hpp:41
unsigned int BoolStatus
Type for status of a Boolean variable.
Definition: var-imp.hpp:484
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const IdxViewArray< View > &x)
Definition: idx-view.hpp:167
bool operator!=(const CachedView< View > &x, const CachedView< View > &y)
Definition: cached.hpp:406
RelTest
Result of testing relation.
Definition: view.hpp:1734
@ RT_TRUE
Relation does hold.
Definition: view.hpp:1737
@ RT_MAYBE
Relation may hold or not.
Definition: view.hpp:1736
@ RT_FALSE
Relation does not hold.
Definition: view.hpp:1735
RelTest rtest_nq_bnd(VX x, VY y)
Test whether views x and y are different (use bounds information)
Definition: rel-test.hpp:104
BoolTest
Boolean tests.
Definition: view.hpp:1784
@ BT_NONE
No sharing.
Definition: view.hpp:1785
@ BT_COMP
Same variable but complement.
Definition: view.hpp:1787
@ BT_SAME
Same variable.
Definition: view.hpp:1786
RelTest rtest_gr(VX x, VY y)
Test whether view x is greater than view y.
Definition: rel-test.hpp:212
RelTest rtest_gq(VX x, VY y)
Test whether view x is greater or equal than view y.
Definition: rel-test.hpp:196
Gecode::FloatVal c(-8, 8)
Gecode::IntArgs i({1, 2, 3, 4})
Gecode::IntSet d(v, 7)
#define forceinline
Definition: config.hpp:185