Generated on for Gecode by doxygen 1.17.0
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.dev>
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.dev
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
40namespace Gecode { namespace Int {
41
53 template<class View>
54 class ViewRanges {
55 public:
57
58
61 ViewRanges(const View& x);
63 void init(const View& x);
65
67
68
69 bool operator ()(void) const;
71 void operator ++(void);
73
75
76
77 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
99 ViewValues(void);
101 ViewValues(const View& x);
103 void init(const View& x);
105 };
106
107}}
108
110
111namespace Gecode { namespace Int {
112
124
129 class IntView : public VarImpView<IntVar> {
130 protected:
131 using VarImpView<IntVar>::x;
132 public:
134
135
136 IntView(void);
138 IntView(const IntVar& y);
140 IntView(IntVarImp* y);
142
144
145
146 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
171 bool range(void) const;
172
174 bool in(int n) const;
176 bool in(long long int n) const;
178
180
181
182 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
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
250 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
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:
284 using DerivedView<IntView>::x;
285 public:
287
288
289 MinusView(void);
291 explicit MinusView(const IntView& y);
293
295
296
297 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
322 bool range(void) const;
323
325 bool in(int n) const;
327 bool in(long long int n) const;
329
331
332
333 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
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
403
405
406
407 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
426
427
429 bool operator ==(const MinusView& x, const MinusView& y);
432 bool operator !=(const MinusView& x, const MinusView& y);
434
443 class OffsetView : public DerivedView<IntView> {
444 protected:
446 int c;
447 using DerivedView<IntView>::x;
448 public:
450
451
452 OffsetView(void);
454 OffsetView(const IntView& y, int c);
456
458
459
460 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
489 bool range(void) const;
490
492 bool in(int n) const;
494 bool in(long long int n) const;
496
498
499
500 ModEvent lq(Space& home, int n);
502 ModEvent lq(Space& home, long long int n);
503
505 ModEvent le(Space& home, int n);
507 ModEvent le(Space& home, long long int n);
508
510 ModEvent gq(Space& home, int n);
512 ModEvent gq(Space& home, long long int n);
513
515 ModEvent gr(Space& home, int n);
517 ModEvent gr(Space& home, long long int n);
518
520 ModEvent nq(Space& home, int n);
522 ModEvent nq(Space& home, long long int n);
523
525 ModEvent eq(Space& home, int n);
527 ModEvent eq(Space& home, long long int n);
529
545
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
570
572
573
574 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
586 void update(Space& home, OffsetView& y);
588
590
591
592 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
605
606
608 bool operator ==(const OffsetView& x, const OffsetView& y);
611 bool operator !=(const OffsetView& x, const OffsetView& y);
613
617 template<class View>
618 class NoOffset {
619 public:
621 typedef View ViewType;
623 View& operator ()(View& x);
625 void update(const NoOffset&);
627 int offset(void) const;
628 };
629
630 template<class View>
631 forceinline View&
633 return x;
634 }
635
636 template<class View>
637 forceinline void
639
640 template<class View>
641 forceinline int
643 return 0;
644 }
645
646
650 class Offset {
651 public:
655 int c;
657 Offset(int off = 0);
661 void update(const Offset& o);
663 int offset(void) const;
664 };
665
666 forceinline
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
675 forceinline OffsetView
677 return OffsetView(x,c);
678 }
679
703 template<class Val, class UnsVal>
704 class ScaleView : public DerivedView<IntView> {
705 protected:
706 using DerivedView<IntView>::x;
708 int a;
709 public:
711
712
715 ScaleView(int b, const IntView& y);
717
719
720
721 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
748 bool range(void) const;
750 bool in(Val n) const;
752
754
755
756 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
774
776
777
778 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
792
794
795
796 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
829
830
832 template<class Val, class UnsVal>
834 const ScaleView<Val,UnsVal>& y);
837 template<class Val, class UnsVal>
839 const ScaleView<Val,UnsVal>& y);
841
842
843
851 class ConstIntView : public ConstView<IntView> {
852 protected:
853 int x;
854 public:
856
857
858 ConstIntView(void);
860 ConstIntView(int n);
862
864
865
866 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
887 bool range(void) const;
889 bool in(int n) const;
891 bool in(long long int n) const;
893
895
896
897 ModEvent lq(Space& home, int n);
899 ModEvent lq(Space& home, long long int n);
900
902 ModEvent le(Space& home, int n);
904 ModEvent le(Space& home, long long int n);
905
907 ModEvent gq(Space& home, int n);
909 ModEvent gq(Space& home, long long int n);
910
912 ModEvent gr(Space& home, int n);
914 ModEvent gr(Space& home, long long int n);
915
917 ModEvent nq(Space& home, int n);
919 ModEvent nq(Space& home, long long int n);
920
922 ModEvent eq(Space& home, int n);
924 ModEvent eq(Space& home, long long int n);
926
942
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
965 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
977 void update(Space& home, ConstIntView& y);
979
981
982
983 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
996
997
999 bool operator ==(const ConstIntView& x, const ConstIntView& y);
1002 bool operator !=(const ConstIntView& x, const ConstIntView& y);
1004
1005
1013 class ZeroIntView : public ConstView<IntView> {
1014 public:
1016
1017
1018 ZeroIntView(void);
1020
1022
1023
1024 int min(void) const;
1026 int max(void) const;
1028 int med(void) const;
1030 int val(void) const;
1031
1033 unsigned int size(void) const;
1035 unsigned int width(void) const;
1037 unsigned int regret_min(void) const;
1039 unsigned int regret_max(void) const;
1041
1043
1044
1045 bool range(void) const;
1047 bool in(int n) const;
1049 bool in(long long int n) const;
1051
1053
1054
1055 ModEvent lq(Space& home, int n);
1057 ModEvent lq(Space& home, long long int n);
1058
1060 ModEvent le(Space& home, int n);
1062 ModEvent le(Space& home, long long int n);
1063
1065 ModEvent gq(Space& home, int n);
1067 ModEvent gq(Space& home, long long int n);
1068
1070 ModEvent gr(Space& home, int n);
1072 ModEvent gr(Space& home, long long int n);
1073
1075 ModEvent nq(Space& home, int n);
1077 ModEvent nq(Space& home, long long int n);
1078
1080 ModEvent eq(Space& home, int n);
1082 ModEvent eq(Space& home, long long int n);
1084
1100
1101 template<class I>
1102 ModEvent narrow_r(Space& home, I& i, bool depends=true);
1104 template<class I>
1105 ModEvent inter_r(Space& home, I& i, bool depends=true);
1107 template<class I>
1108 ModEvent minus_r(Space& home, I& i, bool depends=true);
1110 template<class I>
1111 ModEvent narrow_v(Space& home, I& i, bool depends=true);
1113 template<class I>
1114 ModEvent inter_v(Space& home, I& i, bool depends=true);
1116 template<class I>
1117 ModEvent minus_v(Space& home, I& i, bool depends=true);
1119
1121
1122
1123 int min(const Delta& d) const;
1125 int max(const Delta& d) const;
1127 unsigned int width(const Delta& d) const;
1129 bool any(const Delta& d) const;
1131 };
1132
1137 template<class Char, class Traits>
1138 std::basic_ostream<Char,Traits>&
1139 operator <<(std::basic_ostream<Char,Traits>& os, const ZeroIntView& x);
1140
1142
1143
1145 bool operator ==(const ZeroIntView& x, const ZeroIntView& y);
1148 bool operator !=(const ZeroIntView& x, const ZeroIntView& y);
1150
1151 template<class View> class ViewDiffRanges;
1152
1163 template<class View>
1164 class CachedView : public DerivedView<View> {
1165 friend class ViewDiffRanges<View>;
1166 protected:
1167 using DerivedView<View>::x;
1173 unsigned int _size;
1174 public:
1176
1177
1178 CachedView(void);
1180 explicit CachedView(const View& y);
1182
1184
1185
1186 int min(void) const;
1188 int max(void) const;
1190 int med(void) const;
1192 int val(void) const;
1193#ifdef GECODE_HAS_CBS
1195 int baseval(int val) const;
1196#endif
1197
1199 unsigned int size(void) const;
1201 unsigned int width(void) const;
1203 unsigned int regret_min(void) const;
1205 unsigned int regret_max(void) const;
1207
1209
1210
1211 bool range(void) const;
1212
1214 bool in(int n) const;
1216 bool in(long long int n) const;
1218
1220
1221
1222 ModEvent lq(Space& home, int n);
1224 ModEvent lq(Space& home, long long int n);
1225
1227 ModEvent le(Space& home, int n);
1229 ModEvent le(Space& home, long long int n);
1230
1232 ModEvent gq(Space& home, int n);
1234 ModEvent gq(Space& home, long long int n);
1235
1237 ModEvent gr(Space& home, int n);
1239 ModEvent gr(Space& home, long long int n);
1240
1242 ModEvent nq(Space& home, int n);
1244 ModEvent nq(Space& home, long long int n);
1245
1247 ModEvent eq(Space& home, int n);
1249 ModEvent eq(Space& home, long long int n);
1251
1267
1268 template<class I>
1269 ModEvent narrow_r(Space& home, I& i, bool depends=true);
1271 template<class I>
1272 ModEvent inter_r(Space& home, I& i, bool depends=true);
1274 template<class I>
1275 ModEvent minus_r(Space& home, I& i, bool depends=true);
1277 template<class I>
1278 ModEvent narrow_v(Space& home, I& i, bool depends=true);
1280 template<class I>
1281 ModEvent inter_v(Space& home, I& i, bool depends=true);
1283 template<class I>
1284 ModEvent minus_v(Space& home, I& i, bool depends=true);
1286
1288
1289
1290 static ModEventDelta med(ModEvent me);
1292
1294
1295
1296 int min(const Delta& d) const;
1298 int max(const Delta& d) const;
1300 unsigned int width(const Delta& d) const;
1302 bool any(const Delta& d) const;
1304
1306
1307
1308 void initCache(Space& home, const IntSet& s);
1310 void cache(Space& home);
1312 bool modified(void) const;
1314
1316
1317
1318 void update(Space& home, CachedView<View>& y);
1320 };
1321
1326 template<class Char, class Traits, class View>
1327 std::basic_ostream<Char,Traits>&
1328 operator <<(std::basic_ostream<Char,Traits>& os, const CachedView<View>& x);
1329
1331
1332
1334 template<class View>
1335 bool operator ==(const CachedView<View>& x, const CachedView<View>& y);
1338 template<class View>
1339 bool operator !=(const CachedView<View>& x, const CachedView<View>& y);
1341
1350 template<class View>
1352 : public Iter::Ranges::Diff<Iter::Ranges::RangeList,ViewRanges<View> > {
1354 Super;
1355 protected:
1360 public:
1362
1363
1364 ViewDiffRanges(void);
1368 void init(const CachedView<View>& x);
1370 };
1371
1378 class BoolView : public VarImpView<BoolVar> {
1379 protected:
1380 using VarImpView<BoolVar>::x;
1381 public:
1383
1384
1385 BoolView(void);
1387 BoolView(const BoolVar& y);
1389 BoolView(BoolVarImp* y);
1391
1393
1394
1395 static const int BITS = BoolVarImp::BITS;
1403 BoolStatus status(void) const;
1405
1407
1408
1409 int min(void) const;
1411 int max(void) const;
1413 int med(void) const;
1415 int val(void) const;
1416#ifdef GECODE_HAS_CBS
1418 int baseval(int val) const;
1419#endif
1420
1422 unsigned int size(void) const;
1424 unsigned int width(void) const;
1426 unsigned int regret_min(void) const;
1428 unsigned int regret_max(void) const;
1430
1432
1433
1434 bool range(void) const;
1436 bool in(int n) const;
1438 bool in(long long int n) const;
1440
1442
1443
1444 bool zero(void) const;
1446 bool one(void) const;
1448 bool none(void) const;
1450
1452
1453
1454 ModEvent one(Space& home);
1456 ModEvent zero(Space& home);
1458 ModEvent one_none(Space& home);
1460 ModEvent zero_none(Space& home);
1462
1464
1465
1466 ModEvent lq(Space& home, int n);
1468 ModEvent lq(Space& home, long long int n);
1469
1471 ModEvent le(Space& home, int n);
1473 ModEvent le(Space& home, long long int n);
1474
1476 ModEvent gq(Space& home, int n);
1478 ModEvent gq(Space& home, long long int n);
1479
1481 ModEvent gr(Space& home, int n);
1483 ModEvent gr(Space& home, long long int n);
1484
1486 ModEvent nq(Space& home, int n);
1488 ModEvent nq(Space& home, long long int n);
1489
1491 ModEvent eq(Space& home, int n);
1493 ModEvent eq(Space& home, long long int n);
1495
1511
1512 template<class I>
1513 ModEvent narrow_r(Space& home, I& i, bool depends=true);
1515 template<class I>
1516 ModEvent inter_r(Space& home, I& i, bool depends=true);
1518 template<class I>
1519 ModEvent minus_r(Space& home, I& i, bool depends=true);
1521 template<class I>
1522 ModEvent narrow_v(Space& home, I& i, bool depends=true);
1524 template<class I>
1525 ModEvent inter_v(Space& home, I& i, bool depends=true);
1527 template<class I>
1528 ModEvent minus_v(Space& home, I& i, bool depends=true);
1530
1532
1533
1534 int min(const Delta& d) const;
1536 int max(const Delta& d) const;
1538 unsigned int width(const Delta& d) const;
1540 bool any(const Delta& d) const;
1542 static bool zero(const Delta& d);
1544 static bool one(const Delta& d);
1546
1548
1549
1550 static ModEventDelta med(ModEvent me);
1552 };
1553
1558 template<class Char, class Traits>
1559 std::basic_ostream<Char,Traits>&
1560 operator <<(std::basic_ostream<Char,Traits>& os, const BoolView& x);
1561
1562
1563
1572 class NegBoolView : public DerivedView<BoolView> {
1573 protected:
1574 using DerivedView<BoolView>::x;
1575 public:
1577
1578
1579 NegBoolView(void);
1581 explicit NegBoolView(const BoolView& y);
1583
1585
1586
1587 static const int BITS = BoolView::BITS;
1595 BoolStatus status(void) const;
1597
1599
1600
1601 bool zero(void) const;
1603 bool one(void) const;
1605 bool none(void) const;
1607
1609
1610
1611 ModEvent one(Space& home);
1613 ModEvent zero(Space& home);
1615 ModEvent one_none(Space& home);
1617 ModEvent zero_none(Space& home);
1619
1621
1622
1623 ModEvent lq(Space& home, int n);
1625 ModEvent lq(Space& home, long long int n);
1626
1628 ModEvent le(Space& home, int n);
1630 ModEvent le(Space& home, long long int n);
1631
1633 ModEvent gq(Space& home, int n);
1635 ModEvent gq(Space& home, long long int n);
1636
1638 ModEvent gr(Space& home, int n);
1640 ModEvent gr(Space& home, long long int n);
1641
1643 ModEvent nq(Space& home, int n);
1645 ModEvent nq(Space& home, long long int n);
1646
1648 ModEvent eq(Space& home, int n);
1650 ModEvent eq(Space& home, long long int n);
1652
1654
1655
1656 int min(void) const;
1658 int max(void) const;
1660 int val(void) const;
1661#ifdef GECODE_HAS_CBS
1663 int baseval(int val) const;
1664#endif
1666
1668
1669
1670 int min(const Delta& d) const;
1672 int max(const Delta& d) const;
1674 unsigned int width(const Delta& d) const;
1676 bool any(const Delta& d) const;
1678 static bool zero(const Delta& d);
1680 static bool one(const Delta& d);
1682 };
1683
1685
1686
1688 bool operator ==(const NegBoolView& x, const NegBoolView& y);
1691 bool operator !=(const NegBoolView& x, const NegBoolView& y);
1693
1698 template<class Char, class Traits>
1699 std::basic_ostream<Char,Traits>&
1700 operator <<(std::basic_ostream<Char,Traits>& os, const NegBoolView& x);
1701
1702}}
1703
1704#include <gecode/int/var/int.hpp>
1705#include <gecode/int/var/bool.hpp>
1706
1707#include <gecode/int/view/int.hpp>
1708
1710#include <gecode/int/view/zero.hpp>
1715
1716#include <gecode/int/view/bool.hpp>
1717
1719
1721#include <gecode/int/var/print.hpp>
1722
1723namespace Gecode { namespace Int {
1724
1729
1731
1732 enum RelTest {
1736 };
1737
1739 template<class VX, class VY> RelTest rtest_eq_bnd(VX x, VY y);
1741 template<class VX, class VY> RelTest rtest_eq_dom(VX x, VY y);
1743 template<class VX> RelTest rtest_eq_bnd(VX x, int n);
1745 template<class VX> RelTest rtest_eq_dom(VX x, int n);
1746
1748 template<class VX, class VY> RelTest rtest_nq_bnd(VX x, VY y);
1750 template<class VX, class VY> RelTest rtest_nq_dom(VX x, VY y);
1752 template<class VX> RelTest rtest_nq_bnd(VX x, int n);
1754 template<class VX> RelTest rtest_nq_dom(VX x, int n);
1755
1757 template<class VX, class VY> RelTest rtest_lq(VX x, VY y);
1759 template<class VX> RelTest rtest_lq(VX x, int n);
1760
1762 template<class VX, class VY> RelTest rtest_le(VX x, VY y);
1764 template<class VX> RelTest rtest_le(VX x, int n);
1765
1767 template<class VX, class VY> RelTest rtest_gq(VX x, VY y);
1769 template<class VX> RelTest rtest_gq(VX x, int n);
1770
1772 template<class VX, class VY> RelTest rtest_gr(VX x, VY y);
1774 template<class VX> RelTest rtest_gr(VX x, int n);
1776
1777
1787
1793
1794 BoolTest bool_test(const BoolView& b0, const BoolView& b1);
1796 BoolTest bool_test(const BoolView& b0, const NegBoolView& b1);
1798 BoolTest bool_test(const NegBoolView& b0, const BoolView& b1);
1800 BoolTest bool_test(const NegBoolView& b0, const NegBoolView& b1);
1802
1803}}
1804
1807
1808// STATISTICS: int-var
Boolean integer variables.
Definition int.hh:533
Base-class for constant views.
Definition view.hpp:45
Generic domain change information to be supplied to advisors.
Definition core.hpp:209
static ModEvent me(const ModEventDelta &med)
Definition view.hpp:639
Integer sets.
Definition int.hh:178
Integer variables.
Definition int.hh:389
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:1378
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:1401
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:1399
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:1395
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:1397
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:1164
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:1169
RangeList * _lastRange
Last cached range.
Definition view.hpp:1171
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:1173
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
void update(Space &home, CachedView< View > &y)
Update this view to be a clone of view y.
Definition cached.hpp:281
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
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 (arbitrary 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:1572
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:1591
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:1593
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:1587
static const BoolStatus ZERO
Status of domain assigned to zero.
Definition view.hpp:1589
Converter without offsets.
Definition view.hpp:618
View ViewType
The view type.
Definition view.hpp:621
void update(const NoOffset &)
Update during cloning.
Definition view.hpp:638
int offset(void) const
Access offset.
Definition view.hpp:642
View & operator()(View &x)
Pass through x.
Definition view.hpp:632
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 (arbitrary 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
int c
The offset.
Definition view.hpp:655
Offset(int off=0)
Constructor with offset off.
Definition view.hpp:667
OffsetView ViewType
The view type.
Definition view.hpp:653
void update(const Offset &o)
Update during cloning.
Definition view.hpp:670
OffsetView operator()(IntView &x)
Return OffsetRefView for x.
Definition view.hpp:676
int offset(void) const
Access offset.
Definition view.hpp:673
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
Val min(const Delta &d) const
Return minimum value just pruned.
Definition scale.hpp:201
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 width(const Delta &d) const
Return width of values just pruned.
Definition scale.hpp:211
static ModEventDelta med(ModEvent me)
Translate modification event me to modification event delta for view.
Definition scale.hpp:189
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
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 (arbitrary 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
ScaleView(int b, const IntView &y)
Initialize as .
Definition scale.hpp:52
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
Val max(const Delta &d) const
Return maximum value just pruned.
Definition scale.hpp:206
ScaleView(void)
Default constructor.
Definition scale.hpp:48
Range iterator for cached integer views
Definition view.hpp:1352
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:1359
Iter::Ranges::RangeList cr
Cached domain iterator.
Definition view.hpp:1357
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.
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:1013
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.
Range iterator for range lists
Value iterator from range iterator.
Lists of ranges (intervals).
Computation spaces.
Definition core.hpp:1775
static ModEvent me(const ModEventDelta &med)
Definition view.hpp:552
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:94
Finite domain integers.
Definition lastval.hh:52
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
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: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
bool operator!=(const CachedView< View > &x, const CachedView< View > &y)
Definition cached.hpp:406
RelTest
Result of testing relation.
Definition view.hpp:1732
@ RT_TRUE
Relation does hold.
Definition view.hpp:1735
@ RT_MAYBE
Relation may hold or not.
Definition view.hpp:1734
@ RT_FALSE
Relation does not hold.
Definition view.hpp:1733
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:1782
@ BT_NONE
No sharing.
Definition view.hpp:1783
@ BT_COMP
Same variable but complement.
Definition view.hpp:1785
@ BT_SAME
Same variable.
Definition view.hpp:1784
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 toplevel namespace
int ModEvent
Type for modification events.
Definition core.hpp:67