34namespace Gecode {
namespace Int {
namespace Distinct {
40 template<
class View,
bool complete>
47 int* stack =
r.alloc<
int>(
n);
54 if (
x[i].assigned()) {
55 c_v[c_n++]=
x[i].val();
x[i]=
x[--
n];
62 if (!complete && (
t > 16)) {
70 for (
int i=0; i<c_n; i++)
74 for (
int i=0; i<
n; i++) {
90 if (d.
size() !=
static_cast<unsigned int>(c_n))
95 for (
int i =
n; i--; )
96 if ((d.
min() <=
x[i].max()) && (d.
max() >=
x[i].min())) {
98 ModEvent me =
x[i].minus_r(home,dr,
false);
102 c_v[c_n++]=
x[i].val();
x[i]=
x[--
n];
107 int* n_v = &c_v[c_n];
113 for (
int i=0; i<c_n; i++)
117 for (
int i=0; i<n_n; i++)
121 for (
int i =
n; i--; ) {
126 n_v[n_n++]=
x[i].val();
x[i]=
x[--
n];
130 c_v = n_v; c_n = n_n;
159 cbsdistinct(home,this->
id(),
x,send);
164 Val<View>::domainsizesum(Propagator::InDecision in,
unsigned int& size,
165 unsigned int& size_b)
const {
166 cbssize(
x,in,size,size_b);
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
Range iterator for integer sets.
int min(int i) const
Return minimum of range at position i.
int max(int i) const
Return maximum of range at position i.
unsigned int size(void) const
Return size (cardinality) of set.
Naive value distinct propagator.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, ViewArray< View > &x)
Post propagator for view array x.
Val(Home home, ViewArray< View > &x)
Constructor for posting.
static ExecStatus post(Home home, V0 x0, V1 x1)
Post propagator .
ExecStatus ES_SUBSUMED(Propagator &p)
int ModEventDelta
Modification event deltas.
bool me_failed(ModEvent me)
Check whether modification event me is failed.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
ExecStatus prop_val(Space &home, ViewArray< View > &)
Eliminate singletons by naive value propagation.
const Gecode::PropCond PC_INT_VAL
Propagate when a view becomes assigned (single value)
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable)
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
@ ES_OK
Execution is okay.
@ ES_FIX
Propagation has computed fixpoint.
@ 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.