Go to the documentation of this file.
48 namespace Gecode {
namespace Set {
namespace Int {
71 return new (home)
MinElement(home,share,*
this);
94 assert(x0.cardMin()>=1);
98 unsigned int size = 0;
102 int* ub =
r.alloc<
int>(
size*2);
107 ub[2*
i+1] = ubr.max();
110 unsigned int x0cm = x0.cardMin()-1;
111 for (
unsigned int i=
size;
i--;) {
112 unsigned int width =
static_cast<unsigned int>(ub[2*
i+1]-ub[2*
i]+1);
114 maxN =
static_cast<int>(ub[2*
i+1]-x0cm);
170 if ((x0.cardMax() == 0) ||
171 ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
172 ((x0.glbSize() > 0) && (x0.glbMin() < x1.min())))
176 if (x1.assigned() && x1.val()==x0.lubMin()) {
182 if (x0.glbMin() == x0.lubMin()) {
189 if (x1.assigned() && x0.glbSize() > 0 && x1.val()==x0.glbMin()) {
190 unsigned int oldGlbSize = x0.glbSize();
203 if (!ur() || ur.
min()>x1.val()) {
231 int* _ur =
r.alloc<
int>(num_ranges*2);
235 _ur[2*
i ] = ur.min();
236 _ur[2*
i+1] = ur.max();
240 unsigned int n = x0.cardMin();
242 for (
int i=num_ranges;
i--; ) {
244 unsigned int num_values =
static_cast<unsigned int>(_ur[2*
i+1]-_ur[2*
i]+1);
246 if (num_values >=
n) {
248 nth_largest =
static_cast<int>(_ur[2*
i+1]-
n+1);
255 if (x1.min() > nth_largest)
261 template<
class View, ReifyMode rm>
270 template<
class View, ReifyMode rm>
278 template<
class View, ReifyMode rm>
286 template<
class View, ReifyMode rm>
292 template<
class View, ReifyMode rm>
310 if ((x0.cardMax() == 0) ||
311 ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
312 ((x0.glbSize() > 0) && (x0.glbMin() < x1.min())))
319 if (x0.glbMin() == x0.lubMin()) {
322 if (x1.val() == x0.glbMin()) {
332 else if ((x0.glbMin() < x1.min()) ||
333 (x0.glbMin() > x1.max()) ||
422 return new (home)
MaxElement(home,share,*
this);
431 assert(x0.cardMin()>=1);
480 if ((x0.cardMax() == 0) ||
481 ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
482 ((x0.glbSize() > 0) && (x0.glbMax() > x1.max())))
486 if (x1.assigned() && x1.val()==x0.lubMax()) {
492 if (x0.glbMax() == x0.lubMax()) {
499 if (x1.assigned() && x0.glbSize() > 0 && x1.val()==x0.glbMax()) {
500 unsigned int oldGlbSize = x0.glbSize();
505 while (ur.
max() < x1.val()) {
511 if (ur.
width() == 1) {
534 unsigned int n = x0.cardMin();
537 if (ur.width() >=
n) {
539 nth_smallest =
static_cast<int>(ur.min() +
n - 1);
546 if (x1.max() < nth_smallest)
552 template<
class View, ReifyMode rm>
561 template<
class View, ReifyMode rm>
569 template<
class View, ReifyMode rm>
578 template<
class View, ReifyMode rm>
584 template<
class View, ReifyMode rm>
602 if ((x0.cardMax() == 0) ||
603 ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
604 ((x0.glbSize() > 0) && (x0.glbMax() > x1.max())))
611 if (x0.glbMax() == x0.lubMax()) {
614 if (x1.val() == x0.glbMax()) {
624 else if ((x0.glbMax() < x1.min()) ||
625 (x0.glbMax() > x1.max()) ||
649 unsigned int n = x0.cardMin();
655 nth_smallest =
static_cast<int>(ur.min() +
n - 1);
662 if (x1.max() < nth_smallest) {
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.
MaxElement(Space &home, bool share, MaxElement &p)
Constructor for cloning p.
@ RM_PMI
Inverse implication for reification.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
ExecStatus ES_SUBSUMED(Propagator &p)
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the largest element of s.
unsigned int size(I &i)
Size of all ranges of range iterator i.
const int min
Smallest allowed integer in integer set.
@ RM_IMP
Implication for reification.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Range iterator for the unknown set.
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Base-class for both propagators and branchers.
ReMinElement(Space &home, bool share, ReMinElement &p)
Constructor for cloning p.
MinElement(Space &home, bool share, MinElement &p)
Constructor for cloning p.
static const int MIN_OF_EMPTY
Returned by empty sets when asked for their minimum element.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Boolean view for Boolean variables.
Gecode toplevel namespace
const int max
Largest allowed integer in integer set.
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
static const int MAX_OF_EMPTY
Returned by empty sets when asked for their maximum element.
Propagator for reified minimum element
int min(void) const
Return smallest value of range.
Reified mixed binary propagator.
Home class for posting propagators
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
Range iterator for computing intersection (binary)
Post propagator for SetVar SetOpType SetVar SetRelType r
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the minimal element of s.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Propagator for not maximum element
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is not the minimal element of s.
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.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Propagator for maximum element
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
NotMaxElement(Space &home, bool share, NotMaxElement &p)
Constructor for cloning p.
@ ES_FIX
Propagation has computed fixpoint.
int max(void) const
Return largest value of range.
Integer view for integer variables.
NotMinElement(Space &home, bool share, NotMinElement &p)
Constructor for cloning p.
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
Reified propagator for maximum element
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is not the largest element of s.
ReMaxElement(Space &home, bool share, ReMaxElement &p)
Constructor for cloning p.
Propagator for not minimum element
int n
Number of negative literals for node type.
Propagator for minimum element
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
int ModEventDelta
Modification event deltas.
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
@ ES_OK
Execution is okay.
int p
Number of positive literals for node type.
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.