38 namespace Gecode {
namespace Int {
namespace Distinct {
44 template<
class View,
bool complete>
51 int* stack = r.
alloc<
int>(
n);
57 for (
int i = n;
i--; )
59 c_v[c_n++]=x[
i].val(); x[
i]=x[--
n];
66 if (!complete && (t > 16)) {
74 for (
int i = c_n;
i--; )
78 for (
int i = n;
i--; ) {
94 if (d.
size() !=
static_cast<unsigned int>(c_n))
99 for (
int i = n;
i--; )
100 if ((d.
min() <= x[
i].max()) && (d.
max() >= x[
i].min())) {
102 ModEvent me = x[
i].minus_r(home,dr,
false);
106 c_v[c_n++]=x[
i].val(); x[
i]=x[--
n];
111 int* n_v = &c_v[c_n];
117 for (
int i = c_n;
i--; )
121 for (
int i = n_n;
i--; )
125 for (
int i = n;
i--; ) {
130 n_v[n_n++]=x[
i].val(); x[
i]=x[--
n];
134 c_v = n_v; c_n = n_n;
162 return new (home)
Val<View>(home,share,*
this);
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Range iterator for integer sets.
ExecStatus ES_SUBSUMED(Propagator &p)
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
Val(Home home, ViewArray< View > &x)
Constructor for posting.
int ModEvent
Type for modification events.
Propagation has computed fixpoint.
Base-class for both propagators and branchers.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
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.
Execution has resulted in failure.
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable)
unsigned int size(void) const
Return size (cardinality) of set.
static ExecStatus post(Home home, ViewArray< View > &x)
Post propagator for view array x.
ExecStatus prop_val(Space &home, ViewArray< View > &x)
Eliminate singletons by naive value propagation.
Naive value distinct propagator.
Node * x
Pointer to corresponding Boolean expression node.
bool assigned(View x, int v)
Whether x is assigned to value v.
Binary disequality propagator.
Propagation has not computed fixpoint.
int size(void) const
Return size of array (number of elements)
Gecode toplevel namespace
int ModEventDelta
Modification event deltas.
Home class for posting propagators
int max(int i) const
Return maximum of range at position i.
bool me_failed(ModEvent me)
Check whether modification event me is failed.
int min(int i) const
Return minimum of range at position i.
const Gecode::PropCond PC_INT_VAL
Propagate when a view becomes assigned (single value)