42 namespace Gecode {
namespace Set {
45 template<
class Char,
class Traits,
class I>
50 if (r.min() == r.max()) {
52 }
else if (r.min()+1 == r.max()) {
53 s << r.min() <<
"," << r.max();
55 s << r.min() <<
".." << r.max();
65 template<
class Char,
class Traits,
class IL,
class IU>
67 print(std::basic_ostream<Char,Traits>& s,
bool assigned, IL& lb, IU& ub,
68 unsigned int cardMin,
unsigned int cardMax) {
75 if (cardMin==cardMax) {
76 s <<
"#(" << cardMin <<
")";
78 s <<
"#(" << cardMin <<
"," << cardMax <<
")";
83 template<
class Char,
class Traits>
84 std::basic_ostream<Char,Traits>&
85 operator <<(std::basic_ostream<Char,Traits>& os,
const SetView&
x) {
86 std::basic_ostringstream<Char,Traits> s;
87 s.copyfmt(os); s.width(0);
90 print(s,
x.assigned(), lb, ub,
x.cardMin(),
x.cardMax()) ;
94 template<
class Char,
class Traits>
95 inline std::basic_ostream<Char,Traits>&
96 operator <<(std::basic_ostream<Char,Traits>& os,
const EmptyView&) {
100 template<
class Char,
class Traits>
101 std::basic_ostream<Char,Traits>&
102 operator <<(std::basic_ostream<Char,Traits>& os,
const UniverseView&) {
103 std::basic_ostringstream<Char,Traits> s;
104 s.copyfmt(os); s.width(0);
108 return os << s.str();
111 template<
class Char,
class Traits>
112 std::basic_ostream<Char,Traits>&
114 std::basic_ostringstream<Char,Traits> s;
115 s.copyfmt(os); s.width(0);
118 s <<
"#(" <<
x.cardMin() <<
")";
119 return os << s.str();
122 template<
class Char,
class Traits>
123 std::basic_ostream<Char,Traits>&
125 std::basic_ostringstream<Char,Traits> s;
126 s.copyfmt(os); s.width(0);
128 s <<
"{" <<
x.glbMin() <<
"}#(1)";
135 return os << s.str();
const int min
Smallest allowed integer in integer set.
Range iterator for least upper bound of constant set view
const unsigned int card
Maximum cardinality of an integer set.
const int max
Largest allowed integer in integer set.
Range iterator for least upper bound of singleton set view
Range iterator for least upper bound of set variable views
Constant view for the universe.
Range iterator for greatest lower bound of set variable views
Set view for set variables
void print(std::basic_ostream< Char, Traits > &s, bool assigned, IL &lb, IU &ub, unsigned int cardMin, unsigned int cardMax)
Print set view.
void printBound(std::basic_ostream< Char, Traits > &s, I &r)
Print bound of a set view or variable.
Node * x
Pointer to corresponding Boolean expression node.
bool assigned(View x, int v)
Whether x is assigned to value v.
Gecode toplevel namespace
Constant view for the empty set.