44namespace Gecode {
namespace Set {
namespace Int {
90 assert(x0.cardMin()>=1);
94 unsigned int size = 0;
98 int* ub =
r.alloc<
int>(size*2);
103 ub[2*i+1] = ubr.max();
106 unsigned int x0cm = x0.
cardMin()-1;
107 for (
unsigned int i=size; i--;) {
108 unsigned int width =
static_cast<unsigned int>(ub[2*i+1]-ub[2*i]+1);
110 maxN =
static_cast<int>(ub[2*i+1]-x0cm);
165 if ((x0.cardMax() == 0) ||
166 ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
167 ((x0.glbSize() > 0) && (x0.glbMin() < x1.min())))
171 if (x1.assigned() && x1.val()==x0.lubMin()) {
177 if (x0.glbMin() == x0.lubMin()) {
184 if (x1.assigned() && x0.glbSize() > 0 && x1.val()==x0.glbMin()) {
185 unsigned int oldGlbSize = x0.glbSize();
198 if (!ur() || ur.
min()>x1.val()) {
226 int* _ur =
r.alloc<
int>(num_ranges*2);
231 _ur[2*i ] = ur.min();
232 _ur[2*i+1] = ur.max();
239 for (
int i=num_ranges; i--; ) {
241 unsigned int num_values =
static_cast<unsigned int>(_ur[2*i+1]-_ur[2*i]+1);
243 if (num_values >=
n) {
245 nth_largest =
static_cast<int>(_ur[2*i+1]-
n+1);
252 if (x1.min() > nth_largest)
258 template<
class View, ReifyMode rm>
267 template<
class View, ReifyMode rm>
275 template<
class View, ReifyMode rm>
282 template<
class View, ReifyMode rm>
288 template<
class View, ReifyMode rm>
306 if ((x0.cardMax() == 0) ||
307 ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
308 ((x0.glbSize() > 0) && (x0.glbMin() < x1.min())))
315 if (x0.glbMin() == x0.lubMin()) {
318 if (x1.val() == x0.glbMin()) {
328 else if ((x0.glbMin() < x1.min()) ||
329 (x0.glbMin() > x1.max()) ||
427 assert(x0.cardMin()>=1);
475 if ((x0.cardMax() == 0) ||
476 ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
477 ((x0.glbSize() > 0) && (x0.glbMax() > x1.max())))
481 if (x1.assigned() && x1.val()==x0.lubMax()) {
487 if (x0.glbMax() == x0.lubMax()) {
494 if (x1.assigned() && x0.glbSize() > 0 && x1.val()==x0.glbMax()) {
495 unsigned int oldGlbSize = x0.glbSize();
500 while (ur.
max() < x1.val()) {
506 if (ur.
width() == 1) {
529 unsigned int n = x0.cardMin();
532 if (ur.width() >=
n) {
534 nth_smallest =
static_cast<int>(ur.min() +
n - 1);
541 if (x1.max() < nth_smallest)
547 template<
class View, ReifyMode rm>
556 template<
class View, ReifyMode rm>
563 template<
class View, ReifyMode rm>
572 template<
class View, ReifyMode rm>
578 template<
class View, ReifyMode rm>
596 if ((x0.cardMax() == 0) ||
597 ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
598 ((x0.glbSize() > 0) && (x0.glbMax() > x1.max())))
605 if (x0.glbMax() == x0.lubMax()) {
608 if (x1.val() == x0.glbMax()) {
618 else if ((x0.glbMax() < x1.min()) ||
619 (x0.glbMax() > x1.max()) ||
643 unsigned int n = x0.cardMin();
649 nth_smallest =
static_cast<int>(ur.min() +
n - 1);
656 if (x1.max() < nth_smallest) {
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
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
Boolean view for Boolean variables.
Integer view for integer variables.
Reified mixed binary propagator.
Range iterator for integer views.
Range iterator for computing intersection (binary)
int min(void) const
Return smallest value of range.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
int max(void) const
Return largest value of range.
unsigned int cardMin(void) const
Return cardinality minimum.
static const int MAX_OF_EMPTY
Returned by empty sets when asked for their maximum element.
static const int MIN_OF_EMPTY
Returned by empty sets when asked for their minimum element.
Propagator for maximum element
virtual Actor * copy(Space &home)
Copy propagator during cloning.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the largest element of s.
MaxElement(Space &home, MaxElement &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Propagator for minimum element
MinElement(Space &home, MinElement &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the minimal element of s.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Propagator for not maximum element
NotMaxElement(Space &home, NotMaxElement &p)
Constructor for cloning p.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is not the largest element of s.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Propagator for not minimum element
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
NotMinElement(Space &home, NotMinElement &p)
Constructor for cloning p.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is not the minimal element of s.
Reified propagator for maximum element
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x, Gecode::Int::BoolView b)
Post reified propagator for b iff x is the largest element of s.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
ReMaxElement(Space &home, ReMaxElement &p)
Constructor for cloning p.
Propagator for reified minimum element
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x, Gecode::Int::BoolView b)
Post reified propagator for b iff x is the minimal element of s.
ReMinElement(Space &home, ReMinElement &p)
Constructor for cloning p.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Range iterator for the least upper bound.
Range iterator for the unknown set.
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_REWRITE(prop, post)
Rewrite propagator by executing post function.
@ RM_IMP
Implication for reification.
@ RM_PMI
Inverse implication for reification.
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
const int min
Smallest allowed integer in integer set.
const int max
Largest allowed integer in integer set.
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
@ ES_OK
Execution is okay.
@ ES_FIX
Propagation has computed fixpoint.