Generated on Thu Apr 5 2018 19:44:19 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  * Copyright:
7  * Christian Schulte, 2005
8  *
9  * Last modified:
10  * $Date$ by $Author$
11  * $Revision$
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 
155  unsigned int size(void) const;
157  unsigned int width(void) const;
159  unsigned int regret_min(void) const;
161  unsigned int regret_max(void) const;
163 
165 
166  bool range(void) const;
168 
170  bool in(int n) const;
172  bool in(long long int n) const;
174 
176 
177  ModEvent lq(Space& home, int n);
180  ModEvent lq(Space& home, long long int n);
181 
183  ModEvent le(Space& home, int n);
185  ModEvent le(Space& home, long long int n);
186 
188  ModEvent gq(Space& home, int n);
190  ModEvent gq(Space& home, long long int n);
191 
193  ModEvent gr(Space& home, int n);
195  ModEvent gr(Space& home, long long int n);
196 
198  ModEvent nq(Space& home, int n);
200  ModEvent nq(Space& home, long long int n);
201 
203  ModEvent eq(Space& home, int n);
205  ModEvent eq(Space& home, long long int n);
207 
223  template<class I>
225  ModEvent narrow_r(Space& home, I& i, bool depends=true);
227  template<class I>
228  ModEvent inter_r(Space& home, I& i, bool depends=true);
230  template<class I>
231  ModEvent minus_r(Space& home, I& i, bool depends=true);
233  template<class I>
234  ModEvent narrow_v(Space& home, I& i, bool depends=true);
236  template<class I>
237  ModEvent inter_v(Space& home, I& i, bool depends=true);
239  template<class I>
240  ModEvent minus_v(Space& home, I& i, bool depends=true);
242 
244 
245  int min(const Delta& d) const;
248  int max(const Delta& d) const;
250  unsigned int width(const Delta& d) const;
252  bool any(const Delta& d) const;
254 
256 
257  static ModEventDelta med(ModEvent me);
260  };
261 
266  template<class Char, class Traits>
267  std::basic_ostream<Char,Traits>&
268  operator <<(std::basic_ostream<Char,Traits>& os, const IntView& x);
269 
270 
278  class MinusView : public DerivedView<IntView> {
279  protected:
281  public:
283 
284  MinusView(void);
287  explicit MinusView(const IntView& y);
289 
291 
292  int min(void) const;
295  int max(void) const;
297  int med(void) const;
299  int val(void) const;
300 
302  unsigned int size(void) const;
304  unsigned int width(void) const;
306  unsigned int regret_min(void) const;
308  unsigned int regret_max(void) const;
310 
312 
313  bool range(void) const;
315 
317  bool in(int n) const;
319  bool in(long long int n) const;
321 
323 
324  ModEvent lq(Space& home, int n);
327  ModEvent lq(Space& home, long long int n);
328 
330  ModEvent le(Space& home, int n);
332  ModEvent le(Space& home, long long int n);
333 
335  ModEvent gq(Space& home, int n);
337  ModEvent gq(Space& home, long long int n);
338 
340  ModEvent gr(Space& home, int n);
342  ModEvent gr(Space& home, long long int n);
343 
345  ModEvent nq(Space& home, int n);
347  ModEvent nq(Space& home, long long int n);
348 
350  ModEvent eq(Space& home, int n);
352  ModEvent eq(Space& home, long long int n);
354 
370  template<class I>
372  ModEvent narrow_r(Space& home, I& i, bool depends=true);
374  template<class I>
375  ModEvent inter_r(Space& home, I& i, bool depends=true);
377  template<class I>
378  ModEvent minus_r(Space& home, I& i, bool depends=true);
380  template<class I>
381  ModEvent narrow_v(Space& home, I& i, bool depends=true);
383  template<class I>
384  ModEvent inter_v(Space& home, I& i, bool depends=true);
386  template<class I>
387  ModEvent minus_v(Space& home, I& i, bool depends=true);
389 
391 
392  static ModEventDelta med(ModEvent me);
395 
397 
398  int min(const Delta& d) const;
401  int max(const Delta& d) const;
403  unsigned int width(const Delta& d) const;
405  bool any(const Delta& d) const;
407  };
408 
413  template<class Char, class Traits>
414  std::basic_ostream<Char,Traits>&
415  operator <<(std::basic_ostream<Char,Traits>& os, const MinusView& x);
416 
417 
426  class OffsetView : public DerivedView<IntView> {
427  protected:
429  int c;
431  public:
433 
434  OffsetView(void);
437  OffsetView(const IntView& y, int c);
439 
441 
442  int offset(void) const;
445  void offset(int n);
447  int min(void) const;
449  int max(void) const;
451  int med(void) const;
453  int val(void) const;
454 
456  unsigned int size(void) const;
458  unsigned int width(void) const;
460  unsigned int regret_min(void) const;
462  unsigned int regret_max(void) const;
464 
466 
467  bool range(void) const;
469 
471  bool in(int n) const;
473  bool in(long long int n) const;
475 
477 
478  ModEvent lq(Space& home, int n);
481  ModEvent lq(Space& home, long long int n);
482 
484  ModEvent le(Space& home, int n);
486  ModEvent le(Space& home, long long int n);
487 
489  ModEvent gq(Space& home, int n);
491  ModEvent gq(Space& home, long long int n);
492 
494  ModEvent gr(Space& home, int n);
496  ModEvent gr(Space& home, long long int n);
497 
499  ModEvent nq(Space& home, int n);
501  ModEvent nq(Space& home, long long int n);
502 
504  ModEvent eq(Space& home, int n);
506  ModEvent eq(Space& home, long long int n);
508 
524  template<class I>
526  ModEvent narrow_r(Space& home, I& i, bool depends=true);
528  template<class I>
529  ModEvent inter_r(Space& home, I& i, bool depends=true);
531  template<class I>
532  ModEvent minus_r(Space& home, I& i, bool depends=true);
534  template<class I>
535  ModEvent narrow_v(Space& home, I& i, bool depends=true);
537  template<class I>
538  ModEvent inter_v(Space& home, I& i, bool depends=true);
540  template<class I>
541  ModEvent minus_v(Space& home, I& i, bool depends=true);
543 
545 
546  static ModEventDelta med(ModEvent me);
549 
551 
552  int min(const Delta& d) const;
555  int max(const Delta& d) const;
557  unsigned int width(const Delta& d) const;
559  bool any(const Delta& d) const;
561 
563 
564  void update(Space& home, OffsetView& y);
567  };
568 
573  template<class Char, class Traits>
574  std::basic_ostream<Char,Traits>&
575  operator <<(std::basic_ostream<Char,Traits>& os, const OffsetView& x);
576 
581  bool same(const OffsetView& x, const OffsetView& y);
584  bool before(const OffsetView& x, const OffsetView& y);
586 
590  template<class View>
591  class NoOffset {
592  public:
594  typedef View ViewType;
596  View& operator ()(View& x);
598  void update(const NoOffset&);
600  int offset(void) const;
601  };
602 
603  template<class View>
604  forceinline View&
606  return x;
607  }
608 
609  template<class View>
610  forceinline void
612 
613  template<class View>
614  forceinline int
616  return 0;
617  }
618 
619 
623  class Offset {
624  public:
628  int c;
630  Offset(int off = 0);
634  void update(const Offset& o);
636  int offset(void) const;
637  };
638 
640  Offset::Offset(int off) : c(off) {}
641 
642  forceinline void
643  Offset::update(const Offset& o) { c = o.c; }
644 
645  forceinline int
646  Offset::offset(void) const { return c; }
647 
650  return OffsetView(x,c);
651  }
652 
676  template<class Val, class UnsVal>
677  class ScaleView : public DerivedView<IntView> {
678  protected:
681  int a;
682  public:
684 
685  ScaleView(void);
688  ScaleView(int b, const IntView& y);
690 
692 
693  int scale(void) const;
696  Val min(void) const;
698  Val max(void) const;
700  Val med(void) const;
702  Val val(void) const;
703 
705  UnsVal size(void) const;
707  UnsVal width(void) const;
709  UnsVal regret_min(void) const;
711  UnsVal regret_max(void) const;
713 
715 
716  bool range(void) const;
719  bool in(Val n) const;
721 
723 
724  ModEvent lq(Space& home, Val n);
727  ModEvent le(Space& home, Val n);
729  ModEvent gq(Space& home, Val n);
731  ModEvent gr(Space& home, Val n);
733  ModEvent nq(Space& home, Val n);
735  ModEvent eq(Space& home, Val n);
737 
739 
740  static ModEventDelta med(ModEvent me);
743 
745 
746  Val min(const Delta& d) const;
749  Val max(const Delta& d) const;
751  UnsVal width(const Delta& d) const;
753  bool any(const Delta& d) const;
755 
757 
758  void update(Space& home, ScaleView<Val,UnsVal>& y);
761  };
762 
768 
774 
779  template<class Char, class Traits>
780  std::basic_ostream<Char,Traits>&
781  operator <<(std::basic_ostream<Char,Traits>& os, const IntScaleView& x);
782 
787  template<class Char, class Traits>
788  std::basic_ostream<Char,Traits>&
789  operator <<(std::basic_ostream<Char,Traits>& os, const LLongScaleView& x);
790 
795  template<class Val, class UnsVal>
797  bool same(const ScaleView<Val,UnsVal>& x, const ScaleView<Val,UnsVal>& y);
799  template<class Val, class UnsVal>
802 
803 
804 
812  class ConstIntView : public ConstView<IntView> {
813  protected:
814  int x;
815  public:
817 
818  ConstIntView(void);
821  ConstIntView(int n);
823 
825 
826  int min(void) const;
829  int max(void) const;
831  int med(void) const;
833  int val(void) const;
834 
836  unsigned int size(void) const;
838  unsigned int width(void) const;
840  unsigned int regret_min(void) const;
842  unsigned int regret_max(void) const;
844 
846 
847  bool range(void) const;
850  bool in(int n) const;
852  bool in(long long int n) const;
854 
856 
857  ModEvent lq(Space& home, int n);
860  ModEvent lq(Space& home, long long int n);
861 
863  ModEvent le(Space& home, int n);
865  ModEvent le(Space& home, long long int n);
866 
868  ModEvent gq(Space& home, int n);
870  ModEvent gq(Space& home, long long int n);
871 
873  ModEvent gr(Space& home, int n);
875  ModEvent gr(Space& home, long long int n);
876 
878  ModEvent nq(Space& home, int n);
880  ModEvent nq(Space& home, long long int n);
881 
883  ModEvent eq(Space& home, int n);
885  ModEvent eq(Space& home, long long int n);
887 
903  template<class I>
905  ModEvent narrow_r(Space& home, I& i, bool depends=true);
907  template<class I>
908  ModEvent inter_r(Space& home, I& i, bool depends=true);
910  template<class I>
911  ModEvent minus_r(Space& home, I& i, bool depends=true);
913  template<class I>
914  ModEvent narrow_v(Space& home, I& i, bool depends=true);
916  template<class I>
917  ModEvent inter_v(Space& home, I& i, bool depends=true);
919  template<class I>
920  ModEvent minus_v(Space& home, I& i, bool depends=true);
922 
924 
925  int min(const Delta& d) const;
928  int max(const Delta& d) const;
930  unsigned int width(const Delta& d) const;
932  bool any(const Delta& d) const;
934 
936 
937  void update(Space& home, ConstIntView& y);
940  };
941 
946  template<class Char, class Traits>
947  std::basic_ostream<Char,Traits>&
948  operator <<(std::basic_ostream<Char,Traits>& os, const ConstIntView& x);
949 
955  bool same(const ConstIntView& x, const ConstIntView& y);
958  bool before(const ConstIntView& x, const ConstIntView& y);
960 
961 
969  class ZeroIntView : public ConstView<IntView> {
970  public:
972 
973  ZeroIntView(void);
976 
978 
979  int min(void) const;
982  int max(void) const;
984  int med(void) const;
986  int val(void) const;
987 
989  unsigned int size(void) const;
991  unsigned int width(void) const;
993  unsigned int regret_min(void) const;
995  unsigned int regret_max(void) const;
997 
999 
1000  bool range(void) const;
1003  bool in(int n) const;
1005  bool in(long long int n) const;
1007 
1009 
1010  ModEvent lq(Space& home, int n);
1013  ModEvent lq(Space& home, long long int n);
1014 
1016  ModEvent le(Space& home, int n);
1018  ModEvent le(Space& home, long long int n);
1019 
1021  ModEvent gq(Space& home, int n);
1023  ModEvent gq(Space& home, long long int n);
1024 
1026  ModEvent gr(Space& home, int n);
1028  ModEvent gr(Space& home, long long int n);
1029 
1031  ModEvent nq(Space& home, int n);
1033  ModEvent nq(Space& home, long long int n);
1034 
1036  ModEvent eq(Space& home, int n);
1038  ModEvent eq(Space& home, long long int n);
1040 
1056  template<class I>
1058  ModEvent narrow_r(Space& home, I& i, bool depends=true);
1060  template<class I>
1061  ModEvent inter_r(Space& home, I& i, bool depends=true);
1063  template<class I>
1064  ModEvent minus_r(Space& home, I& i, bool depends=true);
1066  template<class I>
1067  ModEvent narrow_v(Space& home, I& i, bool depends=true);
1069  template<class I>
1070  ModEvent inter_v(Space& home, I& i, bool depends=true);
1072  template<class I>
1073  ModEvent minus_v(Space& home, I& i, bool depends=true);
1075 
1077 
1078  int min(const Delta& d) const;
1081  int max(const Delta& d) const;
1083  unsigned int width(const Delta& d) const;
1085  bool any(const Delta& d) const;
1087  };
1088 
1093  template<class Char, class Traits>
1094  std::basic_ostream<Char,Traits>&
1095  operator <<(std::basic_ostream<Char,Traits>& os, const ZeroIntView& x);
1096 
1102  bool same(const ZeroIntView& x, const ZeroIntView& y);
1105 
1106  template<class View> class ViewDiffRanges;
1107 
1118  template<class View>
1119  class CachedView : public DerivedView<View> {
1120  friend class ViewDiffRanges<View>;
1121  protected:
1122  using DerivedView<View>::x;
1128  unsigned int _size;
1129  public:
1131 
1132  CachedView(void);
1135  explicit CachedView(const View& y);
1137 
1139 
1140  int min(void) const;
1143  int max(void) const;
1145  int med(void) const;
1147  int val(void) const;
1148 
1150  unsigned int size(void) const;
1152  unsigned int width(void) const;
1154  unsigned int regret_min(void) const;
1156  unsigned int regret_max(void) const;
1158 
1160 
1161  bool range(void) const;
1163 
1165  bool in(int n) const;
1167  bool in(long long int n) const;
1169 
1171 
1172  ModEvent lq(Space& home, int n);
1175  ModEvent lq(Space& home, long long int n);
1176 
1178  ModEvent le(Space& home, int n);
1180  ModEvent le(Space& home, long long int n);
1181 
1183  ModEvent gq(Space& home, int n);
1185  ModEvent gq(Space& home, long long int n);
1186 
1188  ModEvent gr(Space& home, int n);
1190  ModEvent gr(Space& home, long long int n);
1191 
1193  ModEvent nq(Space& home, int n);
1195  ModEvent nq(Space& home, long long int n);
1196 
1198  ModEvent eq(Space& home, int n);
1200  ModEvent eq(Space& home, long long int n);
1202 
1218  template<class I>
1220  ModEvent narrow_r(Space& home, I& i, bool depends=true);
1222  template<class I>
1223  ModEvent inter_r(Space& home, I& i, bool depends=true);
1225  template<class I>
1226  ModEvent minus_r(Space& home, I& i, bool depends=true);
1228  template<class I>
1229  ModEvent narrow_v(Space& home, I& i, bool depends=true);
1231  template<class I>
1232  ModEvent inter_v(Space& home, I& i, bool depends=true);
1234  template<class I>
1235  ModEvent minus_v(Space& home, I& i, bool depends=true);
1237 
1239 
1240  static ModEventDelta med(ModEvent me);
1243 
1245 
1246  int min(const Delta& d) const;
1249  int max(const Delta& d) const;
1251  unsigned int width(const Delta& d) const;
1253  bool any(const Delta& d) const;
1255 
1257 
1258  void initCache(Space& home, const IntSet& s);
1261  void cache(Space& home);
1263  bool modified(void) const;
1265 
1267 
1268  void update(Space& home, CachedView<View>& y);
1271  };
1272 
1277  template<class Char, class Traits, class View>
1278  std::basic_ostream<Char,Traits>&
1279  operator <<(std::basic_ostream<Char,Traits>& os, const CachedView<View>& x);
1280 
1285  template<class View>
1287  bool same(const CachedView<View>& x, const CachedView<View>& y);
1289  template<class View>
1290  bool before(const CachedView<View>& x, const CachedView<View>& y);
1292 
1301  template<class View>
1302  class ViewDiffRanges
1303  : public Iter::Ranges::Diff<Iter::Ranges::RangeList,ViewRanges<View> > {
1305  Super;
1306  protected:
1311  public:
1313 
1314  ViewDiffRanges(void);
1317  ViewDiffRanges(const CachedView<View>& x);
1319  void init(const CachedView<View>& x);
1321  };
1322 
1329  class BoolView : public VarImpView<BoolVar> {
1330  protected:
1331  using VarImpView<BoolVar>::x;
1332  public:
1334 
1335  BoolView(void);
1338  BoolView(const BoolVar& y);
1340  BoolView(BoolVarImp* y);
1342 
1344 
1345  static const int BITS = BoolVarImp::BITS;
1348  static const BoolStatus ZERO = BoolVarImp::ZERO;
1350  static const BoolStatus ONE = BoolVarImp::ONE;
1352  static const BoolStatus NONE = BoolVarImp::NONE;
1354  BoolStatus status(void) const;
1356 
1358 
1359  int min(void) const;
1362  int max(void) const;
1364  int med(void) const;
1366  int val(void) const;
1367 
1369  unsigned int size(void) const;
1371  unsigned int width(void) const;
1373  unsigned int regret_min(void) const;
1375  unsigned int regret_max(void) const;
1377 
1379 
1380  bool range(void) const;
1383  bool in(int n) const;
1385  bool in(long long int n) const;
1387 
1389 
1390  bool zero(void) const;
1393  bool one(void) const;
1395  bool none(void) const;
1397 
1399 
1400  ModEvent one(Space& home);
1403  ModEvent zero(Space& home);
1405  ModEvent one_none(Space& home);
1407  ModEvent zero_none(Space& home);
1409 
1411 
1412  ModEvent lq(Space& home, int n);
1415  ModEvent lq(Space& home, long long int n);
1416 
1418  ModEvent le(Space& home, int n);
1420  ModEvent le(Space& home, long long int n);
1421 
1423  ModEvent gq(Space& home, int n);
1425  ModEvent gq(Space& home, long long int n);
1426 
1428  ModEvent gr(Space& home, int n);
1430  ModEvent gr(Space& home, long long int n);
1431 
1433  ModEvent nq(Space& home, int n);
1435  ModEvent nq(Space& home, long long int n);
1436 
1438  ModEvent eq(Space& home, int n);
1440  ModEvent eq(Space& home, long long int n);
1442 
1458  template<class I>
1460  ModEvent narrow_r(Space& home, I& i, bool depends=true);
1462  template<class I>
1463  ModEvent inter_r(Space& home, I& i, bool depends=true);
1465  template<class I>
1466  ModEvent minus_r(Space& home, I& i, bool depends=true);
1468  template<class I>
1469  ModEvent narrow_v(Space& home, I& i, bool depends=true);
1471  template<class I>
1472  ModEvent inter_v(Space& home, I& i, bool depends=true);
1474  template<class I>
1475  ModEvent minus_v(Space& home, I& i, bool depends=true);
1477 
1479 
1480  int min(const Delta& d) const;
1483  int max(const Delta& d) const;
1485  unsigned int width(const Delta& d) const;
1487  bool any(const Delta& d) const;
1489  static bool zero(const Delta& d);
1491  static bool one(const Delta& d);
1493 
1495 
1496  static ModEventDelta med(ModEvent me);
1499  };
1500 
1505  template<class Char, class Traits>
1506  std::basic_ostream<Char,Traits>&
1507  operator <<(std::basic_ostream<Char,Traits>& os, const BoolView& x);
1508 
1509 
1510 
1519  class NegBoolView : public DerivedView<BoolView> {
1520  protected:
1522  public:
1524 
1525  NegBoolView(void);
1528  explicit NegBoolView(const BoolView& y);
1530 
1532 
1533  static const int BITS = BoolView::BITS;
1536  static const BoolStatus ZERO = BoolView::ONE;
1538  static const BoolStatus ONE = BoolView::ZERO;
1540  static const BoolStatus NONE = BoolView::NONE;
1542  BoolStatus status(void) const;
1544 
1546 
1547  bool zero(void) const;
1550  bool one(void) const;
1552  bool none(void) const;
1554 
1556 
1557  ModEvent one(Space& home);
1560  ModEvent zero(Space& home);
1562  ModEvent one_none(Space& home);
1564  ModEvent zero_none(Space& home);
1566 
1568 
1569  int min(void) const;
1572  int max(void) const;
1574  int val(void) const;
1576 
1578 
1579  int min(const Delta& d) const;
1582  int max(const Delta& d) const;
1584  unsigned int width(const Delta& d) const;
1586  bool any(const Delta& d) const;
1588  static bool zero(const Delta& d);
1590  static bool one(const Delta& d);
1592  };
1593 
1598  template<class Char, class Traits>
1599  std::basic_ostream<Char,Traits>&
1600  operator <<(std::basic_ostream<Char,Traits>& os, const NegBoolView& x);
1601 
1602 }}
1603 
1604 #include <gecode/int/var/int.hpp>
1605 #include <gecode/int/var/bool.hpp>
1606 
1607 #include <gecode/int/view/int.hpp>
1608 
1610 #include <gecode/int/view/zero.hpp>
1611 #include <gecode/int/view/minus.hpp>
1612 #include <gecode/int/view/offset.hpp>
1613 #include <gecode/int/view/scale.hpp>
1614 #include <gecode/int/view/cached.hpp>
1615 
1616 #include <gecode/int/view/bool.hpp>
1617 
1619 
1620 #include <gecode/int/view/print.hpp>
1621 #include <gecode/int/var/print.hpp>
1622 
1623 namespace Gecode { namespace Int {
1624 
1631  enum RelTest {
1633  RT_FALSE = 0,
1634  RT_MAYBE = 1,
1635  RT_TRUE = 2
1636  };
1637 
1639  template<class VX, class VY> RelTest rtest_eq_bnd(VX x, VY y);
1641  template<class VX, class VY> RelTest rtest_eq_dom(VX x, VY y);
1643  template<class VX> RelTest rtest_eq_bnd(VX x, int n);
1645  template<class VX> RelTest rtest_eq_dom(VX x, int n);
1646 
1648  template<class VX, class VY> RelTest rtest_nq_bnd(VX x, VY y);
1650  template<class VX, class VY> RelTest rtest_nq_dom(VX x, VY y);
1652  template<class VX> RelTest rtest_nq_bnd(VX x, int n);
1654  template<class VX> RelTest rtest_nq_dom(VX x, int n);
1655 
1657  template<class VX, class VY> RelTest rtest_lq(VX x, VY y);
1659  template<class VX> RelTest rtest_lq(VX x, int n);
1660 
1662  template<class VX, class VY> RelTest rtest_le(VX x, VY y);
1664  template<class VX> RelTest rtest_le(VX x, int n);
1665 
1667  template<class VX, class VY> RelTest rtest_gq(VX x, VY y);
1669  template<class VX> RelTest rtest_gq(VX x, int n);
1670 
1672  template<class VX, class VY> RelTest rtest_gr(VX x, VY y);
1674  template<class VX> RelTest rtest_gr(VX x, int n);
1676 
1677 
1682  enum BoolTest {
1686  };
1687 
1693  BoolTest bool_test(const BoolView& b0, const BoolView& b1);
1696  BoolTest bool_test(const BoolView& b0, const NegBoolView& b1);
1698  BoolTest bool_test(const NegBoolView& b0, const BoolView& b1);
1700  BoolTest bool_test(const NegBoolView& b0, const NegBoolView& b1);
1702 
1703 }}
1704 
1707 
1708 // STATISTICS: int-var
int offset(void) const
Access offset.
Definition: view.hpp:646
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Scale integer view (template)
Definition: view.hpp:677
Relation may hold or not.
Definition: view.hpp:1634
static const int BITS
How many bits does the status have.
Definition: view.hpp:1346
Offset(int off=0)
Constructor with offset off.
Definition: view.hpp:640
OffsetView ViewType
The view type.
Definition: view.hpp:626
Negated Boolean view.
Definition: view.hpp:1519
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
Definition: linear.cpp:50
RelTest rtest_eq_dom(VX x, VY y)
Test whether views x and y are equal (use full domain information)
Definition: rel-test.hpp:69
RangeList * _lastRange
Last cached range.
Definition: view.hpp:1126
Converter without offsets.
Definition: view.hpp:591
unsigned int BoolStatus
Type for status of a Boolean variable.
Definition: var-imp.hpp:488
RelTest rtest_gq(VX x, VY y)
Test whether view x is greater or equal than view y.
Definition: rel-test.hpp:200
int a
Scale factor.
Definition: view.hpp:681
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:53
bool any(const View &x)
Test whether x is neither positive nor negative.
Definition: mult.hpp:57
bool before(const CachedView< View > &x, const CachedView< View > &y)
Definition: cached.hpp:399
static const BoolStatus NONE
Status of domain not yet assigned.
Definition: var-imp.hpp:529
ViewRanges(void)
Default constructor.
Range iterator for range lists
int ModEvent
Type for modification events.
Definition: core.hpp:64
static const BoolStatus NONE
Status of domain not yet assigned.
Definition: view.hpp:1352
BoolTest
Boolean tests.
Definition: view.hpp:1682
Value iterator for integer views.
Definition: view.hpp:94
#define forceinline
Definition: config.hpp:182
RelTest rtest_le(VX x, VY y)
Test whether view x is less than view y.
Definition: rel-test.hpp:184
int offset(void) const
Access offset.
Definition: view.hpp:615
Base-class for constant views.
Definition: view.hpp:45
Computation spaces.
Definition: core.hpp:1668
void init(const View &x)
Initialize with ranges for view x.
Base-class for derived views.
Definition: view.hpp:222
Range iterator for integer views.
Definition: view.hpp:54
Boolean variable implementation.
Definition: var-imp.hpp:495
Gecode::IntSet d(v, 7)
static const BoolStatus ONE
Status of domain assigned to one.
Definition: var-imp.hpp:527
Same variable.
Definition: view.hpp:1684
RelTest rtest_lq(VX x, VY y)
Test whether view x is less or equal than view y.
Definition: rel-test.hpp:168
bool same(const CachedView< View > &x, const CachedView< View > &y)
Definition: cached.hpp:394
Gecode::FloatVal c(-8, 8)
View ViewType
The view type.
Definition: view.hpp:594
static const BoolStatus ZERO
Status of domain assigned to zero.
Definition: view.hpp:1348
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
Relation does not hold.
Definition: view.hpp:1633
RelTest
Result of testing relation.
Definition: view.hpp:1632
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:2030
Base-class for variable implementation views.
Definition: view.hpp:123
void update(const NoOffset &)
Update during cloning.
Definition: view.hpp:611
Integer sets.
Definition: int.hh:174
BoolTest bool_test(const BoolView &b0, const BoolView &b1)
Definition: bool-test.hpp:45
Offset integer view.
Definition: view.hpp:426
void update(const Offset &o)
Update during cloning.
Definition: view.hpp:643
OffsetView operator()(IntView &x)
Return OffsetRefView for x.
Definition: view.hpp:649
RelTest rtest_nq_dom(VX x, VY y)
Test whether views x and y are different (use full domain information)
Definition: rel-test.hpp:130
Same variable but complement.
Definition: view.hpp:1685
Converter with fixed offset.
Definition: view.hpp:623
RelTest rtest_eq_bnd(VX x, VY y)
Test whether views x and y are equal (use bounds information)
Definition: rel-test.hpp:47
Zero integer view.
Definition: view.hpp:969
Boolean integer variables.
Definition: int.hh:492
static const BoolStatus ZERO
Status of domain assigned to zero.
Definition: var-imp.hpp:525
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:71
Constant integer view.
Definition: view.hpp:812
int c
The offset.
Definition: view.hpp:628
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:769
Integer variable implementation.
Definition: var-imp.hpp:93
Generic domain change information to be supplied to advisors.
Definition: core.hpp:205
ScaleView< int, unsigned int > IntScaleView
Integer-precision integer scale view.
Definition: view.hpp:767
unsigned int _size
Size of cached domain.
Definition: view.hpp:1128
Minus integer view.
Definition: view.hpp:278
Integer variables.
Definition: int.hh:351
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:108
Cached integer view.
Definition: view.hpp:1119
View & operator()(View &x)
Pass through x.
Definition: view.hpp:605
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:769
No sharing.
Definition: view.hpp:1683
Lists of ranges (intervals)
Definition: range-list.hpp:53
static const BoolStatus ONE
Status of domain assigned to one.
Definition: view.hpp:1350
Gecode toplevel namespace
Range iterator for computing set difference.
Definition: ranges-diff.hpp:47
RelTest rtest_gr(VX x, VY y)
Test whether view x is greater than view y.
Definition: rel-test.hpp:216
ScaleView< long long int, unsigned long long int > LLongScaleView
Long long-precision integer scale view.
Definition: view.hpp:773
int ModEventDelta
Modification event deltas.
Definition: core.hpp:91
static const int BITS
How many bits does the status have.
Definition: var-imp.hpp:523
Relation does hold.
Definition: view.hpp:1635
void update(IntSet &y, Space &home, IntSet &py)
Definition: rel.hpp:107
Iter::Ranges::RangeList cr
Cached domain iterator.
Definition: view.hpp:1308
Range iterator for cached integer views
Definition: view.hpp:1106
RangeList * _firstRange
First cached range.
Definition: view.hpp:1124
ViewRanges< View > dr
Current domain iterator.
Definition: view.hpp:1310
Boolean view for Boolean variables.
Definition: view.hpp:1329