34 namespace Gecode {
namespace Int {
namespace Distinct {
40 template<
class View,
bool complete>
47 int* stack =
r.alloc<
int>(
n);
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())) {
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;
155 #ifdef GECODE_HAS_CBS
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.
Node * x
Pointer to corresponding Boolean expression node.
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 .
@ 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.
int ModEvent
Type for modification events.
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 > &x)
Eliminate singletons by naive value propagation.
bool assigned(View x, int v)
Whether x is assigned to value v.
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)
unsigned int size(I &i)
Size of all ranges of range iterator i.
Gecode::IntArgs i({1, 2, 3, 4})