44 namespace 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) ||
167 ((
x0.glbSize() > 0) && (
x0.glbMin() <
x1.
min())))
177 if (
x0.glbMin() ==
x0.lubMin()) {
185 unsigned int oldGlbSize =
x0.glbSize();
226 int* _ur = r.
alloc<
int>(num_ranges*2);
230 _ur[2*
i ] = ur.min();
231 _ur[2*i+1] = ur.max();
235 unsigned int n =
x0.cardMin();
237 for (
int i=num_ranges; i--; ) {
239 unsigned int num_values =
static_cast<unsigned int>(_ur[2*i+1]-_ur[2*
i]+1);
241 if (num_values >= n) {
243 nth_largest =
static_cast<int>(_ur[2*i+1]-n+1);
250 if (
x1.
min() > nth_largest)
256 template<
class View, ReifyMode rm>
265 template<
class View, ReifyMode rm>
273 template<
class View, ReifyMode rm>
280 template<
class View, ReifyMode rm>
286 template<
class View, ReifyMode rm>
304 if ((
x0.cardMax() == 0) ||
306 ((
x0.glbSize() > 0) && (
x0.glbMin() <
x1.
min())))
313 if (
x0.glbMin() ==
x0.lubMin()) {
326 else if ((
x0.glbMin() <
x1.
min()) ||
425 assert(
x0.cardMin()>=1);
473 if ((
x0.cardMax() == 0) ||
475 ((
x0.glbSize() > 0) && (
x0.glbMax() >
x1.
max())))
485 if (
x0.glbMax() ==
x0.lubMax()) {
493 unsigned int oldGlbSize =
x0.glbSize();
504 if (ur.
width() == 1) {
527 unsigned int n =
x0.cardMin();
530 if (ur.width() >=
n) {
532 nth_smallest =
static_cast<int>(ur.min() + n - 1);
539 if (
x1.
max() < nth_smallest)
545 template<
class View, ReifyMode rm>
554 template<
class View, ReifyMode rm>
561 template<
class View, ReifyMode rm>
570 template<
class View, ReifyMode rm>
576 template<
class View, ReifyMode rm>
594 if ((
x0.cardMax() == 0) ||
596 ((
x0.glbSize() > 0) && (
x0.glbMax() >
x1.
max())))
603 if (
x0.glbMax() ==
x0.lubMax()) {
616 else if ((
x0.glbMax() <
x1.
min()) ||
641 unsigned int n =
x0.cardMin();
647 nth_smallest =
static_cast<int>(ur.min() + n - 1);
654 if (
x1.
max() < nth_smallest) {
ModEvent inter_r(Space &home, I &i, bool depends=true)
Intersect domain with ranges described by i.
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
int val(void) const
Return assigned value (only if assigned)
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the minimal element of s.
bool zero(void) const
Test whether view is assigned to be zero.
MinElement(Space &home, MinElement &p)
Constructor for cloning p.
Inverse implication for reification.
Range iterator for the unknown set.
const int min
Smallest allowed integer in integer set.
ExecStatus ES_SUBSUMED(Propagator &p)
View x0
View of type View0.
Propagator for not maximum element
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
bool one(void) const
Test whether view is assigned to be one.
Reified mixed binary propagator.
int max(void) const
Return largest value of range.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
static const int MIN_OF_EMPTY
Returned by empty sets when asked for their minimum element.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Propagation has computed fixpoint.
const int max
Largest allowed integer in integer set.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is not the minimal element of s.
Gecode::Int::IntView x1
View of type View1.
MaxElement(Space &home, MaxElement &p)
Constructor for cloning p.
Base-class for both propagators and branchers.
Propagator for reified minimum element
virtual Actor * copy(Space &home)
Copy propagator during cloning.
static const int MAX_OF_EMPTY
Returned by empty sets when asked for their maximum element.
bool in(int n) const
Test whether n is contained in domain.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
NotMaxElement(Space &home, NotMaxElement &p)
Constructor for cloning p.
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Propagator for not minimum element
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.
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Range iterator for computing intersection (binary)
NotMinElement(Space &home, NotMinElement &p)
Constructor for cloning p.
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
View x0
View of type View0.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
int min(void) const
Return minimum of domain.
size_t size
The size of the propagator (used during subsumption)
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the largest element of s.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
Post propagator for SetVar SetOpType SetVar SetRelType r
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Propagator for maximum element
Integer view for integer variables.
bool assigned(void) const
Test whether view is assigned.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Reified propagator for maximum element
ReMinElement(Space &home, ReMinElement &p)
Constructor for cloning p.
Gecode::Int::BoolView b
Boolean control view.
ReMaxElement(Space &home, ReMaxElement &p)
Constructor for cloning p.
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Gecode toplevel namespace
int max(void) const
Return maximum of domain.
Implication for reification.
int min(void) const
Return smallest value of range.
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.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Gecode::Int::IntView x1
View of type View1.
int ModEventDelta
Modification event deltas.
Home class for posting propagators
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is not the largest element of s.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Propagator for minimum element
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Boolean view for Boolean variables.