34namespace Gecode {
namespace Set {
namespace Rel {
56 bool get(
unsigned int i)
const;
58 void set(
unsigned int i,
bool j);
85 template<
class View0,
class View1>
89 bool xmin(
unsigned int i)
const;
91 bool xmax(
unsigned int i)
const;
93 bool ymin(
unsigned int i)
const;
95 bool ymax(
unsigned int i)
const;
98 void xmin(
unsigned int i,
bool j);
100 void xmax(
unsigned int i,
bool j);
102 void ymin(
unsigned int i,
bool j);
104 void ymax(
unsigned int i,
bool j);
116 unsigned int size(
void)
const;
119 template<
class View0,
class View1>
145 unsigned int xoff0,
unsigned int yoff0)
146 : cs(&cs0), i(0), xoff(xoff0), yoff(yoff0) {
153 while ((i < cs->
xsize) && !cs->get(xoff+2*i+yoff))
245 template<
class View0,
class View1>
271 template<
class View0,
class View1>
292 for (
unsigned int i=0; xylubv(); ++xylubv, ++i) {
293 ub[i] = xylubv.
val();
294 if (xlv() && xylubv.
val()==xlv.
val()) {
298 if (xuv() && xylubv.
val()==xuv.
val()) {
302 if (ylv() && xylubv.
val()==ylv.
val()) {
306 if (yuv() && xylubv.
val()==yuv.
val()) {
313 template<
class View0,
class View1,
bool strict>
318 template<
class View0,
class View1,
bool strict>
323 template<
class View0,
class View1,
bool strict>
330 (void)
new (home)
Lq(home,
x,
y);
334 template<
class View0,
class View1,
bool strict>
337 return new (home)
Lq(home,*
this);
340 template<
class View0,
class View1,
bool strict>
343 if ( (!strict) && x1.cardMax()==0) {
347 if (x0.cardMax()==0) {
351 if (x0.glbMin() < x1.lubMin())
353 if (x1.glbMin() < x0.lubMin())
356 bool assigned = x0.assigned() && x1.assigned();
366 unsigned int firsti=0;
367 unsigned int n=cs.
size();
368 while ((i<
n) && (cs.
xmin(i) == cs.
ymax(i))) {
430 while ((i <
n) && (cs.
xmax(i) == cs.
ymin(i))) {
459 while ((i <
n) && (cs.
xmin(i) == cs.
ymax(i))) {
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
Base-class for both propagators and branchers.
Home class for posting propagators
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, V0 x0, V1 x1)
Post propagator .
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Lq(Space &home, Lq &p)
Constructor for cloning p.
void reset(void)
Reset iterator to start.
Value iterator from range iterator.
int val(void) const
Return current value.
Range iterator for computing union (binary)
Range iterator from value iterator.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
unsigned int cardMin(void) const
Return cardinality minimum.
Range iterator for the greatest lower bound.
Range iterator for the least upper bound.
Value iterator for characteristic function.
unsigned int xoff
Offset from start of bitset.
CSIter(void)
Default constructor.
unsigned int i
Current position.
bool operator()(void) const
Test if iterator is finished.
unsigned int yoff
Offset for each element (0=lower bound, 1=upper bound)
void operator++(void)
Move iterator to next element.
int val(void) const
Value of current iterator position.
CharacteristicSets * cs
Pointer to the underlying set.
Representation of the characteristic functions of two sets.
bool yum
Whether upper bound of y was updated.
ModEvent xlq(unsigned int i, bool j)
Update upper bound of to j.
int * ub
Elements in the combined upper bounds.
unsigned int size(void) const
Return size of combined upper bounds.
bool xlm
Whether lower bound of x was updated.
void set(unsigned int i, bool j)
Set bit i to value j.
bool xmin(unsigned int i) const
Return minimum of element i for variable x.
bool get(unsigned int i) const
Get bit i.
bool xmax(unsigned int i) const
Return maximum of element i for variable x.
bool xum
Whether upper bound of x was updated.
bool ymin(unsigned int i) const
Return minimum of element i for variable y.
ModEvent xgq(unsigned int i, bool j)
Update lower bound of to j.
unsigned int xsize
Size of the combined upper bounds.
ModEvent ylq(unsigned int i, bool j)
Update upper bound of to j.
ExecStatus prune(Space &home, View0 x, View1 y)
Prune x and y using computed bounds.
bool ylm
Whether lower bound of y was updated.
ModEvent ygq(unsigned int i, bool j)
Update lower bound of to j.
CharacteristicSets(Region &re, View0 x, View1 y)
Constructor.
bool ymax(unsigned int i) const
Return maximum of element i for variable y.
Support::BitSetBase b
Storage for the characteristic functions.
Propagator for set less than or equal
void init(A &a, unsigned int s, bool setbits=false)
Initialize for s bits and allocator a (only after default constructor)
bool get(unsigned int i) const
Access value at bit i.
void clear(unsigned int i)
Clear bit i.
void set(unsigned int i)
Set bit i.
ExecStatus ES_SUBSUMED(Propagator &p)
int ModEventDelta
Modification event deltas.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
unsigned int size(I &i)
Size of all ranges of range iterator i.
const Gecode::ModEvent ME_SET_NONE
Domain operation has not changed domain.
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
const Gecode::ModEvent ME_SET_FAILED
Domain operation has resulted in failure.
Gecode toplevel namespace
bool same(VarArgArray< Var > x, VarArgArray< Var > y)
Post propagator for SetVar SetOpType SetVar y
@ ES_OK
Execution is okay.
@ ES_FAILED
Execution has resulted in failure.
@ ES_NOFIX
Propagation has not computed fixpoint.
Post propagator for SetVar x
int ModEvent
Type for modification events.