Generated on Wed Jul 21 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  * Guido Tack <tack@gecode.org>
5  *
6  * Contributing authors:
7  * Christian Schulte <schulte@gecode.org>
8  *
9  * Copyright:
10  * Guido Tack, 2004
11  * Christian Schulte, 2004
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 Set {
41 
56  class SetView : public VarImpView<SetVar> {
57  protected:
59  public:
61 
62  SetView(void);
65  SetView(const SetVar& y);
69 
71 
72 
74  unsigned int cardMin(void) const;
76  unsigned int cardMax(void) const;
78  int lubMin(void) const;
80  int lubMax(void) const;
82  int lubMinN(unsigned int n) const;
84  int glbMin(void) const;
86  int glbMax(void) const;
87 
89  unsigned int glbSize(void) const;
91  unsigned int lubSize(void) const;
93  unsigned int unknownSize(void) const;
95 
97 
98  bool contains(int i) const;
101  bool notContains(int i) const;
103 
104 
106 
107  ModEvent cardMin(Space& home, unsigned int m);
110  ModEvent cardMax(Space& home, unsigned int m);
115  ModEvent include(Space& home,int i,int j);
120  ModEvent exclude(Space& home,int i,int j);
122  ModEvent include(Space& home,int i);
124  ModEvent exclude(Space& home,int i);
129  ModEvent intersect(Space& home,int i,int j);
131  ModEvent intersect(Space& home,int i);
133 
135 
136 
138  template<class I> ModEvent excludeI(Space& home, I& i);
140  template<class I> ModEvent includeI(Space& home, I& i);
142  template<class I> ModEvent intersectI(Space& home, I& iter);
144 
146 
147  static ModEvent modevent(const Delta& d);
150  int glbMin(const Delta& d) const;
152  int glbMax(const Delta& d) const;
154  bool glbAny(const Delta& d) const;
156  int lubMin(const Delta& d) const;
158  int lubMax(const Delta& d) const;
160  bool lubAny(const Delta& d) const;
162  };
163 
168  template<class Char, class Traits>
169  std::basic_ostream<Char,Traits>&
170  operator <<(std::basic_ostream<Char,Traits>& os, const SetView& x);
171 
172 
173 
174  // Forward declarations for friends
175  class ConstSetView;
176  bool operator ==(const ConstSetView&, const ConstSetView&);
177  bool operator !=(const ConstSetView&, const ConstSetView&);
178 
186  class ConstSetView : public ConstView<SetView> {
187  friend class LubRanges<ConstSetView>;
188  friend class GlbRanges<ConstSetView>;
193  private:
194  int *ranges;
195  int size;
196  unsigned int domSize;
197  public:
199 
200  ConstSetView(void);
203  ConstSetView(Space& home, const IntSet& s);
205 
207 
208  unsigned int cardMin(void) const;
211  unsigned int cardMax(void) const;
213  int lubMin(void) const;
215  int lubMax(void) const;
217  int lubMinN(unsigned int n) const;
219  int glbMin(void) const;
221  int glbMax(void) const;
222 
224  unsigned int glbSize(void) const;
226  unsigned int lubSize(void) const;
228  unsigned int unknownSize(void) const;
230 
232 
233  bool contains(int i) const;
236  bool notContains(int i) const;
238 
239 
241 
242  ModEvent cardMin(Space& home, unsigned int m);
245  ModEvent cardMax(Space& home, unsigned int m);
250  ModEvent include(Space& home,int i,int j);
255  ModEvent exclude(Space& home,int i,int j);
257  ModEvent include(Space& home,int i);
259  ModEvent exclude(Space& home,int i);
264  ModEvent intersect(Space& home,int i,int j);
266  ModEvent intersect(Space& home,int i);
268 
270 
271 
273  template<class I> ModEvent excludeI(Space& home, I& i);
275  template<class I> ModEvent includeI(Space& home, I& i);
277  template<class I> ModEvent intersectI(Space& home, I& iter);
279 
281 
282  void update(Space& home, ConstSetView& y);
285 
287 
288  int glbMin(const Delta& d) const;
291  int glbMax(const Delta& d) const;
293  bool glbAny(const Delta& d) const;
295  int lubMin(const Delta& d) const;
297  int lubMax(const Delta& d) const;
299  bool lubAny(const Delta& d) const;
301 
303 
304  bool operator <(const ConstSetView& y) const;
307  };
308 
313  template<class Char, class Traits>
314  std::basic_ostream<Char,Traits>&
315  operator <<(std::basic_ostream<Char,Traits>& os, const ConstSetView& x);
316 
322  bool operator ==(const ConstSetView& x, const ConstSetView& y);
324  bool operator !=(const ConstSetView& x, const ConstSetView& y);
326 
327 
336  class EmptyView : public ConstView<SetView> {
337  public:
339 
340  EmptyView(void);
343 
345 
346  unsigned int cardMin(void) const;
349  unsigned int cardMax(void) const;
351  int lubMin(void) const;
353  int lubMax(void) const;
355  int lubMinN(unsigned int n) const;
357  int glbMin(void) const;
359  int glbMax(void) const;
360 
362  unsigned int glbSize(void) const;
364  unsigned int lubSize(void) const;
366  unsigned int unknownSize(void) const;
368 
370 
371  bool contains(int i) const;
374  bool notContains(int i) const;
376 
377 
379 
380  ModEvent cardMin(Space& home, unsigned int m);
383  ModEvent cardMax(Space& home, unsigned int m);
388  ModEvent include(Space& home,int i,int j);
393  ModEvent exclude(Space& home,int i,int j);
395  ModEvent include(Space& home,int i);
397  ModEvent exclude(Space& home,int i);
402  ModEvent intersect(Space& home,int i,int j);
404  ModEvent intersect(Space& home,int i);
406 
408 
409 
411  template<class I> ModEvent excludeI(Space& home, I& i);
413  template<class I> ModEvent includeI(Space& home, I& i);
415  template<class I> ModEvent intersectI(Space& home, I& iter);
417 
419 
420  int glbMin(const Delta& d) const;
423  int glbMax(const Delta& d) const;
425  bool glbAny(const Delta& d) const;
427  int lubMin(const Delta& d) const;
429  int lubMax(const Delta& d) const;
431  bool lubAny(const Delta& d) const;
433 
434  };
435 
440  template<class Char, class Traits>
441  std::basic_ostream<Char,Traits>&
442  operator <<(std::basic_ostream<Char,Traits>& os, const EmptyView& x);
443 
444 
450  bool operator ==(const EmptyView& x, const EmptyView& y);
452  bool operator !=(const EmptyView& x, const EmptyView& y);
454 
455 
464  class UniverseView : public ConstView<SetView> {
465  public:
467 
468  UniverseView(void);
471 
473 
474 
476  unsigned int cardMin(void) const;
478  unsigned int cardMax(void) const;
480  int lubMin(void) const;
482  int lubMax(void) const;
484  int lubMinN(unsigned int n) const;
486  int glbMin(void) const;
488  int glbMax(void) const;
489 
491  unsigned int glbSize(void) const;
493  unsigned int lubSize(void) const;
495  unsigned int unknownSize(void) const;
497 
499 
500  bool contains(int i) const;
503  bool notContains(int i) const;
505 
506 
508 
509  ModEvent cardMin(Space& home, unsigned int m);
512  ModEvent cardMax(Space& home, unsigned int m);
517  ModEvent include(Space& home,int i,int j);
522  ModEvent exclude(Space& home,int i,int j);
524  ModEvent include(Space& home,int i);
526  ModEvent exclude(Space& home,int i);
531  ModEvent intersect(Space& home,int i,int j);
533  ModEvent intersect(Space& home,int i);
535 
537 
538 
540  template<class I> ModEvent excludeI(Space& home, I& i);
542  template<class I> ModEvent includeI(Space& home, I& i);
544  template<class I> ModEvent intersectI(Space& home, I& iter);
546 
548 
549  int glbMin(const Delta& d) const;
552  int glbMax(const Delta& d) const;
554  bool glbAny(const Delta& d) const;
556  int lubMin(const Delta& d) const;
558  int lubMax(const Delta& d) const;
560  bool lubAny(const Delta& d) const;
562 
563  };
564 
569  template<class Char, class Traits>
570  std::basic_ostream<Char,Traits>&
571  operator <<(std::basic_ostream<Char,Traits>& os, const UniverseView& x);
572 
573 
579  bool operator ==(const UniverseView& x, const UniverseView& y);
581  bool operator !=(const UniverseView& x, const UniverseView& y);
583 
584 
585 
594  class SingletonView : public DerivedView<Gecode::Int::IntView> {
595  protected:
597 
599  static PropCond pc_settoint(PropCond pc);
604 
605  public:
607 
608  SingletonView(void);
615 
617 
618 
620  unsigned int cardMin(void) const;
622  unsigned int cardMax(void) const;
624  int lubMin(void) const;
626  int lubMax(void) const;
628  int lubMinN(unsigned int n) const;
630  int glbMin(void) const;
632  int glbMax(void) const;
633 
635  unsigned int glbSize(void) const;
637  unsigned int lubSize(void) const;
639  unsigned int unknownSize(void) const;
641 
643 
644  bool contains(int i) const;
647  bool notContains(int i) const;
649 
650 
652 
653  ModEvent cardMin(Space& home, unsigned int m);
656  ModEvent cardMax(Space& home, unsigned int m);
661  ModEvent include(Space& home,int i,int j);
666  ModEvent exclude(Space& home,int i,int j);
668  ModEvent include(Space& home,int i);
670  ModEvent exclude(Space& home,int i);
675  ModEvent intersect(Space& home,int i,int j);
677  ModEvent intersect(Space& home,int i);
679 
681 
682 
684  template<class I> ModEvent excludeI(Space& home, I& i);
686  template<class I> ModEvent includeI(Space& home, I& i);
688  template<class I> ModEvent intersectI(Space& home, I& iter);
690 
692 
693  static void schedule(Space& home, Propagator& p, ModEvent me);
696  static ModEvent me(const ModEventDelta& med);
698  static ModEventDelta med(ModEvent);
700 
702 
703 
710  void subscribe(Space& home, Propagator& p, PropCond pc, bool schedule=true);
712  void cancel(Space& home, Propagator& p, PropCond pc);
714  void reschedule(Space& home, Propagator& p, PropCond pc);
716  void subscribe(Space& home, Advisor& a);
718  void cancel(Space& home, Advisor& a);
720 
722 
723  static ModEvent modevent(const Delta& d);
726  int glbMin(const Delta& d) const;
728  int glbMax(const Delta& d) const;
730  bool glbAny(const Delta& d) const;
732  int lubMin(const Delta& d) const;
734  int lubMax(const Delta& d) const;
736  bool lubAny(const Delta& d) const;
738 
739  };
740 
745  template<class Char, class Traits>
746  std::basic_ostream<Char,Traits>&
747  operator <<(std::basic_ostream<Char,Traits>& os, const SingletonView& x);
748 
754  bool operator ==(const SingletonView& x, const SingletonView& y);
756  bool operator !=(const SingletonView& x, const SingletonView& y);
758 
768  template<class View>
769  class ComplementView : public DerivedView<View> {
770  protected:
771  using DerivedView<View>::x;
772 
773  public:
775  static PropCond pc_negateset(PropCond pc);
778 
780 
781  ComplementView(void);
784  explicit ComplementView(View& y);
786 
788 
789 
791  unsigned int cardMin(void) const;
793  unsigned int cardMax(void) const;
795  int lubMin(void) const;
797  int lubMax(void) const;
799  int lubMinN(unsigned int n) const;
801  int glbMin(void) const;
803  int glbMax(void) const;
804 
806  unsigned int glbSize(void) const;
808  unsigned int lubSize(void) const;
810  unsigned int unknownSize(void) const;
812 
814 
815  bool contains(int i) const;
818  bool notContains(int i) const;
820 
821 
823 
824  ModEvent cardMin(Space& home, unsigned int m);
827  ModEvent cardMax(Space& home, unsigned int m);
832  ModEvent include(Space& home,int i,int j);
837  ModEvent exclude(Space& home,int i,int j);
839  ModEvent include(Space& home,int i);
841  ModEvent exclude(Space& home,int i);
846  ModEvent intersect(Space& home,int i,int j);
848  ModEvent intersect(Space& home,int i);
850 
852 
853 
855  template<class I> ModEvent excludeI(Space& home, I& i);
857  template<class I> ModEvent includeI(Space& home, I& i);
859  template<class I> ModEvent intersectI(Space& home, I& iter);
861 
863 
864  static void schedule(Space& home, Propagator& p, ModEvent me);
867  static ModEvent me(const ModEventDelta& med);
869  static ModEventDelta med(ModEvent);
871 
873 
874 
881  void subscribe(Space& home, Propagator& p, PropCond pc, bool schedule=true);
883  void cancel(Space& home, Propagator& p, PropCond pc);
885  void subscribe(Space& home, Advisor& a);
887  void cancel(Space& home, Advisor& a);
889 
891 
892  static ModEvent modevent(const Delta& d);
895  int glbMin(const Delta& d) const;
897  int glbMax(const Delta& d) const;
899  bool glbAny(const Delta& d) const;
901  int lubMin(const Delta& d) const;
903  int lubMax(const Delta& d) const;
905  bool lubAny(const Delta& d) const;
907 
908  };
909 
914  template<class Char, class Traits, class View>
915  std::basic_ostream<Char,Traits>&
916  operator <<(std::basic_ostream<Char,Traits>& os,
917  const ComplementView<View>& x);
918 
924  template<class View>
925  bool operator ==(const ComplementView<View>& x,
926  const ComplementView<View>& y);
928  template<class View>
929  bool operator !=(const ComplementView<View>& x,
930  const ComplementView<View>& y);
932 
933  template<class View> class LubDiffRanges;
934  template<class View> class GlbDiffRanges;
935 
947  template<class View>
948  class CachedView : public DerivedView<View> {
949  friend class LubDiffRanges<View>;
950  friend class GlbDiffRanges<View>;
951  protected:
952  using DerivedView<View>::x;
953 
958 
959  public:
960 
962 
963  CachedView(void);
966  explicit CachedView(const View& y);
968 
970 
971 
973  unsigned int cardMin(void) const;
975  unsigned int cardMax(void) const;
977  int lubMin(void) const;
979  int lubMax(void) const;
981  int lubMinN(unsigned int n) const;
983  int glbMin(void) const;
985  int glbMax(void) const;
986 
988  unsigned int glbSize(void) const;
990  unsigned int lubSize(void) const;
992  unsigned int unknownSize(void) const;
994 
996 
997  bool contains(int i) const;
1000  bool notContains(int i) const;
1002 
1003 
1005 
1006  ModEvent cardMin(Space& home, unsigned int m);
1009  ModEvent cardMax(Space& home, unsigned int m);
1014  ModEvent include(Space& home,int i,int j);
1019  ModEvent exclude(Space& home,int i,int j);
1021  ModEvent include(Space& home,int i);
1023  ModEvent exclude(Space& home,int i);
1028  ModEvent intersect(Space& home,int i,int j);
1030  ModEvent intersect(Space& home,int i);
1032 
1034 
1035 
1037  template<class I> ModEvent excludeI(Space& home, I& i);
1039  template<class I> ModEvent includeI(Space& home, I& i);
1041  template<class I> ModEvent intersectI(Space& home, I& iter);
1043 
1045 
1046  static void schedule(Space& home, Propagator& p, ModEvent me);
1049  static ModEvent me(const ModEventDelta& med);
1053 
1055 
1056 
1063  void subscribe(Space& home, Propagator& p, PropCond pc, bool schedule=true);
1065  void cancel(Space& home, Propagator& p, PropCond pc);
1067  void subscribe(Space& home, Advisor& a);
1069  void cancel(Space& home, Advisor& a);
1071 
1073 
1074  static ModEvent modevent(const Delta& d);
1077  int glbMin(const Delta& d) const;
1079  int glbMax(const Delta& d) const;
1081  bool glbAny(const Delta& d) const;
1083  int lubMin(const Delta& d) const;
1085  int lubMax(const Delta& d) const;
1087  bool lubAny(const Delta& d) const;
1089 
1091 
1092  void initCache(Space& home, const IntSet& glb, const IntSet& lub);
1095  void cacheGlb(Space& home);
1097  void cacheLub(Space& home);
1099  bool glbModified(void) const;
1101  bool lubModified(void) const;
1103 
1105 
1106  void update(Space& home, CachedView<View>& y);
1109  };
1110 
1115  template<class Char, class Traits, class View>
1116  std::basic_ostream<Char,Traits>&
1117  operator <<(std::basic_ostream<Char,Traits>& os,
1118  const CachedView<View>& x);
1119 
1125  template<class View>
1126  bool operator ==(const CachedView<View>& x, const CachedView<View>& y);
1128  template<class View>
1129  bool operator !=(const CachedView<View>& x, const CachedView<View>& y);
1131 
1136  template<class View>
1138  : public Iter::Ranges::Diff<GlbRanges<View>,BndSetRanges> {
1139  protected:
1144  public:
1147  };
1148 
1153  template<class View>
1155  : public Iter::Ranges::Diff<BndSetRanges,LubRanges<View> > {
1156  protected:
1161  public:
1164  };
1165 
1166 }}
1167 
1168 #include <gecode/set/var/set.hpp>
1169 
1170 #include <gecode/set/view/set.hpp>
1171 
1172 #include <gecode/set/view/const.hpp>
1175 #include <gecode/set/view/cached.hpp>
1176 
1177 #include <gecode/set/view/print.hpp>
1178 #include <gecode/set/var/print.hpp>
1179 
1180 // STATISTICS: set-var
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
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
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Base-class for advisors.
Definition: core.hpp:1292
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 modevent(const Delta &d)
Return modification event.
Definition: view.hpp:676
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to view.
Definition: view.hpp:650
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
Definition: view.hpp:639
static void schedule(Space &home, Propagator &p, ModEvent me)
Schedule propagator p with modification event me.
Definition: view.hpp:634
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to view.
Definition: view.hpp:656
Integer sets.
Definition: int.hh:174
Integer variables.
Definition: int.hh:371
Cached integer view.
Definition: view.hpp:1166
int med(void) const
Return median of domain (greatest element not greater than the median)
Definition: cached.hpp:70
void initCache(Space &home, const IntSet &s)
Initialize cache to set s.
Definition: cached.hpp:307
void update(Space &home, CachedView< View > &y)
Update this view to be a clone of view y.
Definition: cached.hpp:281
CachedView(void)
Default constructor.
Definition: cached.hpp:46
Integer view for integer variables.
Definition: view.hpp:129
Range iterator for computing set difference.
Definition: ranges-diff.hpp:43
Base-class for propagators.
Definition: core.hpp:1064
Set variables
Definition: set.hh:127
Range iterator for integer sets.
Definition: var-imp.hpp:185
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
int glbMax(void) const
Return maximum of the greatest lower bound.
Definition: cached.hpp:105
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
Definition: cached.hpp:242
bool glbModified(void) const
Check whether greatest lower bound cache differs from current domain.
Definition: cached.hpp:304
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
Definition: cached.hpp:260
GLBndSet glbCache
The cached greatest lower bound.
Definition: view.hpp:957
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
Definition: cached.hpp:49
LUBndSet lubCache
The cached least upper bound.
Definition: view.hpp:955
int lubMin(void) const
Return minimum of the least upper bound.
Definition: cached.hpp:87
unsigned int cardMax(void) const
Return maximum cardinality.
Definition: cached.hpp:81
int lubMinN(unsigned int n) const
Return n-th smallest element of the least upper bound.
bool contains(int i) const
Test whether i is in the greatest lower bound.
Definition: cached.hpp:67
unsigned int cardMin(void) const
Return minimum cardinality.
Definition: cached.hpp:75
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
void cacheLub(Space &home)
Update least upper bound cache to current domain.
Definition: cached.hpp:297
void cacheGlb(Space &home)
Update greatest lower bound cache to current domain.
Definition: cached.hpp:290
static ModEventDelta med(ModEvent)
Translate modification event me to modification event delta for view.
bool lubModified(void) const
Check whether least upper bound cache differs from current domain.
Definition: cached.hpp:310
unsigned int unknownSize(void) const
Return the number of unknown elements.
Definition: cached.hpp:61
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
Definition: cached.hpp:55
bool notContains(int i) const
Test whether i is not in the least upper bound.
Definition: cached.hpp:71
int lubMax(void) const
Return maximum of the least upper bound.
Definition: cached.hpp:93
CachedView(const View &y)
Initialize with set view y.
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to view.
int glbMin(void) const
Return minimum of the greatest lower bound.
Definition: cached.hpp:99
Complement set view.
Definition: view.hpp:769
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
Definition: complement.hpp:303
static ModEvent me_negateset(ModEvent me)
Negate the modification event me.
Definition: complement.hpp:53
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
Definition: complement.hpp:207
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
Definition: complement.hpp:268
bool contains(int i) const
Test whether i is in the greatest lower bound.
Definition: complement.hpp:93
unsigned int cardMax(void) const
Return maximum cardinality.
Definition: complement.hpp:107
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
Definition: complement.hpp:81
int glbMin(void) const
Return minimum of the greatest lower bound.
Definition: complement.hpp:138
int glbMax(void) const
Return maximum of the greatest lower bound.
Definition: complement.hpp:150
static void schedule(Space &home, Propagator &p, ModEvent me)
Schedule propagator p with modification event me.
Definition: complement.hpp:263
int lubMax(void) const
Return maximum of the least upper bound.
Definition: complement.hpp:125
bool notContains(int i) const
Test whether i is not in the least upper bound.
Definition: complement.hpp:97
int lubMin(void) const
Return minimum of the least upper bound.
Definition: complement.hpp:113
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j.
Definition: complement.hpp:213
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to view.
Definition: complement.hpp:238
ModEvent intersect(Space &home, int i, int j)
Update least upper bound to contain at most all elements between and including i and j.
Definition: complement.hpp:199
static PropCond pc_negateset(PropCond pc)
Negate the propagation condition pc.
Definition: complement.hpp:65
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
Definition: complement.hpp:231
ComplementView(void)
Default constructor.
Definition: complement.hpp:44
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
Definition: complement.hpp:75
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
Definition: complement.hpp:321
unsigned int cardMin(void) const
Return minimum cardinality.
Definition: complement.hpp:101
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to view.
Definition: complement.hpp:245
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
Definition: complement.hpp:219
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
Definition: complement.hpp:225
int lubMinN(unsigned int n) const
Return n-th smallest element of the least upper bound.
static ModEventDelta med(ModEvent)
Translate modification event me to modification event delta for view.
Definition: complement.hpp:274
unsigned int unknownSize(void) const
Return the number of unknown elements.
Definition: complement.hpp:87
static ModEvent modevent(const Delta &d)
Return modification event.
Definition: complement.hpp:285
Constant view.
Definition: view.hpp:186
bool notContains(int i) const
Test whether i is not in the least upper bound.
Definition: const.hpp:122
int lubMinN(unsigned int n) const
Return n-th smallest element of the least upper bound.
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
Definition: const.hpp:105
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
Definition: const.hpp:253
unsigned int cardMin(void) const
Return minimum cardinality.
Definition: const.hpp:127
ModEvent intersect(Space &home, int i, int j)
Update least upper bound to contain at most all elements between and including i and j.
Definition: const.hpp:177
bool contains(int i) const
Test whether i is in the greatest lower bound.
Definition: const.hpp:111
bool operator<(const ConstSetView &y) const
Whether this view comes before view y (arbitray order)
Definition: const.hpp:680
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
Definition: const.hpp:183
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
Definition: const.hpp:102
int lubMax(void) const
Return maximum of the least upper bound.
Definition: const.hpp:138
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
Definition: const.hpp:205
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j.
Definition: const.hpp:191
int glbMax(void) const
Return maximum of the greatest lower bound.
Definition: const.hpp:146
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
Definition: const.hpp:211
unsigned int unknownSize(void) const
Return the number of unknown elements.
Definition: const.hpp:108
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
Definition: const.hpp:199
int lubMin(void) const
Return minimum of the least upper bound.
Definition: const.hpp:133
int glbMin(void) const
Return minimum of the greatest lower bound.
Definition: const.hpp:143
void update(Space &home, ConstSetView &y)
Update this view to be a clone of view y.
Definition: const.hpp:217
ConstSetView(void)
Default constructor.
Definition: const.hpp:81
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
Definition: const.hpp:268
unsigned int cardMax(void) const
Return maximum cardinality.
Definition: const.hpp:130
Constant view for the empty set.
Definition: view.hpp:336
EmptyView(void)
Default constructor.
Definition: const.hpp:274
unsigned int cardMin(void) const
Return minimum cardinality.
Definition: const.hpp:294
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
Definition: const.hpp:349
bool contains(int i) const
Test whether i is in the greatest lower bound.
Definition: const.hpp:288
int lubMax(void) const
Return maximum of the least upper bound.
Definition: const.hpp:303
bool notContains(int i) const
Test whether i is not in the least upper bound.
Definition: const.hpp:291
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
Definition: const.hpp:375
int lubMin(void) const
Return minimum of the least upper bound.
Definition: const.hpp:300
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
Definition: const.hpp:279
int glbMin(void) const
Return minimum of the greatest lower bound.
Definition: const.hpp:306
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
Definition: const.hpp:337
int glbMax(void) const
Return maximum of the greatest lower bound.
Definition: const.hpp:309
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
Definition: const.hpp:344
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
Definition: const.hpp:393
unsigned int cardMax(void) const
Return maximum cardinality.
Definition: const.hpp:297
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j.
Definition: const.hpp:341
ModEvent intersect(Space &home, int i, int j)
Update least upper bound to contain at most all elements between and including i and j.
Definition: const.hpp:334
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
Definition: const.hpp:282
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
Definition: const.hpp:354
unsigned int unknownSize(void) const
Return the number of unknown elements.
Definition: const.hpp:285
int lubMinN(unsigned int n) const
Return n-th smallest element of the least upper bound.
Growing sets of integers.
Definition: var-imp.hpp:205
Range iterator for difference of greatest lower bound and cache
Definition: view.hpp:1138
GlbRanges< View > gr
Lower bound iterator.
Definition: view.hpp:1141
GlbDiffRanges(const CachedView< View > &x)
Constructor.
Definition: cached.hpp:393
BndSetRanges cr
Cached lower bound.
Definition: view.hpp:1143
Range iterator for the greatest lower bound.
Definition: var-imp.hpp:359
Shrinking sets of integers.
Definition: var-imp.hpp:243
Range iterator for difference of least upper bound and cache
Definition: view.hpp:1155
LubRanges< View > lr
Upper bound iterator.
Definition: view.hpp:1160
BndSetRanges cr
Cached upper bound.
Definition: view.hpp:1158
LubDiffRanges(const CachedView< View > &x)
Constructor.
Definition: cached.hpp:400
Range iterator for the least upper bound.
Definition: var-imp.hpp:317
Finite integer set variable implementation.
Definition: var-imp.hpp:430
Set view for set variables
Definition: view.hpp:56
bool contains(int i) const
Test whether i is in the greatest lower bound.
Definition: set.hpp:74
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
Definition: set.hpp:201
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
Definition: set.hpp:188
unsigned int unknownSize(void) const
Return the number of unknown elements.
Definition: set.hpp:70
SetView(void)
Default constructor.
Definition: set.hpp:48
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
Definition: set.hpp:164
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
Definition: set.hpp:126
int glbMax(void) const
Return maximum of the greatest lower bound.
Definition: set.hpp:106
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
Definition: set.hpp:66
int lubMax(void) const
Return maximum of the least upper bound.
Definition: set.hpp:94
int lubMin(void) const
Return minimum of the least upper bound.
Definition: set.hpp:90
int lubMinN(unsigned int n) const
Return n-th smallest element of the least upper bound.
Definition: set.hpp:98
int glbMin(void) const
Return minimum of the greatest lower bound.
Definition: set.hpp:102
static ModEvent modevent(const Delta &d)
Return modification event.
Definition: set.hpp:175
unsigned int cardMin(void) const
Return minimum cardinality.
Definition: set.hpp:82
unsigned int cardMax(void) const
Return maximum cardinality.
Definition: set.hpp:86
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
Definition: set.hpp:62
bool notContains(int i) const
Test whether i is not in the least upper bound.
Definition: set.hpp:78
ModEvent intersect(Space &home, int i, int j)
Update least upper bound to contain at most all elements between and including i and j.
Definition: set.hpp:141
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
Definition: set.hpp:160
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j.
Definition: set.hpp:156
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
Definition: set.hpp:151
Singleton set view.
Definition: view.hpp:594
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j.
Definition: singleton.hpp:182
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
Definition: singleton.hpp:292
bool contains(int i) const
Test whether i is in the greatest lower bound.
Definition: singleton.hpp:107
ModEvent intersect(Space &home, int i, int j)
Update least upper bound to contain at most all elements between and including i and j.
Definition: singleton.hpp:154
unsigned int cardMin(void) const
Return minimum cardinality.
Definition: singleton.hpp:114
void reschedule(Space &home, Propagator &p, PropCond pc)
Re-schedule propagator p with propagation condition pc.
Definition: singleton.hpp:235
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
Definition: singleton.hpp:99
int lubMax(void) const
Return maximum of the least upper bound.
Definition: singleton.hpp:123
int glbMax(void) const
Return maximum of the greatest lower bound.
Definition: singleton.hpp:130
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
Definition: singleton.hpp:254
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
Definition: singleton.hpp:221
unsigned int cardMax(void) const
Return maximum cardinality.
Definition: singleton.hpp:117
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
Definition: singleton.hpp:283
int lubMinN(unsigned int n) const
Return n-th smallest element of the least upper bound.
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
Definition: singleton.hpp:94
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
Definition: singleton.hpp:205
int glbMin(void) const
Return minimum of the greatest lower bound.
Definition: singleton.hpp:126
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to view.
Definition: singleton.hpp:231
unsigned int unknownSize(void) const
Return the number of unknown elements.
Definition: singleton.hpp:102
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to view.
Definition: singleton.hpp:226
bool notContains(int i) const
Test whether i is not in the least upper bound.
Definition: singleton.hpp:111
SingletonView(void)
Default constructor.
Definition: singleton.hpp:41
static PropCond pc_settoint(PropCond pc)
Convert set variable PropCond pc to a PropCond for integer variables.
Definition: singleton.hpp:52
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
Definition: singleton.hpp:177
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
Definition: singleton.hpp:200
static ModEvent me_inttoset(ModEvent me)
Convert integer variable ModEvent me to a ModEvent for set variables.
Definition: singleton.hpp:64
static ModEvent me_settoint(ModEvent me)
Convert set variable ModEvent me to a ModEvent for integer variables.
Definition: singleton.hpp:80
int lubMin(void) const
Return minimum of the least upper bound.
Definition: singleton.hpp:120
static void schedule(Space &home, Propagator &p, ModEvent me)
Schedule propagator p with modification event me.
Definition: singleton.hpp:250
static ModEvent modevent(const Delta &d)
Return modification event.
Definition: singleton.hpp:272
static ModEventDelta med(ModEvent)
Translate modification event me to modification event delta for view.
Definition: singleton.hpp:258
Constant view for the universe.
Definition: view.hpp:464
int glbMax(void) const
Return maximum of the greatest lower bound.
Definition: const.hpp:434
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
Definition: const.hpp:465
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j.
Definition: const.hpp:462
int glbMin(void) const
Return minimum of the greatest lower bound.
Definition: const.hpp:431
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
Definition: const.hpp:524
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
Definition: const.hpp:470
UniverseView(void)
Default constructor.
Definition: const.hpp:401
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
Definition: const.hpp:481
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
Definition: const.hpp:459
ModEvent intersect(Space &home, int i, int j)
Update least upper bound to contain at most all elements between and including i and j.
Definition: const.hpp:475
bool notContains(int i) const
Test whether i is not in the least upper bound.
Definition: const.hpp:416
bool contains(int i) const
Test whether i is in the greatest lower bound.
Definition: const.hpp:413
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
Definition: const.hpp:506
int lubMax(void) const
Return maximum of the least upper bound.
Definition: const.hpp:428
unsigned int unknownSize(void) const
Return the number of unknown elements.
Definition: const.hpp:410
unsigned int cardMin(void) const
Return minimum cardinality.
Definition: const.hpp:419
int lubMinN(unsigned int n) const
Return n-th smallest element of the least upper bound.
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
Definition: const.hpp:404
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
Definition: const.hpp:407
unsigned int cardMax(void) const
Return maximum cardinality.
Definition: const.hpp:422
int lubMin(void) const
Return minimum of the least upper bound.
Definition: const.hpp:425
Computation spaces.
Definition: core.hpp:1742
Base-class for variable implementation views.
Definition: view.hpp:133
int PropCond
Type for propagation conditions.
Definition: core.hpp:72
int ModEvent
Type for modification events.
Definition: core.hpp:62
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:767
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
FloatVal intersect(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:503
ModEvent exclude(Space &home, View &x, int s)
Prune view x to exclude all values from s.
Definition: set-op.hpp:137
ModEvent include(Space &home, View &x, int s)
Prune view x to only include values from s.
Definition: set-op.hpp:123
unsigned int size(I &i)
Size of all ranges of range iterator i.
bool operator==(const CachedView< View > &x, const CachedView< View > &y)
Definition: cached.hpp:381
bool operator!=(const CachedView< View > &x, const CachedView< View > &y)
Definition: cached.hpp:387
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const CachedView< View > &x)
Definition: cached.hpp:374
Gecode::IntArgs i({1, 2, 3, 4})
Gecode::IntSet d(v, 7)